コード例 #1
0
ファイル: ceggeometrybuffer.cpp プロジェクト: bilgili/FlowVR
	void FlowVRCegGeometryBuffer::updateTransform() const
	{
//		std::cout << "void FlowVRCegGeometryBuffer[" << this << "]::updateTransform() const" << std::endl;
		m_bTransDirty = false;

		Mat4x4f rx = matrixRotation( m_rotation.d_x, Vec3f(1,0,0) );
		Mat4x4f ry = matrixRotation( m_rotation.d_y, Vec3f(0,1,0) );
		Mat4x4f rz = matrixRotation( m_rotation.d_z, Vec3f(0,0,1) );

		Mat4x4f t  = matrixTranslation( Vec3f( m_translation.d_x, m_translation.d_y, m_translation.d_z )+Vec3f( m_pivot.d_x, m_pivot.d_y, m_pivot.d_z ) );
		Mat4x4f p  = matrixTranslation(-Vec3f( m_pivot.d_x, m_pivot.d_y, m_pivot.d_z ) );

		m_composedT =  p * rx * ry * rz * t;

//		std::cout << "final mat: " << toString(m_composedT) << std::endl;
		// set transform
		std::for_each( m_mpbatchMap.begin(), m_mpbatchMap.end(), _setParam<Mat4x4f>( m_parent.getChunkWriter(), m_composedT, ChunkPrimParam::TRANSFORM ) );

		// apply projection matrix for this primitive for the main display
		Size sz = m_parent.getDisplaySize();
		Mat4x4f op = ftl::matrixOrthoProjection( 0.0f, float(sz.d_width), float(sz.d_height), 0.0f, 0.0f, 1.0f );

		std::for_each( m_mpbatchMap.begin(), m_mpbatchMap.end(), _setParam<Mat4x4f>( m_parent.getChunkWriter(), op, ChunkPrimParam::PROJECTION ) );

	}
コード例 #2
0
ファイル: OvglMath.cpp プロジェクト: SteveDeFacto/ovgl
Matrix44 Matrix44::translation()
{
    Matrix44 out;
    out = matrixTranslation(this->_41, this->_42, this->_43);
    return out;
}