summaryrefslogtreecommitdiffstats
path: root/src/graphics/engine/water.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-26 23:18:57 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-26 23:18:57 +0200
commit80d3a9bff1d5999ec5504b50103be7687672227a (patch)
tree70a695f4304d1ac10d391b7e5c0c641ff7fc05b5 /src/graphics/engine/water.cpp
parent2fa4d7b0db88abcccbda287af10fc336a8dbb910 (diff)
downloadcolobot-80d3a9bff1d5999ec5504b50103be7687672227a.tar.gz
colobot-80d3a9bff1d5999ec5504b50103be7687672227a.tar.bz2
colobot-80d3a9bff1d5999ec5504b50103be7687672227a.zip
Lighting fix (experimental)
- changed fixed light allocation to prioritized per-use basis - minor refactoring in CPlanet and CWater
Diffstat (limited to 'src/graphics/engine/water.cpp')
-rw-r--r--src/graphics/engine/water.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/graphics/engine/water.cpp b/src/graphics/engine/water.cpp
index 81034a3..18811eb 100644
--- a/src/graphics/engine/water.cpp
+++ b/src/graphics/engine/water.cpp
@@ -279,11 +279,9 @@ void CWater::DrawBack()
material.ambient = m_ambient;
m_engine->SetMaterial(material);
- m_engine->SetTexture("", 0); // TODO: disable texturing
-
CDevice* device = m_engine->GetDevice();
- m_engine->SetState(ENG_RSTATE_NORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_OPAQUE_COLOR);
float deep = m_engine->GetDeepView(0);
m_engine->SetDeepView(deep*2.0f, 0);
@@ -310,17 +308,14 @@ void CWater::DrawBack()
p1.y = -50.0f;
p2.y = m_level;
- Math::Vector n;
- n.x = (lookat.x-eye.x)/dist;
- n.z = (lookat.z-eye.z)/dist;
- n.y = 0.0f;
+ Gfx::Color white = Gfx::Color(1.0f, 1.0f, 1.0f, 0.0f);
- Vertex vertices[4] =
+ VertexCol vertices[4] =
{
- Vertex(Math::Vector(p1.x, p2.y, p1.z), n),
- Vertex(Math::Vector(p1.x, p1.y, p1.z), n),
- Vertex(Math::Vector(p2.x, p2.y, p2.z), n),
- Vertex(Math::Vector(p2.x, p1.y, p2.z), n)
+ VertexCol(Math::Vector(p1.x, p2.y, p1.z), white),
+ VertexCol(Math::Vector(p1.x, p1.y, p1.z), white),
+ VertexCol(Math::Vector(p2.x, p2.y, p2.z), white),
+ VertexCol(Math::Vector(p2.x, p1.y, p2.z), white)
};
device->DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, vertices, 4);
@@ -480,8 +475,8 @@ void CWater::CreateLine(int x, int y, int len)
}
void CWater::Create(WaterType type1, WaterType type2, const std::string& fileName,
- Color diffuse, Color ambient,
- float level, float glint, Math::Vector eddy)
+ Color diffuse, Color ambient,
+ float level, float glint, Math::Vector eddy)
{
m_type[0] = type1;
m_type[1] = type2;