From 9d06eb65030b090586afac5bd2e0a4799b1b1236 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 30 Jan 2013 12:00:13 +0000 Subject: [PATCH] meshviewer: add two lights. --- .gitignore | 1 + test/Makefile.am | 10 +++++----- test/MeshViewer.cpp | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 7f4be156..92940d8b 100644 --- a/.gitignore +++ b/.gitignore @@ -70,6 +70,7 @@ build/vs2010/*.XGD # Our binaries test/benchsuite test/btphystest +test/meshviewer test/testsuite test/sandbox/sample test/math/pi diff --git a/test/Makefile.am b/test/Makefile.am index 28c75ac1..7b08e889 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 diff --git a/test/MeshViewer.cpp b/test/MeshViewer.cpp index a0f613b3..050bcb7e 100644 --- a/test/MeshViewer.cpp +++ b/test/MeshViewer.cpp @@ -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 m_meshes; + Array m_lights; Camera *m_camera; bool m_ready;