From: Ingo Ruhnke Date: Mon, 3 Jul 2006 18:21:05 +0000 (+0000) Subject: - some small adjustments to the lighting X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=251fce9ec1ac9372fb63f2a049d261b281eb645b;p=supertux.git - some small adjustments to the lighting SVN-Revision: 3855 --- diff --git a/data/images/objects/spotlight/light.png b/data/images/objects/spotlight/light.png new file mode 100644 index 000000000..16f33acca Binary files /dev/null and b/data/images/objects/spotlight/light.png differ diff --git a/data/images/objects/spotlight/light.sprite b/data/images/objects/spotlight/light.sprite new file mode 100644 index 000000000..2af97de8d --- /dev/null +++ b/data/images/objects/spotlight/light.sprite @@ -0,0 +1,7 @@ +(supertux-sprite + (action + (name "default") + (images "light.png") + (hitbox 500 500 0 0) + ) +) diff --git a/data/images/objects/spotlight/lightcone.png b/data/images/objects/spotlight/lightcone.png index 63393e8c4..b2ae01d36 100644 Binary files a/data/images/objects/spotlight/lightcone.png and b/data/images/objects/spotlight/lightcone.png differ diff --git a/data/levels/test/light.stl b/data/levels/test/light.stl index 77473f13f..f41d431c2 100644 --- a/data/levels/test/light.stl +++ b/data/levels/test/light.stl @@ -70,6 +70,7 @@ (reset-points ) (objects - (spotlight ) + (spotlight (x 100) (y 300)) + (spotlight (x 500) (y 200)) ) ) diff --git a/src/object/spotlight.cpp b/src/object/spotlight.cpp index e15cdf371..d171525eb 100644 --- a/src/object/spotlight.cpp +++ b/src/object/spotlight.cpp @@ -27,12 +27,16 @@ #include "player.hpp" #include "sector.hpp" -Spotlight::Spotlight(const lisp::Lisp& ) +Spotlight::Spotlight(const lisp::Lisp& lisp) { + lisp.get("x", position.x); + lisp.get("y", position.y); + center = sprite_manager->create("images/objects/spotlight/spotlight_center.sprite"); base = sprite_manager->create("images/objects/spotlight/spotlight_base.sprite"); lights = sprite_manager->create("images/objects/spotlight/spotlight_lights.sprite"); lightcone = sprite_manager->create("images/objects/spotlight/lightcone.sprite"); + light = sprite_manager->create("images/objects/spotlight/light.sprite"); angle = 0.0f; } @@ -43,6 +47,7 @@ Spotlight::~Spotlight() delete base; delete lights; delete lightcone; + delete light; } void @@ -57,23 +62,24 @@ Spotlight::draw(DrawingContext& context) context.push_target(); context.set_target(DrawingContext::LIGHTMAP); - Vector pos(100, 300); - - lightcone->set_angle(angle); - lightcone->draw(context, pos, 0); + light->set_angle(angle); + light->draw(context, position, 0); - lightcone->set_angle(angle + 180.0f); - lightcone->draw(context, pos, 0); + //lightcone->set_angle(angle); + //lightcone->draw(context, position, 0); context.set_target(DrawingContext::NORMAL); lights->set_angle(angle); - lights->draw(context, pos, 0); + lights->draw(context, position, 0); base->set_angle(angle); - base->draw(context, pos, 0); + base->draw(context, position, 0); - center->draw(context, pos, 0); + center->draw(context, position, 0); + + lightcone->set_angle(angle); + lightcone->draw(context, position, LAYER_FOREGROUND1 + 10); context.pop_target(); } diff --git a/src/object/spotlight.hpp b/src/object/spotlight.hpp index 520ad1a21..e8d76e16a 100644 --- a/src/object/spotlight.hpp +++ b/src/object/spotlight.hpp @@ -21,6 +21,7 @@ #define __SPOTLIGHT_HPP__ #include "game_object.hpp" +#include "math/vector.hpp" #include "lisp/lisp.hpp" class Sprite; @@ -35,10 +36,12 @@ public: void draw(DrawingContext& context); private: + Vector position; float angle; Sprite* center; Sprite* base; Sprite* lights; + Sprite* light; Sprite* lightcone; }; diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index 5dbad1869..281f98123 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -327,7 +327,7 @@ DrawingContext::do_drawing() glLoadIdentity(); // FIXME: Add ambient light support here - glClearColor(0.5, 0.5, 0.5, 1); + glClearColor(0.3, 0.3, 0.4, 1); glClear(GL_COLOR_BUFFER_BIT); handle_drawing_requests(lightmap_requests); lightmap_requests.clear();