当前位置: 首页>>代码示例>>C++>>正文


C++ FColor::ToRGBA32方法代码示例

本文整理汇总了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 );
}
开发者ID:S-V,项目名称:Lollipop,代码行数:33,代码来源:BatchRenderer.cpp

示例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 );
}
开发者ID:S-V,项目名称:Lollipop,代码行数:54,代码来源:BatchRenderer.cpp


注:本文中的FColor::ToRGBA32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。