Пример #1
0
// ******************************************************************************** //
// Resets the quaternion for new rotation
// Nonperformant - but grants that the rotation is the same as for matrices and it is
// the easiest implementation.
void OrE::Math::SRT::SetRotation( float _fYaw, float _fPitch, float _fRoll )
{
	// Build matrix and do transformation to quaternion
	m_Quaternion = Quaternion( MatrixRotation( _fYaw, _fPitch, _fRoll ) );

	// Safe original translation and scale
/*	Vec3 vScale = m_vScale;
	Vec3 vTranslation = m_vTranslation;

	// Create quaternion from rotation matrix.
	// This resets scale to one and translation to 0 -> saved values.
	SetTransformation( MatrixRotation( _fYaw, _fPitch, _fRoll ) );

	m_vScale = vScale;
	m_vTranslation = vTranslation;*/
}
Пример #2
0
    void KGEDevice::transformVertexes()
    {
        _mat = MatrixScale(0.02, 0.02, 0.02)*MatrixTranslate(Vector4(0, -20, 0, 0))*MatrixRotation(Vector4(1, 0, 0, 0), -90 * M_PI / 180);

        int vertexCount = (int)_transformMesh->positionList.size();
        for (int i = 0; i < vertexCount; ++i)
        {
            KGEVertex v = _transformMesh->GetVertex(i);
            KGEVertex tranformedV = VertexShaderProgram(_mat, _camera, _light, _transformMesh->materialList[v.materialID], v);

            _transformMesh->SetVertex(i, tranformedV);
        }


        vertexCount = _transformMesh->positionList.size();

        for (int i = 0; i < vertexCount; ++i)
        {
            _transformMesh->positionList[i].persDiv();
            _transformMesh->positionList[i] = _viewportMat * _transformMesh->positionList[i];
        }
    }