本文整理汇总了C++中FColor::ToRGBA32方法的典型用法代码示例。如果您正苦于以下问题:C++ FColor::ToRGBA32方法的具体用法?C++ FColor::ToRGBA32怎么用?C++ FColor::ToRGBA32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FColor
的用法示例。
在下文中一共展示了FColor::ToRGBA32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void BatchRenderer::DrawSolidTriangle3D(
const Vec3D& a, const Vec3D& b, const Vec3D& c,
const FColor& color
)
{
const U4 rgbaColor = color.ToRGBA32();
SetBatchState( this, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
const UINT iBaseVertex = self->batchedVertices.Num();
Vertex & v0 = self->batchedVertices.Add();
Vertex & v1 = self->batchedVertices.Add();
Vertex & v2 = self->batchedVertices.Add();
v0.xyz.x = a.x;
v0.xyz.y = a.y;
v0.xyz.z = a.z;
v0.rgba.asU32 = rgbaColor;
v1.xyz.x = b.x;
v1.xyz.y = b.y;
v1.xyz.z = b.z;
v1.rgba.asU32 = rgbaColor;
v2.xyz.x = c.x;
v2.xyz.y = c.y;
v2.xyz.z = c.z;
v2.rgba.asU32 = rgbaColor;
self->batchedIndices.Add( iBaseVertex + 0 );
self->batchedIndices.Add( iBaseVertex + 1 );
self->batchedIndices.Add( iBaseVertex + 2 );
}
示例2: DrawSprite
void BatchRenderer::DrawSprite(
const Matrix4& cameraWorldMatrix,
const Vec3D& spriteOrigin,
const FLOAT spriteSizeX, const FLOAT spriteSizeY,
const FColor& color
)
{
const Vec3D spriteX = cameraWorldMatrix[0].ToVec3() * spriteSizeX;
const Vec3D spriteY = cameraWorldMatrix[1].ToVec3() * spriteSizeY;
const U4 rgbaColor = color.ToRGBA32();
SetBatchState( this, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
const UINT iBaseVertex = self->batchedVertices.Num();
Vertex & v0 = self->batchedVertices.Add();
Vertex & v1 = self->batchedVertices.Add();
Vertex & v2 = self->batchedVertices.Add();
Vertex & v3 = self->batchedVertices.Add();
v0.xyz = spriteOrigin - spriteX - spriteY; // bottom left
v0.uv.x = 0.0f;
v0.uv.y = 1.0f;
v0.rgba.asU32 = rgbaColor;
v1.xyz = spriteOrigin - spriteX + spriteY; // top left
v1.uv.x = 0.0f;
v1.uv.y = 0.0f;
v1.rgba.asU32 = rgbaColor;
v2.xyz = spriteOrigin + spriteX + spriteY; // top right
v2.uv.x = 1.0f;
v2.uv.y = 0.0f;
v2.rgba.asU32 = rgbaColor;
v3.xyz = spriteOrigin + spriteX - spriteY; // bottom right
v3.uv.x = 1.0f;
v3.uv.y = 1.0f;
v3.rgba.asU32 = rgbaColor;
// indices:
// 0, 1, 2,
// 0, 2, 3,
self->batchedIndices.Add( iBaseVertex + 0 );
self->batchedIndices.Add( iBaseVertex + 1 );
self->batchedIndices.Add( iBaseVertex + 2 );
self->batchedIndices.Add( iBaseVertex + 0 );
self->batchedIndices.Add( iBaseVertex + 2 );
self->batchedIndices.Add( iBaseVertex + 3 );
}