Przeglądaj źródła

meshviewer: add two lights.

legacy
Sam Hocevar sam 12 lat temu
rodzic
commit
9d06eb6503
3 zmienionych plików z 22 dodań i 7 usunięć
  1. +1
    -0
      .gitignore
  2. +5
    -5
      test/Makefile.am
  3. +16
    -2
      test/MeshViewer.cpp

+ 1
- 0
.gitignore Wyświetl plik

@@ -70,6 +70,7 @@ build/vs2010/*.XGD
# Our binaries
test/benchsuite
test/btphystest
test/meshviewer
test/testsuite
test/sandbox/sample
test/math/pi


+ 5
- 5
test/Makefile.am Wyświetl plik

@@ -10,7 +10,7 @@ bench: benchsuite$(EXEEXT)

EXTRA_DIST = data/gradient.png

noinst_PROGRAMS = benchsuite $(testsuite) btphystest MeshViewer
noinst_PROGRAMS = benchsuite $(testsuite) btphystest meshviewer

TESTS = $(testsuite)

@@ -49,8 +49,8 @@ btphystest_CPPFLAGS = @LOL_CFLAGS@ -I$(top_srcdir)/src/bullet \
btphystest_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@
btphystest_DEPENDENCIES = $(top_builddir)/src/liblol.a

MeshViewer_SOURCES = MeshViewer.cpp
MeshViewer_CPPFLAGS = @LOL_CFLAGS@
MeshViewer_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@
MeshViewer_DEPENDENCIES = $(top_builddir)/src/liblol.a
meshviewer_SOURCES = MeshViewer.cpp
meshviewer_CPPFLAGS = @LOL_CFLAGS@
meshviewer_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@
meshviewer_DEPENDENCIES = $(top_builddir)/src/liblol.a


+ 16
- 2
test/MeshViewer.cpp Wyświetl plik

@@ -30,7 +30,7 @@ public:
while (i--)
{
m_meshes.Push(EasyMesh());
m_meshes.Last().Compile("[sc#0f0 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#00f ab 2 2 2 tx 0 csgu]]");
m_meshes.Last().Compile("[sc#2f2 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#22f ab 2 2 2 tx 0 csgu]]");
}

m_angle = 0;
@@ -43,6 +43,17 @@ public:
m_camera->SetPosition(vec3(0.f, 0.f, 5.f));
m_camera->ForceSceneUpdate();
Ticker::Ref(m_camera);

m_lights << new Light();
m_lights.Last()->SetPosition(vec4(4.f, -1.f, -4.f, 0.f));
m_lights.Last()->SetColor(vec4(.0f, .2f, .5f, 1.f));
Ticker::Ref(m_lights.Last());

m_lights << new Light();
m_lights.Last()->SetPosition(vec4(8.f, 2.f, 6.f, 1.f));
m_lights.Last()->SetColor(vec4(.5f, .3f, .0f, 1.f));
Ticker::Ref(m_lights.Last());

min_pos = vec3(FLT_MAX);
max_pos = vec3(-FLT_MAX);

@@ -52,6 +63,8 @@ public:
~MeshViewer()
{
Ticker::Unref(m_camera);
for (int i = 0; i < m_lights.Count(); ++i)
Ticker::Unref(m_lights[i]);
}

virtual void TickGame(float seconds)
@@ -73,7 +86,7 @@ public:
vec4 b(0,-2, 0, 1.0f);
vec4 c(0, 0, -2, 1.0f);
vec4 d(-1, -1, 1, 1.0f);
//vec2 toto;
//near plane : vec4(toto, 1.f, 1.f);
//far plane : vec4(toto, -1.f, 1.f);
@@ -152,6 +165,7 @@ private:
vec3 max_pos;

Array<EasyMesh> m_meshes;
Array<Light *> m_lights;
Camera *m_camera;

bool m_ready;


Ładowanie…
Anuluj
Zapisz