本文整理汇总了C++中TerrainBlock::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ TerrainBlock::getPosition方法的具体用法?C++ TerrainBlock::getPosition怎么用?C++ TerrainBlock::getPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TerrainBlock
的用法示例。
在下文中一共展示了TerrainBlock::getPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderMissionArea
void EditTSCtrl::renderMissionArea()
{
MissionArea* obj = MissionArea::getServerObject();
if ( !obj )
return;
if ( !mRenderMissionArea && !obj->isSelected() )
return;
GFXDEBUGEVENT_SCOPE( Editor_renderMissionArea, ColorI::WHITE );
F32 minHeight = 0.0f;
F32 maxHeight = 0.0f;
TerrainBlock* terrain = getActiveTerrain();
if ( terrain )
{
terrain->getMinMaxHeight( &minHeight, &maxHeight );
Point3F pos = terrain->getPosition();
maxHeight += pos.z + mMissionAreaHeightAdjust;
minHeight += pos.z - mMissionAreaHeightAdjust;
}
const RectI& area = obj->getArea();
Box3F areaBox( area.point.x,
area.point.y,
minHeight,
area.point.x + area.extent.x,
area.point.y + area.extent.y,
maxHeight );
GFXDrawUtil* drawer = GFX->getDrawUtil();
GFXStateBlockDesc desc;
desc.setCullMode( GFXCullNone );
desc.setBlend( true );
desc.setZReadWrite( false, false );
desc.setFillModeSolid();
drawer->drawCube( desc, areaBox, mMissionAreaFillColor );
desc.setFillModeWireframe();
drawer->drawCube( desc, areaBox, mMissionAreaFrameColor );
}
示例2: getColorFromRayInfo
// Given a ray, this will return the color from the lightmap of this object, return true if handled
bool blTerrainSystem::getColorFromRayInfo(const RayInfo & collision, ColorF& result) const
{
TerrainBlock *terrain = dynamic_cast<TerrainBlock *>(collision.object);
if (!terrain)
return false;
Point2F uv;
F32 terrainlength = (F32)terrain->getBlockSize();
Point3F pos = terrain->getPosition();
uv.x = (collision.point.x - pos.x) / terrainlength;
uv.y = (collision.point.y - pos.y) / terrainlength;
// similar to x = x & width...
uv.x = uv.x - F32(U32(uv.x));
uv.y = uv.y - F32(U32(uv.y));
const GBitmap* lightmap = terrain->getLightMap();
if (!lightmap)
return false;
result = lightmap->sampleTexel(uv.x, uv.y);
// terrain lighting is dim - look into this (same thing done in shaders)...
result *= 2.0f;
return true;
}