#include <water_shape.h>
Inheritance diagram for NL3D::CWaterShape:
Nevrax France
Definition at line 79 of file water_shape.h.
Lighmap | |
void | enableLightMapping (bool enable=true) |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
bool | isLightMappingEnabled () const |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
void | computeBBox () |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
void | envMapUpdate () |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
void | updateHeightMapNormalizationFactors () |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CAABBox | _BBox |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CSmartPtr< ITexture > | _BumpMap [2] |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CSmartPtr< ITexture > | _ColorMap |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CVector2f | _ColorMapMatColumn0 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CVector2f | _ColorMapMatColumn1 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CVector2f | _ColorMapMatPos |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
bool | _ComputeLightmap |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
CTrackDefaultVector | _DefaultPos |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
CTrackDefaultQuat | _DefaultRotQuat |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
CTrackDefaultVector | _DefaultScale |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CSmartPtr< ITexture > | _EnvMap [2] |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
float | _HeightMapNormalizationFactor [2] |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CVector2f | _HeightMapScale [2] |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CVector2f | _HeightMapSpeed [2] |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
bool | _HeightMapTouch [2] |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
NLMISC::CPolygon2D | _Poly |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
float | _TransitionRatio |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
uint32 | _WaterPoolID |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
float | _WaveHeightFactor |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
void | initVertexProgram () |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
void | setupVertexBuffer () |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
bool | _GridSizeTouched = true |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::vector< uint32 > | _IBDownUp |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::vector< uint32 > | _IBUpDown |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
uint32 | _MaxGridSize |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
CVertexBuffer | _VB |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::auto_ptr< CVertexProgram > | _VertexProgramBump1 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::auto_ptr< CVertexProgram > | _VertexProgramBump1Diffuse |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::auto_ptr< CVertexProgram > | _VertexProgramBump2 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::auto_ptr< CVertexProgram > | _VertexProgramBump2Diffuse |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::auto_ptr< CVertexProgram > | _VertexProgramNoBump |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
std::auto_ptr< CVertexProgram > | _VertexProgramNoBumpDiffuse |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
uint32 | _XGridBorder = 4 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
uint32 | _XScreenGridSize = 40 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
uint32 | _YGridBorder = 4 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
uint32 | _YScreenGridSize = 40 |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
class | CWaterModel |
Tells this shape that it can replace its colormap by a lightmap during the zone lighting. | |
Geometry setup | |
const NLMISC::CPolygon2D & | getShape () const |
get the polygon used by this shape, in the object space | |
void | getShapeInWorldSpace (NLMISC::CPolygon &poly) const |
get the polygon this shape, in world space | |
uint32 | getWaterPoolID () const |
get the polygon used by this shape, in the object space | |
float | getWaveHeightFactor () const |
Get the factor that is applied to waves height when they are displayed. default is 1. | |
void | setShape (const NLMISC::CPolygon2D &poly) |
get the polygon used by this shape, in the object space | |
void | setWaterPoolID (uint32 id) |
all water shape that have the same weter id will share the same height map for wave propagations | |
void | setWaveHeightFactor (float f) |
Set a factor that is applied to waves height when they are displayed. default is 1. | |
uint32 | getScreenXGridSize () |
get the polygon used by this shape, in the object space | |
uint32 | getScreenYGridSize () |
get the polygon used by this shape, in the object space | |
uint32 | getXGridBorder () |
get the polygon used by this shape, in the object space | |
uint32 | getYGridBorder () |
get the polygon used by this shape, in the object space | |
void | setGridBorderSize (uint32 x, uint32 y) |
set the size of borders. This is needed when water move is high, to avoid hole on the border of the screen | |
void | setScreenGridSize (uint32 x, uint32 y) |
set the resolution for the grid that is used for tesselation | |
Public Member Functions | |
virtual bool | clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix) |
inherited from IShape | |
virtual CTransformShape * | createInstance (CScene &scene) |
inherited from IShape | |
virtual void | flushTextures (IDriver &driver, uint selectedTexture) |
inherited from ishape | |
virtual void | getAABBox (NLMISC::CAABBox &bbox) const |
inherited from IShape | |
virtual std::string | getClassName ()=0 |
float | getDistMax () const |
virtual float | getNumTriangles (float distance) |
inherited from ishape | |
const sint & | getRefCount () const |
NLMISC_DECLARE_CLASS (CWaterShape) | |
virtual void | profileSceneRender (CRenderTrav *rdrTrav, CTransformShape *trans, bool opaquePass) |
virtual void | render (IDriver *drv, CTransformShape *trans, bool opaquePass) |
inherited from IShape. Does nothing. A new traverseRender() was set for that | |
void | setDistMax (float distMax) |
Object | |
CWaterShape () | |
ctor | |
void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
serial this shape | |
~CWaterShape () | |
dtor | |
Texture setup | |
const ITexture * | getColorMap () const |
ITexture * | getColorMap () |
void | getColorMapMat (NLMISC::CVector2f &column0, NLMISC::CVector2f &column1, NLMISC::CVector2f &pos) |
const ITexture * | getEnvMap (uint index) const |
ITexture * | getEnvMap (uint index) |
const ITexture * | getHeightMap (uint k) const |
ITexture * | getHeightMap (uint k) |
NLMISC::CVector2f | getHeightMapScale (uint k) const |
NLMISC::CVector2f | getHeightMapSpeed (uint k) const |
void | setColorMap (ITexture *map) |
void | setColorMapMat (const NLMISC::CVector2f &column0, const NLMISC::CVector2f &column1, const NLMISC::CVector2f &pos) |
void | setEnvMap (uint index, ITexture *envMap) |
void | setHeightMap (uint k, ITexture *hm) |
void | setHeightMapScale (uint k, const NLMISC::CVector2f &scale) |
void | setHeightMapSpeed (uint k, const NLMISC::CVector2f &speed) |
access default tracks. | |
CTrackDefaultVector * | getDefaultPos () |
CTrackDefaultQuat * | getDefaultRotQuat () |
CTrackDefaultVector * | getDefaultScale () |
LOD | |
float | getTransitionRatio () const |
void | setTransitionRatio (float percent) |
Data Fields | |
sint | crefs |
CPtrInfo * | pinfo |
Static Public Attributes | |
CPtrInfo | NullPtrInfo |
Protected Attributes | |
float | _DistMax |
Default to -1. | |
Friends | |
struct | CPtrInfo |
|
ctor
Definition at line 221 of file water_shape.cpp. References _HeightMapScale, _HeightMapSpeed, _HeightMapTouch, NLMISC::CVector2f::set(), NL3D::CTrackDefaultBlendable< CQuat >::setValue(), NL3D::CTrackDefaultBlendable< CVector >::setValue(), and sint.
00221 : _WaterPoolID(0), _TransitionRatio(0.6f), _WaveHeightFactor(3), _ComputeLightmap(false) 00222 { 00223 _DefaultPos.setValue(NLMISC::CVector::Null); 00224 _DefaultScale.setValue(NLMISC::CVector(1, 1, 1)); 00225 _DefaultRotQuat.setValue(CQuat::Identity); 00226 00227 for (sint k = 0; k < 2; ++k) 00228 { 00229 _HeightMapScale[k].set(1, 1); 00230 _HeightMapSpeed[k].set(0, 0); 00231 _HeightMapTouch[k] = true; 00232 } 00233 _ColorMapMatColumn0.set(1, 0); 00234 _ColorMapMatColumn1.set(0, 1); 00235 _ColorMapMatPos.set(0, 0); 00236 } |
|
dtor
Definition at line 240 of file water_shape.cpp. References _EnvMap, NL3D::GetWaterPoolManager(), and NL3D::CWaterPoolManager::unRegisterWaterShape().
00241 { 00242 if ( 00243 (_EnvMap[0] && dynamic_cast<CTextureBlend *>((ITexture *) _EnvMap[0])) 00244 || (_EnvMap[1] && dynamic_cast<CTextureBlend *>((ITexture *) _EnvMap[1])) 00245 ) 00246 { 00247 GetWaterPoolManager().unRegisterWaterShape(this); 00248 } 00249 } |
|
inherited from IShape
Reimplemented from NL3D::IShape. Definition at line 507 of file water_shape.cpp. References NLMISC::CAABBox::clipBack(), and uint.
|
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 410 of file water_shape.cpp. References min, nlassert, NLMISC::CAABBox::setMinMax(), uint, and NLMISC::CPolygon2D::Vertices. Referenced by setShape().
00411 { 00412 nlassert(_Poly.Vertices.size() != 0); 00413 NLMISC::CVector2f min, max; 00414 min = max = _Poly.Vertices[0]; 00415 for (uint k = 1; k < _Poly.Vertices.size(); ++k) 00416 { 00417 min.minof(min, _Poly.Vertices[k]); 00418 max.maxof(max, _Poly.Vertices[k]); 00419 } 00420 _BBox.setMinMax(CVector(min.x, min.y, 0), CVector(max.x, max.y, 0)); 00421 /* nlinfo("center x = %f, y = %f, z = %f", _BBox.getCenter().x, _BBox.getCenter().y, _BBox.getCenter().z); 00422 nlinfo("halsize x = %f, y = %f, z = %f", _BBox.getHalfSize().x, _BBox.getHalfSize().y, _BBox.getHalfSize().z); */ 00423 } |
|
inherited from IShape
Reimplemented from NL3D::IShape. Definition at line 327 of file water_shape.cpp. References NL3D::CAnimatedValueQuat, NL3D::CAnimatedValueVector, NL3D::CScene::createModel(), NL3D::ITransformable::getMatrix(), getShape(), NL3D::CTrackDefaultBlendable< CQuat >::getValue(), NL3D::CTrackDefaultBlendable< CVector >::getValue(), NL3D::CScene::getWaterCallback(), NL3D::CWaterModel::init(), NL3D::CTransformShape::Shape, NL3D::WaterModelClassId, and NL3D::IWaterSurfaceAddedCallback::waterSurfaceAdded().
00328 { 00329 CWaterModel *wm = NLMISC::safe_cast<CWaterModel *>(scene.createModel(WaterModelClassId) ); 00330 wm->Shape = this; 00331 // set default pos & scale 00332 wm->ITransformable::setPos( ((CAnimatedValueVector&)_DefaultPos.getValue()).Value ); 00333 wm->ITransformable::setScale( ((CAnimatedValueVector&)_DefaultScale.getValue()).Value ); 00334 wm->ITransformable::setRotQuat( ((CAnimatedValueQuat&)_DefaultRotQuat.getValue()).Value ); 00335 // 00336 wm->init(); 00337 if (scene.getWaterCallback()) 00338 { 00339 scene.getWaterCallback()->waterSurfaceAdded(getShape(), wm->getMatrix()); 00340 } 00341 return wm; 00342 } |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 196 of file water_shape.h. References _ComputeLightmap.
00196 { _ComputeLightmap = enable; } |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 568 of file water_shape.cpp. References _EnvMap, NL3D::GetWaterPoolManager(), NL3D::CWaterPoolManager::isWaterShapeObserver(), NL3D::CWaterPoolManager::registerWaterShape(), and NL3D::CWaterPoolManager::unRegisterWaterShape(). Referenced by NL3D::CWaterModel::setupMaterialNVertexShader().
00569 { 00570 // if the color map is a blend texture, we MUST be registered to the water pool manager, so that, the 00571 // setBlend message will be routed to this texture. 00572 if ( 00573 (_EnvMap[0] && dynamic_cast<CTextureBlend *>((ITexture *) _EnvMap[0])) 00574 || (_EnvMap[1] && dynamic_cast<CTextureBlend *>((ITexture *) _EnvMap[1])) 00575 ) 00576 { 00577 if (!GetWaterPoolManager().isWaterShapeObserver(this)) 00578 { 00579 GetWaterPoolManager().registerWaterShape(this); 00580 } 00581 } 00582 else 00583 { 00584 if (GetWaterPoolManager().isWaterShapeObserver(this)) 00585 { 00586 GetWaterPoolManager().unRegisterWaterShape(this); 00587 } 00588 } 00589 } |
|
inherited from ishape
Implements NL3D::IShape. Definition at line 354 of file water_shape.cpp. References uint.
00355 { 00356 // Test if bump maps are supported by driver before to flush them. 00357 // TEMP : can't flush texture for water, because the upload format depends on the shader 00358 // Only the driver can determine it. 00359 // BumpMaps may be uploaded with unsigned or signed format 00360 00361 /* 00362 if ( 00363 (driver.supportTextureShaders() && driver.isTextureAddrModeSupported(CMaterial::OffsetTexture)) 00364 || driver.supportEMBM() 00365 ) 00366 { 00367 for (uint k = 0; k < 2; ++k) 00368 { 00369 if (_BumpMap[k] != NULL) 00370 driver.setupTexture(*_BumpMap[k]); 00371 if (_EnvMap[k] != NULL) 00372 driver.setupTexture(*_EnvMap[k]); 00373 } 00374 } 00375 if (_ColorMap != NULL) 00376 driver.setupTexture(*_ColorMap); 00377 */ 00378 } |
|
inherited from IShape
Reimplemented from NL3D::IShape. Definition at line 108 of file water_shape.h.
00108 { bbox = _BBox; } |
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
Definition at line 173 of file water_shape.h. References _ColorMap.
00173 { return _ColorMap; } |
|
Definition at line 172 of file water_shape.h. References _ColorMap. Referenced by NL3D::CZoneLighter::isLightableShape(), NL3D::CZoneLighter::lightWater(), and NL3D::CWaterModel::setupMaterialNVertexShader().
00172 { return _ColorMap; } |
|
Definition at line 559 of file water_shape.cpp. Referenced by NL3D::CZoneLighter::lightWater().
00560 { 00561 column0 = _ColorMapMatColumn0; 00562 column1 = _ColorMapMatColumn1; 00563 pos = _ColorMapMatPos; 00564 } |
|
Definition at line 187 of file water_shape.h. Referenced by NL3D::CWaterModel::getDefaultTrack().
00187 {return &_DefaultPos;} |
|
Definition at line 189 of file water_shape.h. Referenced by NL3D::CWaterModel::getDefaultTrack().
00189 {return &_DefaultRotQuat;} |
|
Definition at line 188 of file water_shape.h. Referenced by NL3D::CWaterModel::getDefaultTrack().
00188 {return &_DefaultScale;} |
|
return the DistMax where the shape is no more displayed. Default is to return -1, meaning DistMax = infinite. Definition at line 112 of file shape.h.
00112 {return _DistMax;} |
|
Definition at line 155 of file water_shape.h. References _EnvMap, index, nlassert, and uint.
|
|
Definition at line 154 of file water_shape.h. References _EnvMap, index, nlassert, and uint.
|
|
Definition at line 449 of file water_shape.cpp. References _BumpMap, nlassert, and uint.
|
|
Definition at line 441 of file water_shape.cpp. References _BumpMap, nlassert, and uint.
|
|
Definition at line 526 of file water_shape.cpp. References _HeightMapScale, nlassert, and uint.
00527 { 00528 nlassert(k < 2); 00529 return _HeightMapScale[k]; 00530 } |
|
Definition at line 542 of file water_shape.cpp. References _HeightMapSpeed, nlassert, and uint.
00543 { 00544 nlassert(k < 2); 00545 return _HeightMapSpeed[k]; 00546 } |
|
inherited from ishape
Implements NL3D::IShape. Definition at line 346 of file water_shape.cpp.
00347 { 00348 // TODO 00349 return 0; 00350 } |
|
Definition at line 70 of file smart_ptr.h. References NLMISC::CRefCount::crefs, and sint.
00071 { 00072 return crefs; 00073 } |
|
get the polygon used by this shape, in the object space
Definition at line 126 of file water_shape.h. References _XScreenGridSize, and uint32.
00126 { return _XScreenGridSize; } |
|
get the polygon used by this shape, in the object space
Definition at line 127 of file water_shape.h. References _YScreenGridSize, and uint32.
00127 { return _YScreenGridSize; } |
|
get the polygon used by this shape, in the object space
Definition at line 136 of file water_shape.h. Referenced by createInstance().
00136 { return _Poly; } |
|
get the polygon this shape, in world space
Definition at line 609 of file water_shape.cpp. References NL3D::CAnimatedValueQuat, NL3D::CAnimatedValueVector, NL3D::CTrackDefaultBlendable< CQuat >::getValue(), NL3D::CTrackDefaultBlendable< CVector >::getValue(), NLMISC::CMatrix::identity(), NLMISC::CMatrix::rotate(), NLMISC::CMatrix::scale(), NLMISC::CMatrix::translate(), uint, NLMISC::CPolygon2D::Vertices, and NLMISC::CPolygon::Vertices. Referenced by NL3D::CZoneLighter::lightWater().
00610 { 00611 poly.Vertices.resize(_Poly.Vertices.size()); 00612 // compute the matrix of the object in world space, by using the default tracks 00613 NLMISC::CMatrix objMat; 00614 objMat.identity(); 00615 objMat.translate(((CAnimatedValueVector *) &_DefaultPos.getValue())->Value); 00616 objMat.rotate(((CAnimatedValueQuat *) &_DefaultRotQuat.getValue())->Value); 00617 objMat.scale(((CAnimatedValueVector *) &_DefaultScale.getValue())->Value); 00618 00619 for (uint k = 0; k < _Poly.Vertices.size(); ++k) 00620 { 00621 poly.Vertices[k] = objMat * NLMISC::CVector(_Poly.Vertices[k].x, _Poly.Vertices[k].y, 0); 00622 } 00623 } |
|
Definition at line 182 of file water_shape.h. References _TransitionRatio.
00182 { return _TransitionRatio; } |
|
get the polygon used by this shape, in the object space
Definition at line 121 of file water_shape.h. References _WaterPoolID, and uint32.
00121 { return _WaterPoolID; } |
|
Get the factor that is applied to waves height when they are displayed. default is 1.
Definition at line 145 of file water_shape.h. References _WaveHeightFactor.
00145 { return _WaveHeightFactor; } |
|
get the polygon used by this shape, in the object space
Definition at line 128 of file water_shape.h. References _XGridBorder, and uint32.
00128 { return _XGridBorder; } |
|
get the polygon used by this shape, in the object space
Definition at line 129 of file water_shape.h. References _YGridBorder, and uint32.
00129 { return _YGridBorder; } |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 253 of file water_shape.cpp. References _VertexProgramBump1, _VertexProgramBump1Diffuse, _VertexProgramBump2, _VertexProgramBump2Diffuse, _VertexProgramNoBump, _VertexProgramNoBumpDiffuse, and NL3D::BuildWaterVP(). Referenced by NL3D::CWaterModel::setupMaterialNVertexShader().
00254 { 00255 static bool created = false; 00256 if (!created) 00257 { 00258 00259 _VertexProgramBump1 = std::auto_ptr<CVertexProgram>(BuildWaterVP(false, true, false)); 00260 _VertexProgramBump2 = std::auto_ptr<CVertexProgram>(BuildWaterVP(false, true, true)); 00261 00262 _VertexProgramBump1Diffuse = std::auto_ptr<CVertexProgram>(BuildWaterVP(true, true, false)); 00263 _VertexProgramBump2Diffuse = std::auto_ptr<CVertexProgram>(BuildWaterVP(true, true, true)); 00264 00265 _VertexProgramNoBump = std::auto_ptr<CVertexProgram>(BuildWaterVP(false, false, false)); 00266 _VertexProgramNoBumpDiffuse = std::auto_ptr<CVertexProgram>(BuildWaterVP(true, false, false)); 00267 created = true; 00268 } 00269 } |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 197 of file water_shape.h. References _ComputeLightmap. Referenced by NL3D::CZoneLighter::isLightableShape().
00197 { return _ComputeLightmap; } |
|
|
|
Profiling. Called in RenderPass if Current Frame profiled. No-Op by default Informations must be added in rdrTrav->Scene Reimplemented in NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod. Definition at line 123 of file shape.h.
00123 {} |
|
inherited from IShape. Does nothing. A new traverseRender() was set for that
Implements NL3D::IShape. Definition at line 105 of file water_shape.h.
00105 {} |
|
serial this shape
Implements NLMISC::IStreamable. Definition at line 457 of file water_shape.cpp. References sint.
00458 { 00459 sint ver = f.serialVersion(2); 00460 // serial 'shape' 00461 f.serial(_Poly); 00462 // serial heightMap identifier 00463 f.serial(_WaterPoolID); 00464 //serial maps 00465 ITexture *map = NULL; 00466 if (f.isReading()) 00467 { 00468 f.serialPolyPtr(map); _EnvMap[0] = map; 00469 f.serialPolyPtr(map); _EnvMap[1] = map; 00470 f.serialPolyPtr(map); _BumpMap[0] = map; 00471 f.serialPolyPtr(map); _BumpMap[1] = map; 00472 f.serialPolyPtr(map); _ColorMap = map; 00473 computeBBox(); 00474 } 00475 else 00476 { 00477 map = _EnvMap[0]; f.serialPolyPtr(map); 00478 map = _EnvMap[1]; f.serialPolyPtr(map); 00479 map = _BumpMap[0]; f.serialPolyPtr(map); 00480 map = _BumpMap[1]; f.serialPolyPtr(map); 00481 map = _ColorMap; f.serialPolyPtr(map); 00482 } 00483 00484 f.serial(_HeightMapScale[0], _HeightMapScale[1], 00485 _HeightMapSpeed[0], _HeightMapSpeed[1]); 00486 00487 f.serial(_ColorMapMatColumn0, _ColorMapMatColumn1, _ColorMapMatPos); 00488 00489 // serial default tracks 00490 f.serial(_DefaultPos); 00491 f.serial(_DefaultScale); 00492 f.serial(_DefaultRotQuat); 00493 00494 f.serial(_TransitionRatio); 00495 00496 f.serial(_WaveHeightFactor); 00497 00498 if (ver >= 1) 00499 f.serial (_ComputeLightmap); 00500 00501 if (ver >= 2) 00502 f.serial (_DistMax); 00503 } |
|
Definition at line 593 of file water_shape.cpp. References _ColorMap.
00594 { 00595 _ColorMap = map; 00596 //colorMapUpdate(); 00597 } |
|
Definition at line 550 of file water_shape.cpp.
00551 { 00552 _ColorMapMatColumn0 = column0; 00553 _ColorMapMatColumn1 = column1; 00554 _ColorMapMatPos = pos; 00555 } |
|
setup the DistMax where the shape is no more displayed. Take effect only for the next created instances. setting <0 means -1 and so means DistMax = infinite. Definition at line 66 of file shape.cpp. Referenced by NL3D::CFlareShape::CFlareShape().
|
|
Definition at line 601 of file water_shape.cpp. References _EnvMap, index, nlassert, and uint.
|
|
set the size of borders. This is needed when water move is high, to avoid hole on the border of the screen
Definition at line 392 of file water_shape.cpp. References _GridSizeTouched, _XGridBorder, _YGridBorder, uint32, x, and y.
00393 { 00394 _XGridBorder = x; 00395 _YGridBorder = y; 00396 _GridSizeTouched = true; 00397 } |
|
Set a height map, used to generate a bumpmap (useful if supported by hardware...) NB : not to be confused with the height map used to modify the geometry, it only modify texture Definition at line 427 of file water_shape.cpp. References _BumpMap, _HeightMapTouch, nlassert, and uint.
00428 { 00429 nlassert(k < 2); 00430 if (!_BumpMap[k]) 00431 { 00432 _BumpMap[k] = new CTextureBump; 00433 } 00434 static_cast<CTextureBump *>( (ITexture *) _BumpMap[k])->forceNormalize(true); 00435 static_cast<CTextureBump *>( (ITexture *) _BumpMap[k])->setHeightMap(hm); 00436 _HeightMapTouch[k] = true; // must recompute normalization factor 00437 } |
|
Definition at line 518 of file water_shape.cpp. References _HeightMapScale, nlassert, and uint.
00519 { 00520 nlassert(k < 2); 00521 _HeightMapScale[k] = scale; 00522 } |
|
Definition at line 534 of file water_shape.cpp. References _HeightMapSpeed, nlassert, and uint.
00535 { 00536 nlassert(k < 2); 00537 _HeightMapSpeed[k] = speed; 00538 } |
|
set the resolution for the grid that is used for tesselation
Definition at line 382 of file water_shape.cpp. References _GridSizeTouched, _XScreenGridSize, _YScreenGridSize, nlassert, uint32, x, and y.
00383 { 00384 nlassert(x > 0 && y > 0); 00385 _XScreenGridSize = x; 00386 _YScreenGridSize = y; 00387 _GridSizeTouched = true; 00388 } |
|
get the polygon used by this shape, in the object space
Definition at line 401 of file water_shape.cpp. References computeBBox(), nlassert, and NLMISC::CPolygon2D::Vertices.
00402 { 00403 nlassert(poly.Vertices.size() != 0); // empty poly not allowed 00404 _Poly = poly; 00405 computeBBox(); 00406 } |
|
Definition at line 181 of file water_shape.h. References _TransitionRatio.
00181 { _TransitionRatio = percent; } |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 274 of file water_shape.cpp. References _GridSizeTouched, _IBDownUp, _IBUpDown, _MaxGridSize, _XGridBorder, _XScreenGridSize, _YScreenGridSize, NL3D::CVertexBuffer::addValueEx(), NL3D::CVertexBuffer::clearValueEx(), NL3D::CVertexBuffer::initEx(), NL3D::CVertexBuffer::setNumVertices(), uint, w, NL3D::WATER_VB_DX, NL3D::WATER_VB_POS, and x. Referenced by NL3D::CWaterModel::traverseRender().
00275 { 00276 const uint rotLength = (uint) ::ceilf(::sqrtf((float) ((_XScreenGridSize >> 1) * (_XScreenGridSize >> 1) 00277 + (_YScreenGridSize >> 1) * (_YScreenGridSize >> 1)))); 00278 _MaxGridSize = 2 * rotLength; 00279 const uint w = _MaxGridSize + 2 * _XGridBorder; 00280 00281 _VB.clearValueEx(); 00282 _VB.addValueEx (WATER_VB_POS, CVertexBuffer::Float3); 00283 _VB.addValueEx (WATER_VB_DX, CVertexBuffer::Float2); 00284 00285 _VB.initEx(); 00286 _VB.setNumVertices((w + 1) * 2); 00287 00288 00289 00290 uint x; 00291 00292 // setup each index buffer 00293 // We need 2 vb, because, each time 2 lines of the vertex buffer are filled, we start at the beginning again 00294 // So we need 1 vb for triangle drawn up to down, and one other for triangle drawn down to top 00295 00296 _IBUpDown.resize(6 * w); 00297 for (x = 0; x < w; ++x) 00298 { 00299 _IBUpDown [ 6 * x ] = x; 00300 _IBUpDown [ 6 * x + 1 ] = x + 1 + (w + 1); 00301 _IBUpDown [ 6 * x + 2 ] = x + 1; 00302 00303 _IBUpDown [ 6 * x + 3 ] = x; 00304 _IBUpDown [ 6 * x + 4 ] = x + 1 + (w + 1); 00305 _IBUpDown [ 6 * x + 5 ] = x + (w + 1); 00306 00307 } 00308 00309 _IBDownUp.resize(6 * w); 00310 for (x = 0; x < w; ++x) 00311 { 00312 _IBDownUp [ 6 * x ] = x; 00313 _IBDownUp [ 6 * x + 1 ] = x + 1; 00314 _IBDownUp [ 6 * x + 2 ] = x + 1 + (w + 1); 00315 00316 _IBDownUp [ 6 * x + 3 ] = x; 00317 _IBDownUp [ 6 * x + 4 ] = x + (w + 1); 00318 _IBDownUp [ 6 * x + 5 ] = x + 1 + (w + 1); 00319 00320 } 00321 00322 _GridSizeTouched = false; 00323 } |
|
all water shape that have the same weter id will share the same height map for wave propagations
Definition at line 120 of file water_shape.h. References _WaterPoolID, and uint32.
00120 { _WaterPoolID = id; } |
|
Set a factor that is applied to waves height when they are displayed. default is 1.
Definition at line 142 of file water_shape.h. References _WaveHeightFactor.
00142 { _WaveHeightFactor = f; } |
|
return !NULL if this shape can support MeshBlock rendering for a special instance. NB: Mesh Block render cannot occurs if the Mesh is Skinned/MeshMorphed. NB: Mesh Block render can occurs only in Opaque pass NB: Mesh block render can occurs only for CMeshBase meshes.
Reimplemented in NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod. Definition at line 158 of file shape.h.
00158 {return NULL;}
|
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 627 of file water_shape.cpp. References _BumpMap, _HeightMapNormalizationFactor, _HeightMapTouch, and uint.
00628 { 00629 for (uint k = 0; k < 2; ++k) 00630 { 00631 if (_HeightMapTouch[k]) 00632 { 00633 if (_BumpMap[k] != NULL) 00634 { 00635 _BumpMap[k]->generate(); 00636 _HeightMapNormalizationFactor[k] = NLMISC::safe_cast<CTextureBump *>((ITexture *)_BumpMap[k])->getNormalizationFactor(); 00637 if (_BumpMap[k]->getReleasable()) 00638 { 00639 _BumpMap[k]->release(); 00640 } 00641 } 00642 else 00643 { 00644 _HeightMapNormalizationFactor[k] = 1.f; 00645 } 00646 _HeightMapTouch[k] = false; 00647 } 00648 } 00649 } |
|
tells if the shape wants LocalAttenuation for RealTime lighting. Default is false Reimplemented in NL3D::CMeshBase. Definition at line 142 of file shape.h.
00142 {return false;} |
|
Definition at line 67 of file smart_ptr.h. |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 200 of file water_shape.h. |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 207 of file water_shape.h. |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 211 of file water_shape.h. Referenced by NL3D::CWaterModel::doSimpleRender(), getHeightMap(), setHeightMap(), NL3D::CWaterModel::setupMaterialNVertexShader(), and updateHeightMapNormalizationFactors(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 212 of file water_shape.h. Referenced by NL3D::CWaterModel::doSimpleRender(), getColorMap(), setColorMap(), and NL3D::CWaterModel::setupMaterialNVertexShader(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 216 of file water_shape.h. Referenced by NL3D::CWaterModel::doSimpleRender(), and NL3D::CWaterModel::updateDiffuseMapMatrix(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 216 of file water_shape.h. Referenced by NL3D::CWaterModel::doSimpleRender(), and NL3D::CWaterModel::updateDiffuseMapMatrix(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 216 of file water_shape.h. Referenced by NL3D::CWaterModel::doSimpleRender(), and NL3D::CWaterModel::updateDiffuseMapMatrix(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 223 of file water_shape.h. Referenced by enableLightMapping(), and isLightMappingEnabled(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 218 of file water_shape.h. |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 220 of file water_shape.h. |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 219 of file water_shape.h. |
|
Default to -1.
|
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 210 of file water_shape.h. Referenced by NL3D::CWaterModel::doSimpleRender(), envMapUpdate(), getEnvMap(), setEnvMap(), NL3D::CWaterModel::setupMaterialNVertexShader(), and ~CWaterShape(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 180 of file water_shape.cpp. Referenced by setGridBorderSize(), setScreenGridSize(), setupVertexBuffer(), and NL3D::CWaterModel::traverseRender(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 225 of file water_shape.h. Referenced by updateHeightMapNormalizationFactors(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 214 of file water_shape.h. Referenced by CWaterShape(), NL3D::CWaterModel::doSimpleRender(), getHeightMapScale(), setHeightMapScale(), and NL3D::CWaterModel::setupMaterialNVertexShader(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 215 of file water_shape.h. Referenced by CWaterShape(), NL3D::CWaterModel::doSimpleRender(), getHeightMapSpeed(), setHeightMapSpeed(), and NL3D::CWaterModel::setupMaterialNVertexShader(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 224 of file water_shape.h. Referenced by CWaterShape(), setHeightMap(), and updateHeightMapNormalizationFactors(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 178 of file water_shape.cpp. Referenced by setupVertexBuffer(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 177 of file water_shape.cpp. Referenced by setupVertexBuffer(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 175 of file water_shape.cpp. Referenced by setupVertexBuffer(), and NL3D::CWaterModel::traverseRender(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 208 of file water_shape.h. Referenced by NL3D::CWaterModel::computeClippedPoly(), NL3D::CWaterModel::computeSimpleClippedPoly(), and NL3D::CWaterModel::doSimpleRender(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 221 of file water_shape.h. Referenced by NL3D::CWaterModel::computeClippedPoly(), getTransitionRatio(), setTransitionRatio(), and NL3D::CWaterModel::traverseRender(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 176 of file water_shape.cpp. Referenced by NL3D::CWaterModel::traverseRender(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 181 of file water_shape.cpp. Referenced by initVertexProgram(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 183 of file water_shape.cpp. Referenced by initVertexProgram(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 182 of file water_shape.cpp. Referenced by initVertexProgram(), and NL3D::CWaterModel::setupMaterialNVertexShader(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 184 of file water_shape.cpp. Referenced by initVertexProgram(), and NL3D::CWaterModel::setupMaterialNVertexShader(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 185 of file water_shape.cpp. Referenced by initVertexProgram(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 186 of file water_shape.cpp. Referenced by initVertexProgram(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 209 of file water_shape.h. Referenced by NL3D::CWaterModel::getAttenuatedHeight(), NL3D::CWaterModel::getHeight(), NL3D::CWaterModel::getWaterHeightMapID(), getWaterPoolID(), setWaterPoolID(), and NL3D::CWaterModel::traverseRender(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 222 of file water_shape.h. Referenced by NL3D::CWaterModel::getAttenuatedHeight(), NL3D::CWaterModel::getHeight(), NL3D::CWaterModel::getHeightFactor(), getWaveHeightFactor(), NL3D::CWaterModel::setupMaterialNVertexShader(), and setWaveHeightFactor(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 173 of file water_shape.cpp. Referenced by getXGridBorder(), setGridBorderSize(), setupVertexBuffer(), and NL3D::CWaterModel::traverseRender(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 171 of file water_shape.cpp. Referenced by getScreenXGridSize(), setScreenGridSize(), and setupVertexBuffer(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 174 of file water_shape.cpp. Referenced by getYGridBorder(), and setGridBorderSize(). |
|
Tells this shape that it can replace its colormap by a lightmap during the zone lighting.
Definition at line 172 of file water_shape.cpp. Referenced by getScreenYGridSize(), setScreenGridSize(), and setupVertexBuffer(). |
|
Definition at line 79 of file smart_ptr.h. Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount(). |
|
Referenced by NLMISC::CRefCount::CRefCount(). |
|
Definition at line 80 of file smart_ptr.h. Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount(). |