Grass Node v0.3.x
-
- Posts: 3
- Joined: Wed Nov 16, 2005 7:57 am
Arg, I get compiling errors.:
there are a coupe more, but they are just these errors over again. I am using devcpp with irrlicht 0.14.0 is there anything that I am doing wrong?
Code: Select all
424 CGrassPatchSceneNode.cpp [Warning] converting to `irr::u32' from `irr::f32'
439 CGrassPatchSceneNode.cpp [Warning] passing `float' for converting 2 of `irr::video::SColor::SColor(irr::s32, irr::s32, irr::s32, irr::s32)'
-
- Posts: 322
- Joined: Tue Aug 30, 2005 10:34 am
- Location: slovakia
-
- Posts: 3
- Joined: Wed Nov 16, 2005 7:57 am
Code: Select all
CGrassPatchSceneNode.cpp [Warning] converting to `irr::u32' from `irr::f32'
Hi bitplane,
thanks for the new version!
As I see you did not change the faulty height compution thing. *g*
So I've built in a bilinear interpolation to get the more accurate height from the heightmap.
In CGrassPatchSceneNode.cpp change the following:
line 183:
from
to
and line 189
to
and line 207
replace
with
Maybe you can integrate this into your next version?
Best regards - Xaron
thanks for the new version!
As I see you did not change the faulty height compution thing. *g*
So I've built in a bilinear interpolation to get the more accurate height from the heightmap.
In CGrassPatchSceneNode.cpp change the following:
line 183:
from
Code: Select all
s32 x1 = (s32) xz.X;
s32 z1 = (s32) xz.Z;
Code: Select all
s32 x1 = floorf( xz.X );
s32 z1 = floorf( xz.Z );
Code: Select all
if ( x1 < 0 || z1 < 0 || x1 > TerrainHeightMap->getDimension().Width || z1 > TerrainHeightMap->getDimension().Height )
Code: Select all
if ( x1 < 0 || z1 < 0 || x1 > TerrainHeightMap->getDimension().Width - 1 || z1 > TerrainHeightMap->getDimension().Height - 1 )
replace
Code: Select all
video::SColor c = TerrainHeightMap->getPixel(x1,z1);
height = c.getBlue()* Terrain->getScale().Y; // - ((rand() % 100) / 25.0f) + 2.0f;
Code: Select all
// do some bilinear interpolation to get the real height
f32 ay = TerrainHeightMap->getPixel(x1,z1).getBlue()* Terrain->getScale().Y;
f32 by = TerrainHeightMap->getPixel(x1+1,z1).getBlue()* Terrain->getScale().Y;
f32 cy = TerrainHeightMap->getPixel(x1,z1+1).getBlue()* Terrain->getScale().Y;
f32 dy = TerrainHeightMap->getPixel(x1+1,z1+1).getBlue()* Terrain->getScale().Y;
f32 u = xz.X - (f32)x1;
f32 v = xz.Z - (f32)z1;
height = ay*(1.0f-u)*(1.0f-v) + by*u*(1.0f-v) + cy*(1.0f-u)*v + dy*u*v;
Best regards - Xaron
-
- Posts: 326
- Joined: Wed Dec 14, 2005 10:08 pm