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


C++ Matrix4::Transpose方法代码示例

本文整理汇总了C++中Matrix4::Transpose方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4::Transpose方法的具体用法?C++ Matrix4::Transpose怎么用?C++ Matrix4::Transpose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix4的用法示例。


在下文中一共展示了Matrix4::Transpose方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Determinant

Matrix4 Matrix4::Inverse() const
{
	Matrix4 m;
	GLfloat det = Determinant();
	if(fabs(det) < 0.000001f) return(m);
	for(GLuint c=0; c<4; c++)
		for(GLuint r=0; r<4; r++)
			m.mat[c*4+r]=Cofactor(c, r)/det;
	return(m.Transpose());
}
开发者ID:0ctobyte,项目名称:opengl-render,代码行数:10,代码来源:Matrix4.cpp

示例2:

void NodeIntersector<real>::TransformIntersectionToGlobalCoordinates( const CoreLib::Node<real>* node, Intersection<real>& ioIntersection )
{
	// newPosition = M * position
	// newNormal = M^{-T} * normal
	const Matrix4<real>& localToGlobal = node->GetLocalToGlobal();
	Matrix4<real> localToGlobalForNormals = node->GetGlobalToLocal();
	localToGlobalForNormals.Transpose();

	ioIntersection.SetPosition( localToGlobal * ioIntersection.GetPosition() );
	ioIntersection.SetNormal( localToGlobalForNormals ^ ioIntersection.GetNormal() );
}
开发者ID:gnuvince,项目名称:ift3355-tp2,代码行数:11,代码来源:NodeIntersector.cpp

示例3: SetParameter

 void SpriteShader::SetParameter(const std::string &parameterName, const Matrix4 &value)
 {
     if(pimpl->uniforms.find(parameterName) == pimpl->uniforms.end())
         throw std::runtime_error("Couldn't find the named SpriteEffect parameter: " + parameterName);
     
     auto &uniformData = pimpl->uniforms[parameterName];
     
     if(uniformData.type != GL_FLOAT_MAT4)
         throw std::runtime_error("Type mismatch for named SpriteEffect paramater: " + parameterName);
     
     glUniformMatrix4fv(uniformData.location, 1, GL_FALSE, value.Transpose());
 }
开发者ID:ThirdPartyNinjas,项目名称:NinjaParty,代码行数:12,代码来源:SpriteShader.cpp

示例4: GetCameraRotationMatrix

Matrix4 Camera3D::GetCameraViewMatrix(){
	//get transform matrix
	Matrix4 cameraTransformMatrix;
	cameraTransformMatrix.Translate(m_position);
	cameraTransformMatrix.m_translation.x *= -1.0f; //stopgap fix for -zUP issue
	cameraTransformMatrix.m_translation.z *= -1.0f; //stopgap fix for -zUP issue
	
	Matrix4 viewMatrix = /* GetCameraRotationMatrix() * */ cameraTransformMatrix * GetCameraRotationMatrix();
	//R*T = rotate around origin, movement correct
	//T*R = rotate correct, absolute movement
	viewMatrix.Transpose();
	//the movement is absolute regardless of rotation for whatever reason...

	return viewMatrix;
}
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:15,代码来源:Camera3D.cpp

示例5:

void Matrix4::Adjoint( Matrix4* adjoint ) const
{
	Matrix4 cofactor;
	Cofactor( &cofactor );
	cofactor.Transpose( adjoint );
}
开发者ID:gefariasjr,项目名称:projetofinal1,代码行数:6,代码来源:glmatrix.cpp

示例6: InverseMVP

Matrix4 InverseMVP(const Matrix4 &invP, const Vector3 &T, const Matrix4 &R)
{
	return R.Transpose() * Matrix4::Translation(T).Transpose() * invP;
}
开发者ID:bizz84,项目名称:biz-engine,代码行数:4,代码来源:Misc.cpp

示例7: RotationTransform

Transform RotationTransform(float radians, float x, float y, float z) {
  const Matrix4 mat = RotationMatrix(radians, x, y, z);
  const Matrix4 inv = mat.Transpose();
  return Transform(mat, inv);
}
开发者ID:ingo2,项目名称:gargleblaster,代码行数:5,代码来源:Transform.cpp

示例8: RecompileInternal


//.........这里部分代码省略.........
			}
				
			case UT_INT:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_INT_VEC2:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_INT_VEC3:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_INT_VEC4:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_BOOL:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_BOOL_VEC2:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_BOOL_VEC3:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_BOOL_VEC4:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			//VI: Matrices are returned from the shader in column-major order so need to transpose the matrix.
			case UT_FLOAT_MAT2:
			{
				RENDER_VERIFY(glGetUniformfv(program, uniformStruct->location, (float32*)uniformStruct->cacheValue));
				Matrix2* m = (Matrix2*)uniformStruct->cacheValue;
				Matrix2 t;
				for (int i = 0; i < 2; ++i)
					for (int j = 0; j < 2; ++j)
						t._data[i][j] = m->_data[j][i];
				*m = t;

				break;
			}
				
			case UT_FLOAT_MAT3:
			{
				RENDER_VERIFY(glGetUniformfv(program, uniformStruct->location, (float32*)uniformStruct->cacheValue));
				Matrix3* m = (Matrix3*)uniformStruct->cacheValue;
				Matrix3 t;
				for (int i = 0; i < 3; ++i)
					for (int j = 0; j < 3; ++j)
						t._data[i][j] = m->_data[j][i];
				*m = t;
				
				break;
			}
				
			case UT_FLOAT_MAT4:
			{
				RENDER_VERIFY(glGetUniformfv(program, uniformStruct->location, (float32*)uniformStruct->cacheValue));
				Matrix4* m = (Matrix4*)uniformStruct->cacheValue;
				m->Transpose();
				
				break;
			}
				
			case UT_SAMPLER_2D:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
				
			case UT_SAMPLER_CUBE:
			{
				RENDER_VERIFY(glGetUniformiv(program, uniformStruct->location, (int32*)uniformStruct->cacheValue));
				break;
			}
		}
    }
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:101,代码来源:Shader.cpp


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