////////////////////////////////////////////////////////////////////////// // renderSelectionHUD void GaGameUnit::renderSelectionHUD( ScnCanvasComponentRef Canvas, BcFixed TimeFraction, BcU32 TeamID ) { if( Behaviour_ != BEHAVIOUR_DEAD ) { BcU32 TextureIdx = Desc_.Type_; BcFixedVec2d GamePosition( getInterpolatedPosition( TimeFraction ) ); const BcReal ScaleFactor = 32.0f; BcVec2d Position( GamePosition.x(), GamePosition.y() ); BcVec2d Size( Desc_.Size_.x(), Desc_.Size_.y() ); Position *= ScaleFactor; Size *= ScaleFactor; BcVec2d PositionA( Position + ( BcVec2d( -Size.x(), -Size.y() ) * 0.45f ) ); BcVec2d PositionB( Position + ( BcVec2d( Size.x(), -Size.y() ) * 0.45f ) ); BcVec2d PositionC( Position + ( BcVec2d( Size.x(), Size.y() ) * 0.45f ) ); BcVec2d PositionD( Position + ( BcVec2d( -Size.x(), Size.y() ) * 0.45f ) ); BcVec2d SizeA( BcVec2d( 16.0f, 16.0f ) ); BcVec2d SizeB( BcVec2d( -16.0f, 16.0f ) ); BcVec2d SizeC( BcVec2d( -16.0f, -16.0f ) ); BcVec2d SizeD( BcVec2d( 16.0f, -16.0f ) ); // Draw selection marker. RsColour MarkerColour = TeamID == TeamID_ ? ( RsColour::WHITE ) : ( RsColour::RED ) * RsColour( 1.0f, 1.0f, 1.0f, 0.75f ); Canvas->drawSpriteCentered( PositionA, SizeA, 2, MarkerColour, 3 ); Canvas->drawSpriteCentered( PositionB, SizeB, 2, MarkerColour, 3 ); Canvas->drawSpriteCentered( PositionC, SizeC, 2, MarkerColour, 3 ); Canvas->drawSpriteCentered( PositionD, SizeD, 2, MarkerColour, 3 ); } }
int test_viewCube ( std::vector<gli::format> const & Formats, gli::textureCube::dim_type const & TextureSize ) { int Error(0); for(std::size_t i = 0; i < Formats.size(); ++i) { gli::textureCube TextureA(gli::textureCube::size_type(6), gli::levels(TextureSize), Formats[i], TextureSize); gli::textureCube TextureViewA(TextureA, TextureA.baseFace(), TextureA.maxFace(), TextureA.baseLevel(), TextureA.maxLevel()); Error += TextureA == TextureViewA ? 0 : 1; gli::textureCube::dim_type SizeB(TextureSize / gli::textureCube::dim_type(2)); gli::textureCube TextureB(gli::textureCube::size_type(6), gli::levels(SizeB), Formats[i], SizeB); gli::textureCube TextureViewB(TextureA, TextureA.baseFace(), TextureA.maxFace(), TextureA.baseLevel() + 1, TextureA.maxLevel()); Error += TextureB == TextureViewB ? 0 : 1; gli::textureCube TextureViewD = gli::view(TextureA, TextureA.baseFace(), TextureA.maxFace(), TextureA.baseLevel() + 1, TextureA.maxLevel()); Error += TextureViewD == TextureViewB ? 0 : 1; gli::textureCube TextureD(TextureA, 0, TextureA.faces() -1, 1, 3); Error += TextureA[0][1] == TextureD[0][0] ? 0 : 1; Error += TextureA[0][2] == TextureD[0][1] ? 0 : 1; gli::textureCube TextureE(TextureD, 0, TextureD.faces() -1, 0, TextureD.levels() - 1); Error += TextureE == TextureD ? 0 : 1; Error += TextureE[0] == TextureD[0] ? 0 : 1; gli::textureCube TextureF(TextureE, 1, 3, 0, TextureE.levels() - 1); Error += TextureF[0] == TextureD[1] ? 0 : 1; Error += TextureF[0] == TextureE[1] ? 0 : 1; } return Error; }
int test_view3D ( std::vector<gli::format> const & Formats, gli::texture3D::dim_type const & TextureSize ) { int Error(0); for(std::size_t i = 0; i < Formats.size(); ++i) { gli::texture3D TextureA(gli::levels(TextureSize), Formats[i], TextureSize); gli::texture3D TextureViewA(TextureA, TextureA.baseLevel(), TextureA.maxLevel()); Error += TextureA == TextureViewA ? 0 : 1; gli::texture3D::dim_type SizeB(TextureSize / gli::texture3D::dim_type(2)); gli::texture3D TextureB(gli::levels(SizeB), Formats[i], SizeB); gli::texture3D TextureViewB(TextureA, TextureA.baseLevel() + 1, TextureA.maxLevel()); Error += TextureB == TextureViewB ? 0 : 1; gli::texture3D TextureViewD = gli::view(TextureA, TextureA.baseLevel() + 1, TextureA.maxLevel()); Error += TextureViewD == TextureViewB ? 0 : 1; gli::texture3D TextureD(TextureA, 1, 3); Error += TextureA[1] == TextureD[0] ? 0 : 1; Error += TextureA[2] == TextureD[1] ? 0 : 1; gli::texture3D TextureE(TextureD, 1, 1); Error += TextureE[0] == TextureD[1] ? 0 : 1; Error += TextureE[0] == TextureA[2] ? 0 : 1; } return Error; }