From 80d3a9bff1d5999ec5504b50103be7687672227a Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Wed, 26 Sep 2012 23:18:57 +0200 Subject: Lighting fix (experimental) - changed fixed light allocation to prioritized per-use basis - minor refactoring in CPlanet and CWater --- src/object/robotmain.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index d6f2d2d..10733f7 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -3908,7 +3908,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) OpFloat(line, "dir", 0.0f), name, Math::Point(uv1.x, uv1.z), - Math::Point(uv2.x, uv2.z)); + Math::Point(uv2.x, uv2.z), + strstr(name, "planet") != nullptr // TODO: add transparent op or modify textures + ); } if (Cmd(line, "FrontsizeName") && !resetObject) @@ -4843,7 +4845,7 @@ int CRobotMain::CreateLight(Math::Vector direction, Gfx::Color color) light.type = Gfx::LIGHT_DIRECTIONAL; light.diffuse = color; light.direction = direction; - int obj = m_lightMan->CreateLight(); + int obj = m_lightMan->CreateLight(Gfx::LIGHT_PRI_HIGH); m_lightMan->SetLight(obj, light); return obj; @@ -4866,7 +4868,7 @@ int CRobotMain::CreateSpot(Math::Vector pos, Gfx::Color color) light.attenuation0 = 2.0f; light.attenuation1 = 0.0f; light.attenuation2 = 0.0f; - int obj = m_lightMan->CreateLight(); + int obj = m_lightMan->CreateLight(Gfx::LIGHT_PRI_HIGH); m_lightMan->SetLight(obj, light); return obj; -- cgit v1.2.3-1-g7c22 From 2ef1c8b6f8976c2c11034a6d30d941e5b22bfac0 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Thu, 27 Sep 2012 20:36:52 +0200 Subject: Fixed blinking light problem - temporarily commented out misbehaving code in CPhysics - some fixes in CLightManager - minor refactoring in CRobotMain --- src/object/robotmain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 10733f7..521b518 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -3913,7 +3913,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) ); } - if (Cmd(line, "FrontsizeName") && !resetObject) + if (Cmd(line, "ForegroundName") && !resetObject) { OpString(line, "image", name); m_engine->SetForegroundName(name); @@ -3962,7 +3962,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) OpTypeWater(line, "water", Gfx::WATER_TT), name, OpColor(line, "diffuse", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), - OpColor(line, "ambiant", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), + OpColor(line, "ambient", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), OpFloat(line, "level", 100.0f)*UNIT, OpFloat(line, "glint", 1.0f), pos); @@ -3978,7 +3978,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) OpString(line, "image", name); m_cloud->Create(name, OpColor(line, "diffuse", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), - OpColor(line, "ambiant", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), + OpColor(line, "ambient", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), OpFloat(line, "level", 500.0f) * UNIT); } -- cgit v1.2.3-1-g7c22 From a394c9efec830b275c0b738974126aead284ec4e Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Thu, 27 Sep 2012 20:43:20 +0200 Subject: Updated docs and some Doxygen fixes --- src/object/README.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/object') diff --git a/src/object/README.txt b/src/object/README.txt index f3bad23..fe946db 100644 --- a/src/object/README.txt +++ b/src/object/README.txt @@ -1,7 +1,7 @@ /** - * \dir object + * \dir src/object * \brief Game engine * * Contains the main class of game engine - CRobotMain and the various in-game objects: * CObject and related auto, motion and task subclasses. - */ \ No newline at end of file + */ -- cgit v1.2.3-1-g7c22 From 6d0ed0d26aebead7c79e4fb97c6962e06e7dcb41 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Thu, 27 Sep 2012 23:18:12 +0200 Subject: Completely fixed light issues Directional and spot lights are now set properly --- src/object/object.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/object') diff --git a/src/object/object.cpp b/src/object/object.cpp index e93fa1e..0b1a39c 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -2244,14 +2244,12 @@ bool CObject::CreateInsect(Math::Vector pos, float angle, ObjectType type) bool CObject::CreateShadowLight(float height, Gfx::Color color) { - Gfx::Light light; - Math::Vector pos; - if ( !m_engine->GetLightMode() ) return true; - pos = GetPosition(0); + Math::Vector pos = GetPosition(0); m_shadowHeight = height; + Gfx::Light light; light.type = Gfx::LIGHT_SPOT; light.diffuse.r = color.r; light.diffuse.g = color.g; @@ -2262,12 +2260,10 @@ bool CObject::CreateShadowLight(float height, Gfx::Color color) light.direction.x = 0.0f; light.direction.y = -1.0f; // against the bottom light.direction.z = 0.0f; - //TODO Is this value correct light.spotIntensity = 128; light.attenuation0 = 1.0f; light.attenuation1 = 0.0f; light.attenuation2 = 0.0f; - //TODO Is this value correct light.spotAngle = 90; m_shadowLight = m_lightMan->CreateLight(); @@ -2292,13 +2288,11 @@ int CObject::GetShadowLight() bool CObject::CreateEffectLight(float height, Gfx::Color color) { - Gfx::Light light; - if ( !m_engine->GetLightMode() ) return true; m_effectHeight = height; - memset( &light, 0, sizeof(light) ); + Gfx::Light light; light.type = Gfx::LIGHT_SPOT; light.diffuse.r = color.r; light.diffuse.g = color.g; @@ -2309,12 +2303,10 @@ bool CObject::CreateEffectLight(float height, Gfx::Color color) light.direction.x = 0.0f; light.direction.y = -1.0f; // against the bottom light.direction.z = 0.0f; - //TODO Is this value correct - light.spotIntensity = 1.0f; + light.spotIntensity = 0.0f; light.attenuation0 = 1.0f; light.attenuation1 = 0.0f; light.attenuation2 = 0.0f; - //TODO Is this value correct light.spotAngle = 90; m_effectLight = m_lightMan->CreateLight(); -- cgit v1.2.3-1-g7c22 From 1fa7053ac0763721bd6dd2ad56b256ecc2643021 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 29 Sep 2012 19:29:51 +0200 Subject: Fixed object selection by clicking --- src/object/robotmain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/object') diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 62a157d..327e73f 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1510,7 +1510,7 @@ bool CRobotMain::EventProcess(Event &event) break; case EVENT_MOUSE_BUTTON_DOWN: - if (event.mouseButton.button != 1) // only left mouse button + if (event.mouseButton.button != MOUSE_BUTTON_LEFT) // only left mouse button break; obj = DetectObject(event.mousePos); @@ -1532,7 +1532,7 @@ bool CRobotMain::EventProcess(Event &event) break; case EVENT_MOUSE_BUTTON_UP: - if (event.mouseButton.button != 1) // only left mouse button + if (event.mouseButton.button != MOUSE_BUTTON_LEFT) // only left mouse button break; m_cameraPan = 0.0f; -- cgit v1.2.3-1-g7c22