mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
ground plane zOffset feature
This commit is contained in:
parent
1ae043bc90
commit
3746093efd
2 changed files with 7 additions and 2 deletions
|
|
@ -65,7 +65,8 @@ ConsoleDocClass( GroundPlane,
|
||||||
);
|
);
|
||||||
|
|
||||||
GroundPlane::GroundPlane()
|
GroundPlane::GroundPlane()
|
||||||
: mSquareSize( 128.0f ),
|
: mZOffset (0.0f),
|
||||||
|
mSquareSize( 128.0f ),
|
||||||
mScaleU( 1.0f ),
|
mScaleU( 1.0f ),
|
||||||
mScaleV( 1.0f ),
|
mScaleV( 1.0f ),
|
||||||
mMaterial( NULL ),
|
mMaterial( NULL ),
|
||||||
|
|
@ -92,6 +93,7 @@ void GroundPlane::initPersistFields()
|
||||||
{
|
{
|
||||||
addGroup( "Plane" );
|
addGroup( "Plane" );
|
||||||
|
|
||||||
|
addField( "zOffset", TypeF32, Offset( mZOffset, GroundPlane ), "How high the ground plane should be" );
|
||||||
addField( "squareSize", TypeF32, Offset( mSquareSize, GroundPlane ), "Square size in meters to which %GroundPlane subdivides its geometry." );
|
addField( "squareSize", TypeF32, Offset( mSquareSize, GroundPlane ), "Square size in meters to which %GroundPlane subdivides its geometry." );
|
||||||
addField( "scaleU", TypeF32, Offset( mScaleU, GroundPlane ), "Scale of texture repeat in the U direction." );
|
addField( "scaleU", TypeF32, Offset( mScaleU, GroundPlane ), "Scale of texture repeat in the U direction." );
|
||||||
addField( "scaleV", TypeF32, Offset( mScaleV, GroundPlane ), "Scale of texture repeat in the V direction." );
|
addField( "scaleV", TypeF32, Offset( mScaleV, GroundPlane ), "Scale of texture repeat in the V direction." );
|
||||||
|
|
@ -176,6 +178,7 @@ U32 GroundPlane::packUpdate( NetConnection* connection, U32 mask, BitStream* str
|
||||||
{
|
{
|
||||||
U32 retMask = Parent::packUpdate( connection, mask, stream );
|
U32 retMask = Parent::packUpdate( connection, mask, stream );
|
||||||
|
|
||||||
|
stream->write( mZOffset );
|
||||||
stream->write( mSquareSize );
|
stream->write( mSquareSize );
|
||||||
stream->write( mScaleU );
|
stream->write( mScaleU );
|
||||||
stream->write( mScaleV );
|
stream->write( mScaleV );
|
||||||
|
|
@ -188,6 +191,7 @@ void GroundPlane::unpackUpdate( NetConnection* connection, BitStream* stream )
|
||||||
{
|
{
|
||||||
Parent::unpackUpdate( connection, stream );
|
Parent::unpackUpdate( connection, stream );
|
||||||
|
|
||||||
|
stream->read( &mZOffset );
|
||||||
stream->read( &mSquareSize );
|
stream->read( &mSquareSize );
|
||||||
stream->read( &mScaleU );
|
stream->read( &mScaleU );
|
||||||
stream->read( &mScaleV );
|
stream->read( &mScaleV );
|
||||||
|
|
@ -518,7 +522,7 @@ void GroundPlane::generateGrid( U32 width, U32 height, F32 squareSize,
|
||||||
{
|
{
|
||||||
vertices->point.x = x;
|
vertices->point.x = x;
|
||||||
vertices->point.y = y;
|
vertices->point.y = y;
|
||||||
vertices->point.z = 0.0;
|
vertices->point.z = ( mZOffset );
|
||||||
|
|
||||||
vertices->texCoord.x = ( x / squareSize ) * mScaleU;
|
vertices->texCoord.x = ( x / squareSize ) * mScaleU;
|
||||||
vertices->texCoord.y = ( y / squareSize ) * -mScaleV;
|
vertices->texCoord.y = ( y / squareSize ) * -mScaleV;
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ private:
|
||||||
typedef GFXVertexBufferHandle< VertexType > VertexBuffer;
|
typedef GFXVertexBufferHandle< VertexType > VertexBuffer;
|
||||||
typedef GFXPrimitiveBufferHandle PrimitiveBuffer;
|
typedef GFXPrimitiveBufferHandle PrimitiveBuffer;
|
||||||
|
|
||||||
|
F32 mZOffset; ///< How high or low the ground plane should be.
|
||||||
F32 mSquareSize; ///< World units per grid cell edge.
|
F32 mSquareSize; ///< World units per grid cell edge.
|
||||||
F32 mScaleU; ///< Scale factor for U texture coordinates.
|
F32 mScaleU; ///< Scale factor for U texture coordinates.
|
||||||
F32 mScaleV; ///< Scale factor for V texture coordinates.
|
F32 mScaleV; ///< Scale factor for V texture coordinates.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue