本文整理汇总了C++中U3DDataBlockWriter::writeF32Color方法的典型用法代码示例。如果您正苦于以下问题:C++ U3DDataBlockWriter::writeF32Color方法的具体用法?C++ U3DDataBlockWriter::writeF32Color怎么用?C++ U3DDataBlockWriter::writeF32Color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类U3DDataBlockWriter
的用法示例。
在下文中一共展示了U3DDataBlockWriter::writeF32Color方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
mlU3D::ColorMap U3DSave::_writeVertexColors(WEMPatch* patch, U3DDataBlockWriter& continuationBlock) const
{
MLuint thisColorIndex = 0;
mlU3D::ColorMap colorsMap; // <Color,ColorIndex>
const int numNodesInPatch = patch->getNumNodes();
for (int n = 0; n < numNodesInPatch; n++)
{
WEMNode* thisNode = patch->getNodeAt(n);
const Vector4 thisNodeColor = thisNode->getColor();
mlU3D::ColorMap::iterator findIt = colorsMap.find(thisNodeColor);
if (findIt == colorsMap.end())
{
// Color has not yet been added to map, so add it now
colorsMap[thisNodeColor] = thisColorIndex;
continuationBlock.writeF32Color(thisNodeColor);
thisColorIndex++;
}
else
{
// Do nothing
}
}
return colorsMap;
}
示例2: Name
U3DDataBlockWriter U3DSave::_createCLODBaseMeshContinuationBlock(WEMTrianglePatch* meshPatch, mlU3D::CLODMeshGenerator& meshGenerator) const
{
mlU3D::ColorMap baseDiffuseColorsMap;
float progressStart = 0.2f;
float progressEnd = 0.9f;
float progressRangeforAllMeshes = progressEnd - progressStart; // 0.7
float progressIntervalForOneWEMPatch = progressRangeforAllMeshes / _inU3DObject->meshes.size();
float progressStartForThisMesh = progressStart + progressIntervalForOneWEMPatch * meshGenerator.meshNumber;
_progressFld->setFloatValue(progressStartForThisMesh);
_statusFld->setStringValue("Assembling data for Mesh: " + meshGenerator.resourceName + ".");
U3DDataBlockWriter thisCLODBaseMeshContinuationBlock;
thisCLODBaseMeshContinuationBlock.blockType = mlU3D::BLOCKTYPE_CLODBASEMESHCONTINUATION;
thisCLODBaseMeshContinuationBlock.writeString(meshGenerator.resourceName); // Write Mesh Name (9.6.1.2.1)
thisCLODBaseMeshContinuationBlock.writeU32(mlU3D::ReservedZero); // Write Chain Index (9.6.1.2.2) (shall be zero)
thisCLODBaseMeshContinuationBlock.writeU32(meshGenerator.faceCount); // Write Base Mesh Description - Face Count (9.6.1.2.3.1) (# of faces)
thisCLODBaseMeshContinuationBlock.writeU32(meshGenerator.vertexCount); // Write Base Mesh Description - Position Count (9.6.1.2.3.2) (# of vertices)
thisCLODBaseMeshContinuationBlock.writeU32(meshGenerator.normalCount); // Write Base Mesh Description - Normal Count (9.6.1.2.3.3) (# of normals)
thisCLODBaseMeshContinuationBlock.writeU32(meshGenerator.diffuseColorCount); // Write Base Mesh Description - Diffuse Color Count (9.6.1.2.3.4)
thisCLODBaseMeshContinuationBlock.writeU32(meshGenerator.specularColorCount); // Write Base Mesh Description - Specular Color Count (9.6.1.2.3.5)
thisCLODBaseMeshContinuationBlock.writeU32(0x00000001); // Write Base Mesh Description - Texture Coord Count (9.6.1.2.3.6)
// Write all vertex positions (in U3D, vertices are called "positions")
for (MLuint32 thisVertex = 0; thisVertex < meshGenerator.vertexCount; thisVertex++)
{
Vector3 wemPosition = meshPatch->getNodeAt(thisVertex)->getPosition();
thisCLODBaseMeshContinuationBlock.writeF32(wemPosition[0]); // Write Base Position - X (9.6.1.2.4.1.1)
thisCLODBaseMeshContinuationBlock.writeF32(wemPosition[1]); // Write Base Position - Y (9.6.1.2.4.1.2)
thisCLODBaseMeshContinuationBlock.writeF32(wemPosition[2]); // Write Base Position - Z (9.6.1.2.4.1.3)
}
for (MLuint32 thisNormal = 0; thisNormal < meshGenerator.normalCount; thisNormal++)
{
Vector3 nodeNormal = meshPatch->getNodeAt(thisNormal)->getNormal();
thisCLODBaseMeshContinuationBlock.writeF32(nodeNormal[0]); // Write Base Normal - X (9.6.1.2.4.2.1)
thisCLODBaseMeshContinuationBlock.writeF32(nodeNormal[1]); // Write Base Normal - Y (9.6.1.2.4.2.2)
thisCLODBaseMeshContinuationBlock.writeF32(nodeNormal[2]); // Write Base Normal - Z (9.6.1.2.4.2.3)
}
if (meshGenerator.diffuseColorCount > 0)
{
baseDiffuseColorsMap = _writeVertexColors(meshPatch, thisCLODBaseMeshContinuationBlock); // Write all Base Diffuse Colors (9.6.1.2.4.3)
}
for (MLuint32 thisSpecularColor = 0; thisSpecularColor < meshGenerator.specularColorCount; thisSpecularColor++)
{
thisCLODBaseMeshContinuationBlock.writeF32Color(_inU3DObject->defaultValues.defaultMaterialSpecularColor, 1.0f); // Write Base Specular Color (9.6.1.2.4.4)
}
// Write Write Base Texture Coord (9.6.1.2.4.5)
thisCLODBaseMeshContinuationBlock.writeF32(0.0f); // Write Base Texture Coord U (9.6.1.2.4.5.1)
thisCLODBaseMeshContinuationBlock.writeF32(0.0f); // Write Base Texture Coord V (9.6.1.2.4.5.2)
thisCLODBaseMeshContinuationBlock.writeF32(0.0f); // Write Base Texture Coord S (9.6.1.2.4.5.3)
thisCLODBaseMeshContinuationBlock.writeF32(0.0f); // Write Base Texture Coord T (9.6.1.2.4.5.4)
for (MLuint32 thisFace = 0; thisFace < meshGenerator.faceCount; thisFace++)
{
thisCLODBaseMeshContinuationBlock.writeCompressedU32(mlU3D::Context_cShading, 0); // Write Shading ID (9.6.1.2.4.6.1)
WEMFace* wemFace = meshPatch->getFaceAt(thisFace);
for (MLuint thisNode = 0; thisNode < 3; thisNode++)
{
WEMNode* thisWEMNode = wemFace->getNodeAt(static_cast<unsigned int>(thisNode));
const MLuint32 VertexIndex = thisWEMNode->getEntryNumber();
const Vector4 thisWEMNodeColor = thisWEMNode->getColor();
MLuint32 NormalIndex = VertexIndex;
// Write Base Corner Info - Base Position Index (9.6.1.2.4.6.2.1)
thisCLODBaseMeshContinuationBlock.writeCompressedU32(mlU3D::Context_StaticFull + meshGenerator.vertexCount, VertexIndex);
// Write Base Corner Info - Base Normal Index (9.6.1.2.4.6.2.2)
if (meshGenerator.normalCount > 0)
{
thisCLODBaseMeshContinuationBlock.writeCompressedU32(mlU3D::Context_StaticFull + meshGenerator.normalCount, NormalIndex);
}
// Write Base Corner Info - Base Diffuse Color Index (9.6.1.2.4.6.2.3)
if (meshGenerator.diffuseColorCount > 0)
{
MLuint32 diffuseColorIndex = baseDiffuseColorsMap[thisWEMNodeColor];
thisCLODBaseMeshContinuationBlock.writeCompressedU32(mlU3D::Context_StaticFull + meshGenerator.diffuseColorCount, diffuseColorIndex);
}
// Write Base Corner Info - Base Specular Color Index (9.6.1.2.4.6.2.4)
if (meshGenerator.specularColorCount > 0)
{
thisCLODBaseMeshContinuationBlock.writeCompressedU32(mlU3D::Context_StaticFull + meshGenerator.specularColorCount, 0);
}
// Write Base Corner Info - Base Texture Coord Index (9.6.1.2.4.6.2.5)
//thisCLODBaseMeshContinuationBlock.writeCompressedU32(U3D_StaticFull+1, 0); // No texture layers
}
if (0 == (thisFace % 100)) // Set progress field every 100 faces to save GUI update cost
//.........这里部分代码省略.........