Commit 0d9b30f0 authored by hybrid's avatar hybrid

Minor changes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@949 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 8a0d790a
...@@ -226,7 +226,7 @@ void CGUIScrollBar::updateAbsolutePosition() ...@@ -226,7 +226,7 @@ void CGUIScrollBar::updateAbsolutePosition()
if (Horizontal) if (Horizontal)
{ {
f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / (f32)Max; const f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / (f32)Max;
DrawPos = (s32)((Pos * f) + ((f32)RelativeRect.getHeight() * 0.5f)); DrawPos = (s32)((Pos * f) + ((f32)RelativeRect.getHeight() * 0.5f));
DrawHeight = RelativeRect.getHeight(); DrawHeight = RelativeRect.getHeight();
} }
...@@ -245,12 +245,12 @@ void CGUIScrollBar::setPosFromMousePos(s32 x, s32 y) ...@@ -245,12 +245,12 @@ void CGUIScrollBar::setPosFromMousePos(s32 x, s32 y)
{ {
if (Horizontal) if (Horizontal)
{ {
f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / (f32)Max; const f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / (f32)Max;
setPos((s32)(((f32)(x - AbsoluteRect.UpperLeftCorner.X - RelativeRect.getHeight())) / f)); setPos((s32)(((f32)(x - AbsoluteRect.UpperLeftCorner.X - RelativeRect.getHeight())) / f));
} }
else else
{ {
f32 f = (RelativeRect.getHeight() - ((f32)RelativeRect.getWidth()*3.0f)) / (f32)Max; const f32 f = (RelativeRect.getHeight() - ((f32)RelativeRect.getWidth()*3.0f)) / (f32)Max;
setPos((s32)(((f32)y - AbsoluteRect.UpperLeftCorner.Y - RelativeRect.getWidth()) / f)); setPos((s32)(((f32)y - AbsoluteRect.UpperLeftCorner.Y - RelativeRect.getWidth()) / f));
} }
} }
...@@ -260,15 +260,16 @@ void CGUIScrollBar::setPosFromMousePos(s32 x, s32 y) ...@@ -260,15 +260,16 @@ void CGUIScrollBar::setPosFromMousePos(s32 x, s32 y)
//! sets the position of the scrollbar //! sets the position of the scrollbar
void CGUIScrollBar::setPos(s32 pos) void CGUIScrollBar::setPos(s32 pos)
{ {
Pos = pos; if (pos < 0)
if (Pos < 0)
Pos = 0; Pos = 0;
if (Pos > Max) else if (pos > Max)
Pos = Max; Pos = Max;
else
Pos = pos;
if (Horizontal) if (Horizontal)
{ {
f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / (f32)Max; const f32 f = (RelativeRect.getWidth() - ((f32)RelativeRect.getHeight()*3.0f)) / (f32)Max;
DrawPos = (s32)((Pos * f) + ((f32)RelativeRect.getHeight() * 0.5f)); DrawPos = (s32)((Pos * f) + ((f32)RelativeRect.getHeight() * 0.5f));
DrawHeight = RelativeRect.getHeight(); DrawHeight = RelativeRect.getHeight();
} }
...@@ -417,9 +418,9 @@ void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeRead ...@@ -417,9 +418,9 @@ void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeRead
IGUIScrollBar::serializeAttributes(out,options); IGUIScrollBar::serializeAttributes(out,options);
out->addBool("Horizontal", Horizontal); out->addBool("Horizontal", Horizontal);
out->addInt ("Value", Pos); out->addInt ("Value", Pos);
out->addInt ("Max", Max); out->addInt ("Max", Max);
out->addInt ("SmallStep", SmallStep); out->addInt ("SmallStep", SmallStep);
} }
//! Reads attributes of the element //! Reads attributes of the element
...@@ -441,3 +442,4 @@ void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeRea ...@@ -441,3 +442,4 @@ void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeRea
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
...@@ -125,24 +125,22 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture, ...@@ -125,24 +125,22 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture,
if (!texture || !heightmap) if (!texture || !heightmap)
return 0; return 0;
video::SMaterial material;
c8 textureName[64];
c8 tmp[255];
// debug border // debug border
s32 borderSkip = debugBorders ? 0 : 1; const s32 borderSkip = debugBorders ? 0 : 1;
video::S3DVertex vtx; video::S3DVertex vtx;
vtx.Color.set(255,255,255,255); vtx.Color.set(255,255,255,255);
SMesh* mesh = new SMesh(); SMesh* mesh = new SMesh();
u32 tm = os::Timer::getRealTime()/1000; const u32 tm = os::Timer::getRealTime()/1000;
core::dimension2d<s32> hMapSize= heightmap->getDimension(); const core::dimension2d<s32> hMapSize= heightmap->getDimension();
core::dimension2d<s32> tMapSize= texture->getDimension(); const core::dimension2d<s32> tMapSize= texture->getDimension();
core::position2d<f32> thRel((f32)tMapSize.Width / hMapSize.Width, (f32)tMapSize.Height / hMapSize.Height); const core::position2d<f32> thRel((f32)tMapSize.Width / hMapSize.Width, (f32)tMapSize.Height / hMapSize.Height);
core::position2d<s32> processed(0,0);
video::SMaterial material;
core::position2d<s32> processed(0,0);
while (processed.Y<hMapSize.Height) while (processed.Y<hMapSize.Height)
{ {
while(processed.X<hMapSize.Width) while(processed.X<hMapSize.Width)
...@@ -207,10 +205,11 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture, ...@@ -207,10 +205,11 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture,
if (buffer->Vertices.size()) if (buffer->Vertices.size())
{ {
c8 textureName[64];
// create texture for this block // create texture for this block
video::IImage* img = new video::CImage(texture, video::IImage* img = new video::CImage(texture,
core::position2d<s32>((s32)(processed.X*thRel.X), (s32)(processed.Y*thRel.Y)), core::position2d<s32>(core::floor32(processed.X*thRel.X), core::floor32(processed.Y*thRel.Y)),
core::dimension2d<s32>((s32)(blockSize.Width*thRel.X), (s32)(blockSize.Height*thRel.Y))); core::dimension2d<s32>(core::floor32(blockSize.Width*thRel.X), core::floor32(blockSize.Height*thRel.Y)));
sprintf(textureName, "terrain%u_%d", tm, mesh->getMeshBufferCount()); sprintf(textureName, "terrain%u_%d", tm, mesh->getMeshBufferCount());
...@@ -218,6 +217,7 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture, ...@@ -218,6 +217,7 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture,
if (material.Textures[0]) if (material.Textures[0])
{ {
c8 tmp[255];
sprintf(tmp, "Generated terrain texture (%dx%d): %s", sprintf(tmp, "Generated terrain texture (%dx%d): %s",
material.Textures[0]->getSize().Width, material.Textures[0]->getSize().Width,
material.Textures[0]->getSize().Height, material.Textures[0]->getSize().Height,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment