本文整理汇总了C++中Matrix3::AsFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::AsFloat方法的具体用法?C++ Matrix3::AsFloat怎么用?C++ Matrix3::AsFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3
的用法示例。
在下文中一共展示了Matrix3::AsFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DALI_TEST_EQUALS
void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location)
{
const float* m1 = matrix1.AsFloat();
const float* m2 = matrix2.AsFloat();
bool equivalent = true;
for (int i=0;i<9;++i)
{
if( ! (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i])) )
{
equivalent = false;
}
}
if( !equivalent )
{
fprintf(stderr, "%s, checking\n"
"(%f, %f, %f) (%f, %f, %f)\n"
"(%f, %f, %f) == (%f, %f, %f)\n"
"(%f, %f, %f) (%f, %f, %f)\n",
location,
m1[0], m1[1], m1[2], m2[0], m2[1], m2[2],
m1[3], m1[4], m1[5], m2[3], m2[4], m2[5],
m1[6], m1[7], m1[8], m2[6], m2[7], m2[8]);
tet_result(TET_FAIL);
}
else
{
tet_result(TET_PASS);
}
}
示例2: DoRender
void MeshRenderer::DoRender( BufferIndex bufferIndex, const Matrix& modelViewMatrix, const Matrix& modelMatrix, const Matrix& viewMatrix, const Matrix& projectionMatrix, const Vector4& color )
{
MeshInfo& meshInfo = mMeshInfo[bufferIndex];
Mesh* mesh = meshInfo.mesh;
RenderMaterial& material = *(meshInfo.material);
BoneTransforms& boneTransforms = meshInfo.boneTransforms;
if( ! meshInfo.boneTransforms.transforms.empty() )
{
ApplyViewToBoneTransforms( meshInfo.boneTransforms, viewMatrix );
}
const int stride = sizeof(Dali::MeshData::Vertex);
Dali::MeshData::Vertex *v = 0;
mesh->UploadVertexData( *mContext, bufferIndex );
mesh->BindBuffers( *mContext );
GeometryType geometryType = GEOMETRY_TYPE_TEXTURED_MESH;
if( ! material.HasTexture() )
{
geometryType = GEOMETRY_TYPE_MESH;
}
GLsizei numBoneMatrices = (GLsizei)mesh->GetMeshData(Mesh::RENDER_THREAD).GetBoneCount();
// Select program type
ShaderSubTypes shaderType = SHADER_DEFAULT;
if( mShader->AreSubtypesRequired( geometryType ) )
{
if( numBoneMatrices )
{
if( mesh->GetMeshData(Mesh::RENDER_THREAD).HasColor() )
{
shaderType = SHADER_RIGGED_AND_VERTEX_COLOR;
}
else if( mAffectedByLighting )
{
shaderType = SHADER_RIGGED_AND_LIT;
}
else
{
shaderType = SHADER_RIGGED_AND_EVENLY_LIT;
}
}
else
{
if( mesh->GetMeshData(Mesh::RENDER_THREAD).HasColor() )
{
shaderType = SHADER_VERTEX_COLOR;
}
else if( ! mAffectedByLighting )
{
shaderType = SHADER_EVENLY_LIT;
} // else default
}
}
if( geometryType != mGeometryType || shaderType != mShaderType )
{
mGeometryType = geometryType;
mShaderType = shaderType;
ResetCustomUniforms();
}
Program& program = mShader->Apply( *mContext, bufferIndex, geometryType, modelMatrix, viewMatrix, modelViewMatrix, projectionMatrix, color, mShaderType );
GLint location = Program::UNIFORM_UNKNOWN;
GLint positionLoc = program.GetAttribLocation(Program::ATTRIB_POSITION);
GLint texCoordLoc = Program::ATTRIB_UNKNOWN;
GLint boneWeightsLoc = Program::ATTRIB_UNKNOWN;
GLint boneIndicesLoc = Program::ATTRIB_UNKNOWN;
GLint normalLoc = Program::ATTRIB_UNKNOWN;
GLint colorLoc = Program::ATTRIB_UNKNOWN;
mContext->VertexAttribPointer( positionLoc, 3, GL_FLOAT, GL_FALSE, stride, &v->x );
mContext->EnableVertexAttributeArray( positionLoc );
if( numBoneMatrices > 0 )
{
location = mCustomUniform[ shaderType ][ 0 ].GetUniformLocation( program, "uBoneCount" );
if( Program::UNIFORM_UNKNOWN != location )
{
program.SetUniform1i(location, numBoneMatrices);
}
location = mCustomUniform[ shaderType ][ 1 ].GetUniformLocation( program, "uBoneMatrices" );
if( Program::UNIFORM_UNKNOWN != location )
{
program.SetUniformMatrix4fv(location, numBoneMatrices, boneTransforms.viewTransforms[0].AsFloat());
}
if( mesh->GetMeshData(Mesh::RENDER_THREAD).HasNormals() )
{
location = mCustomUniform[ shaderType ][ 2 ].GetUniformLocation( program, "uBoneMatricesIT" );
if( Program::UNIFORM_UNKNOWN != location )
{
program.SetUniformMatrix3fv( location, numBoneMatrices, boneTransforms.inverseTransforms[0].AsFloat() );
}
}
//.........这里部分代码省略.........