本文整理汇总了C++中MatrixF::transposeTo方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixF::transposeTo方法的具体用法?C++ MatrixF::transposeTo怎么用?C++ MatrixF::transposeTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixF
的用法示例。
在下文中一共展示了MatrixF::transposeTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssertFatal
void GFXD3D9ShaderConstBuffer::set(GFXShaderConstHandle* handle, const MatrixF& mat, const GFXShaderConstType matrixType)
{
AssertFatal(handle, "Handle is NULL!" );
AssertFatal(handle->isValid(), "Handle is not valid!" );
AssertFatal(dynamic_cast<const GFXD3D9ShaderConstHandle*>(handle), "Incorrect const buffer type!");
const GFXD3D9ShaderConstHandle* h = static_cast<const GFXD3D9ShaderConstHandle*>(handle);
AssertFatal(!h->isSampler(), "Handle is sampler constant!" );
AssertFatal(h->mShader == mShader, "Mismatched shaders!");
MatrixF transposed;
mat.transposeTo(transposed);
if (h->mInstancingConstant)
{
if ( matrixType == GFXSCT_Float4x4 )
dMemcpy( mInstPtr+h->mPixelHandle.offset, mat, sizeof( mat ) );
// TODO: Support 3x3 and 2x2 matricies?
return;
}
if (h->mVertexConstant)
mVertexConstBufferF->set(h->mVertexHandle, transposed, matrixType);
if (h->mPixelConstant)
mPixelConstBufferF->set(h->mPixelHandle, transposed, matrixType);
}
示例2: set
void GFXGLShaderConstBuffer::set(GFXShaderConstHandle* handle, const MatrixF& mat, const GFXShaderConstType matType)
{
AssertFatal(handle, "GFXGLShaderConstBuffer::set - Handle is NULL!" );
AssertFatal(handle->isValid(), "GFXGLShaderConstBuffer::set - Handle is not valid!" );
AssertFatal(dynamic_cast<GFXGLShaderConstHandle*>(handle), "GFXGLShaderConstBuffer::set - Incorrect const buffer type");
GFXGLShaderConstHandle* _glHandle = static_cast<GFXGLShaderConstHandle*>(handle);
AssertFatal(mShader == _glHandle->mShader, "GFXGLShaderConstBuffer::set - Should only set handles which are owned by our shader");
AssertFatal(!_glHandle->mInstancingConstant || matType == GFXSCT_Float4x4, "GFXGLShaderConstBuffer::set - Only support GFXSCT_Float4x4 for instancing");
switch(matType)
{
case GFXSCT_Float2x2:
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[0] = mat[0];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[1] = mat[1];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[2] = mat[4];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[3] = mat[5];
break;
case GFXSCT_Float3x3:
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[0] = mat[0];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[1] = mat[1];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[2] = mat[2];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[3] = mat[4];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[4] = mat[5];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[5] = mat[6];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[6] = mat[8];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[7] = mat[9];
reinterpret_cast<F32*>(mBuffer + _glHandle->mOffset)[8] = mat[10];
break;
case GFXSCT_Float4x4:
{
if(_glHandle->mInstancingConstant)
{
MatrixF transposed;
mat.transposeTo(transposed);
dMemcpy( mInstPtr + _glHandle->mOffset, (const F32*)transposed, sizeof(MatrixF) );
return;
}
dMemcpy(mBuffer + _glHandle->mOffset, (const F32*)mat, sizeof(MatrixF));
break;
}
default:
AssertFatal(false, "GFXGLShaderConstBuffer::set - Invalid matrix type");
break;
}
}
示例3:
void GFXPCD3D9Device::setMatrix( GFXMatrixType mtype, const MatrixF &mat )
{
mat.transposeTo( mTempMatrix );
mD3DDevice->SetTransform( (_D3DTRANSFORMSTATETYPE)mtype, (D3DMATRIX *)&mTempMatrix );
}