From c2c1294ec99e3dae593bb31d2f331738d5be91d5 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 8 Sep 2012 23:44:14 +0200 Subject: CTerrain refactoring & fixes - refactored CTerrain code - fixed some minor bugs --- src/graphics/engine/cloud.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/graphics/engine/cloud.cpp') diff --git a/src/graphics/engine/cloud.cpp b/src/graphics/engine/cloud.cpp index 6f6bc57..4c1d179 100644 --- a/src/graphics/engine/cloud.cpp +++ b/src/graphics/engine/cloud.cpp @@ -28,7 +28,8 @@ const int CLOUD_LINE_PREALLOCATE_COUNT = 100; -const int DIMEXPAND = 4; // extension of the dimensions +//! Extension of the bricks dimensions +const int CLOUD_SIZE_EXPAND = 4; Gfx::CCloud::CCloud(CInstanceManager* iMan, Gfx::CEngine* engine) @@ -99,10 +100,10 @@ void Gfx::CCloud::Draw() if (m_level == 0.0f) return; if (m_lines.empty()) return; - std::vector vertices((m_brick+2)*2, Gfx::VertexTex2()); + std::vector vertices((m_brickCount+2)*2, Gfx::VertexTex2()); float iDeep = m_engine->GetDeepView(); - float deep = (m_brick*m_size)/2.0f; + float deep = (m_brickCount*m_brickSize)/2.0f; m_engine->SetDeepView(deep); m_engine->SetFocus(m_engine->GetFocus()); m_engine->UpdateMatProj(); // increases the depth of view @@ -132,7 +133,7 @@ void Gfx::CCloud::Draw() matrix.LoadIdentity(); device->SetTransform(Gfx::TRANSFORM_WORLD, matrix); - float size = m_size/2.0f; + float size = m_brickSize/2.0f; Math::Vector eye = m_engine->GetEyePt(); Math::Vector n = Math::Vector(0.0f, -1.0f, 0.0f); @@ -195,11 +196,11 @@ void Gfx::CCloud::CreateLine(int x, int y, int len) line.y = y; line.len = len; - float offset = m_brick*m_size/2.0f - m_size/2.0f; + float offset = m_brickCount*m_brickSize/2.0f - m_brickSize/2.0f; - line.px1 = m_size* line.x - offset; - line.px2 = m_size*(line.x+line.len) - offset; - line.pz = m_size* line.y - offset; + line.px1 = m_brickSize* line.x - offset; + line.px2 = m_brickSize*(line.x+line.len) - offset; + line.pz = m_brickSize* line.y - offset; m_lines.push_back(line); } @@ -223,18 +224,18 @@ void Gfx::CCloud::Create(const std::string& fileName, m_wind = m_terrain->GetWind(); - m_brick = m_terrain->GetBrick()*m_terrain->GetMosaic()*DIMEXPAND; - m_size = m_terrain->GetSize(); + m_brickCount = m_terrain->GetBrickCount()*m_terrain->GetMosaicCount()*CLOUD_SIZE_EXPAND; + m_brickSize = m_terrain->GetBrickSize(); - m_brick /= m_subdiv*DIMEXPAND; - m_size *= m_subdiv*DIMEXPAND; + m_brickCount /= m_subdiv*CLOUD_SIZE_EXPAND; + m_brickSize *= m_subdiv*CLOUD_SIZE_EXPAND; if (m_level == 0.0f) return; m_lines.clear(); - for (int y = 0; y < m_brick; y++) - CreateLine(0, y, m_brick); + for (int y = 0; y < m_brickCount; y++) + CreateLine(0, y, m_brickCount); return; } -- cgit v1.2.3-1-g7c22