Browse Source

trying unholy resurrection

master
nek0 2 years ago
parent
commit
b4e2e5060f
  1. 62
      assets/spheres/smallsphere.obj
  2. 16
      examples/example00/Main.hs
  3. 16
      examples/example01/Main.hs
  4. 20
      examples/example02/Main.hs
  5. 16
      hw.cabal
  6. 42
      shell.nix
  7. 16
      src/Main.hs

62
assets/spheres/smallsphere.obj

@ -1,4 +1,4 @@
# Blender v2.79 (sub 0) OBJ File: 'smallsphere.blend'
# Blender v2.81 (sub 16) OBJ File: 'smallsphere.blend'
# www.blender.org
v 0.000000 -1.000000 0.000000
v 0.723600 -0.447215 0.525720
@ -12,44 +12,24 @@ v -0.723600 0.447215 -0.525720
v 0.276385 0.447215 -0.850640
v 0.894425 0.447215 0.000000
v 0.000000 1.000000 0.000000
vn 0.1876 -0.7947 0.5774
vn 0.6071 -0.7947 0.0000
vn -0.4911 -0.7947 0.3568
vn -0.4911 -0.7947 -0.3568
vn 0.1876 -0.7947 -0.5774
vn 0.9822 -0.1876 0.0000
vn 0.3035 -0.1876 0.9342
vn -0.7946 -0.1876 0.5774
vn -0.7946 -0.1876 -0.5774
vn 0.3035 -0.1876 -0.9342
vn 0.7946 0.1876 0.5774
vn -0.3035 0.1876 0.9342
vn -0.9822 0.1876 0.0000
vn -0.3035 0.1876 -0.9342
vn 0.7946 0.1876 -0.5774
vn 0.4911 0.7947 0.3568
vn -0.1876 0.7947 0.5774
vn -0.6071 0.7947 0.0000
vn -0.1876 0.7947 -0.5774
vn 0.4911 0.7947 -0.3568
s off
f 1//1 2//1 3//1
f 2//2 1//2 6//2
f 1//3 3//3 4//3
f 1//4 4//4 5//4
f 1//5 5//5 6//5
f 2//6 6//6 11//6
f 3//7 2//7 7//7
f 4//8 3//8 8//8
f 5//9 4//9 9//9
f 6//10 5//10 10//10
f 2//11 11//11 7//11
f 3//12 7//12 8//12
f 4//13 8//13 9//13
f 5//14 9//14 10//14
f 6//15 10//15 11//15
f 7//16 11//16 12//16
f 8//17 7//17 12//17
f 9//18 8//18 12//18
f 10//19 9//19 12//19
f 11//20 10//20 12//20
f 1 2 3
f 2 1 6
f 1 3 4
f 1 4 5
f 1 5 6
f 2 6 11
f 3 2 7
f 4 3 8
f 5 4 9
f 6 5 10
f 2 11 7
f 3 7 8
f 4 8 9
f 5 9 10
f 6 10 11
f 7 11 12
f 8 7 12
f 9 8 12
f 10 9 12
f 11 10 12

16
examples/example00/Main.hs

@ -31,12 +31,16 @@ main =
withAffection AffectionConfig
{ initComponents = All
, windowTitle = "hw"
, windowConfig = SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowOpenGL = Just SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 2
}
}
, windowConfigs =
[ ( 0
, SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 2
}
}
)
]
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = mapM_ handle

16
examples/example01/Main.hs

@ -31,12 +31,16 @@ main =
withAffection AffectionConfig
{ initComponents = All
, windowTitle = "hw"
, windowConfig = SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowOpenGL = Just SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 2
}
}
, windowConfigs =
[ ( 0
, SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 2
}
}
)
]
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = mapM_ handle

20
examples/example02/Main.hs

@ -31,13 +31,17 @@ main =
withAffection AffectionConfig
{ initComponents = All
, windowTitle = "hw - example 02"
, windowConfig = SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowOpenGL = Just SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 0
}
}
, initScreenMode = SDL.Fullscreen
, windowConfigs =
[ ( 0
, SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1920 1080
, SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 2
}
}
)
]
, initScreenMode = SDL.FullscreenDesktop
, preLoop = return ()
, eventLoop = mapM_ handle
, updateLoop = update
@ -133,7 +137,7 @@ update dt = do
draw :: Affection StateData ()
draw = do
GL.viewport $= (GL.Position 0 0, GL.Size 1600 900)
GL.viewport $= (GL.Position 0 0, GL.Size 1920 1080)
StateData{..} <- getAffection
drawThings program (planet : ships)
-- drawThings program (ships)

16
hw.cabal

@ -37,9 +37,9 @@ executable hw
, Init
-- other-extensions:
default-extensions: OverloadedStrings
build-depends: base >=4.9
build-depends: base >=4.12
, affection
, sdl2
, sdl2 >=2.5.0.0
, linear
, spatial-math
, bytestring
@ -67,9 +67,9 @@ executable example00
-- other-extensions:
default-extensions: OverloadedStrings
if flag(examples)
build-depends: base >=4.9
build-depends: base >=4.12
, affection
, sdl2
, sdl2 >=2.5.0.0
, linear
, spatial-math
, bytestring
@ -94,9 +94,9 @@ executable example01
, Init
-- other-extensions:
default-extensions: OverloadedStrings
build-depends: base >=4.9
build-depends: base >=4.12
, affection
, sdl2
, sdl2 >=2.5.0.0
, linear
, spatial-math
, bytestring
@ -126,9 +126,9 @@ executable example02
, Logging
-- other-extensions:
default-extensions: OverloadedStrings
build-depends: base >=4.9
build-depends: base >=4.12
, affection
, sdl2
, sdl2 >=2.5.0.0
, linear
, spatial-math
, bytestring

42
shell.nix

@ -4,21 +4,17 @@ let
inherit (nixpkgs) pkgs;
affectionNeko = with haskellPackages; callPackage ({ mkDerivation
, base, bytestring, clock, containers, glib, linear, monad-loops, monad-parallel
, mtl, OpenGL, sdl2, stdenv, stm, text, uuid, vector }:
affection = with haskellPackages; callPackage(
{ mkDerivation, base, bytestring, clock, containers, glib, linear
, monad-loops, monad-parallel, mtl, OpenGL, sdl2, stdenv, stm, text
, uuid, vector
}:
mkDerivation {
pname = "affection";
version = "0.0.0.9";
#src = pkgs.fetchFromGitHub {
# owner = "nek0";
# repo = "affection";
# rev = "33c99b8888328e4ed17f5c65ac49f5eab2645549";
# sha256 = "0psqxqj1a8l5fia49ay2pb72kjnw5i54m6dcmrpz5hi1654aznll";
#};
src = ../affection;
revision = "1";
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
base bytestring clock containers glib linear monad-loops
monad-parallel mtl OpenGL sdl2 stm text uuid vector
@ -66,9 +62,26 @@ let
}) {};
shoot = with haskellPackages; callPackage(
{ mkDerivation, base, inline-c, inline-c-cpp, linear
, stdenv, nbullet
}:
mkDerivation {
pname = "shoot";
version = "0.0.0.0";
src = ../shoot;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [ base inline-c inline-c-cpp linear ];
#librarySystemDepends = [ nbullet ];
libraryPkgconfigDepends = [ nbullet ];
description = "Haskell bindings to bullet library";
license = stdenv.lib.licenses.lgpl3;
}) {nbullet = pkgs.bullet;};
f = { mkDerivation, base, bytestring, GLUtil, linear
, OpenGL, OpenGLRaw, optparse-applicative, random, sdl2
, split, stdenv, vector, wavefront
, OpenGL, OpenGLRaw, random, sdl2, spatial-math, stdenv
, vector, wavefront
}:
mkDerivation {
pname = "hw";
@ -81,6 +94,11 @@ let
affectionNeko base bytestring GLUtil linear OpenGL OpenGLRaw
optparse-applicative random sdl2 shootNeko spatial split vector
wavefront
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
affection base bytestring GLUtil linear OpenGL OpenGLRaw random
sdl2 shoot spatial-math vector wavefront
];
license = stdenv.lib.licenses.gpl3;
};

16
src/Main.hs

@ -31,12 +31,16 @@ main =
withAffection AffectionConfig
{ initComponents = All
, windowTitle = "hw"
, windowConfig = SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowOpenGL = Just SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 3
}
}
, windowConfigs =
[ ( 0
, SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 3
}
}
)
]
, initScreenMode = SDL.Fullscreen
, preLoop = return ()
, eventLoop = mapM_ handle

Loading…
Cancel
Save