Compatibility fixes for GLM 0.9.9

Fixes: lp:1746546
* https://bugs.launchpad.net/kicad/+bug/1746546
This commit is contained in:
Jean Philippe EIMER 2018-02-06 13:28:53 +01:00 committed by Maciej Suminski
parent 8d0932dd58
commit e0f7958dbd
4 changed files with 16 additions and 16 deletions

View File

@ -741,18 +741,18 @@ bool SCENEGRAPH::Prepare( const glm::dmat4* aTransform,
double rX, rY, rZ;
// rotation
rotation_axis.GetVector( rX, rY, rZ );
glm::dmat4 rM = glm::rotate( rotation_angle, glm::dvec3( rX, rY, rZ ) );
glm::dmat4 rM = glm::rotate( glm::dmat4( 1.0 ), rotation_angle, glm::dvec3( rX, rY, rZ ) );
// translation
glm::dmat4 tM = glm::translate( glm::dvec3( translation.x, translation.y, translation.z ) );
glm::dmat4 tM = glm::translate( glm::dmat4( 1.0 ), glm::dvec3( translation.x, translation.y, translation.z ) );
// center
glm::dmat4 cM = glm::translate( glm::dvec3( center.x, center.y, center.z ) );
glm::dmat4 ncM = glm::translate( glm::dvec3( -center.x, -center.y, -center.z ) );
glm::dmat4 cM = glm::translate( glm::dmat4( 1.0 ), glm::dvec3( center.x, center.y, center.z ) );
glm::dmat4 ncM = glm::translate( glm::dmat4( 1.0 ), glm::dvec3( -center.x, -center.y, -center.z ) );
// scale
glm::dmat4 sM = glm::scale( glm::dmat4( 1.0 ), glm::dvec3( scale.x, scale.y, scale.z ) );
// scaleOrientation
scale_axis.GetVector( rX, rY, rZ );
glm::dmat4 srM = glm::rotate( scale_angle, glm::dvec3( rX, rY, rZ ) );
glm::dmat4 nsrM = glm::rotate( -scale_angle, glm::dvec3( rX, rY, rZ ) );
glm::dmat4 srM = glm::rotate( glm::dmat4( 1.0 ), scale_angle, glm::dvec3( rX, rY, rZ ) );
glm::dmat4 nsrM = glm::rotate( glm::dmat4( 1.0 ), -scale_angle, glm::dvec3( rX, rY, rZ ) );
// resultant point:
// P' = T x C x R x SR x S x -SR x -C x P

View File

@ -108,9 +108,9 @@ void C3D_RENDER_OGL_LEGACY::generate_ring_contour( const SFVEC2F &aCenter,
for( int ii = 0; ii < 3600; ii += delta )
{
const SFVEC2F rotatedDir = glm::rotate( SFVEC2F( 1.0f, 0.0f ),
(float)(aInvertOrder?(3600 - ii):ii) *
2.0f * glm::pi<float>() / 3600.0f );
float angle = (float)( aInvertOrder ? ( 3600 - ii ) : ii )
* 2.0f * glm::pi<float>() / 3600.0f;
const SFVEC2F rotatedDir = SFVEC2F( cos( angle ), sin( angle ) );
aInnerContourResult.push_back( SFVEC2F( aCenter.x + rotatedDir.x * aInnerRadius,
aCenter.y + rotatedDir.y * aInnerRadius ) );

View File

@ -31,7 +31,7 @@
#define VRML1_NODE_H
#define GLM_FORCE_RADIANS
#include <glm/gtx/transform.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <list>

View File

@ -364,19 +364,19 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
rY = rotation.y;
rZ = rotation.z;
rW = rotation.w;
glm::mat4 rM = glm::rotate( rW, glm::vec3( rX, rY, rZ ) );
glm::mat4 rM = glm::rotate( glm::mat4( 1.0f ), rW, glm::vec3( rX, rY, rZ ) );
// translation
float dX, dY, dZ;
dX = translation.x;
dY = translation.y;
dZ = translation.z;
glm::mat4 tM = glm::translate( glm::vec3( dX, dY, dZ ) );
glm::mat4 tM = glm::translate( glm::mat4( 1.0f ), glm::vec3( dX, dY, dZ ) );
// center
dX = center.x;
dY = center.y;
dZ = center.z;
glm::mat4 cM = glm::translate( glm::vec3( dX, dY, dZ ) );
glm::mat4 ncM = glm::translate( glm::vec3( -dX, -dY, -dZ ) );
glm::mat4 cM = glm::translate( glm::mat4( 1.0f ), glm::vec3( dX, dY, dZ ) );
glm::mat4 ncM = glm::translate( glm::mat4( 1.0f ), glm::vec3( -dX, -dY, -dZ ) );
// scale
glm::mat4 sM = glm::scale( glm::mat4( 1.0 ), glm::vec3( scale.x, scale.y, scale.z ) );
// scaleOrientation
@ -384,8 +384,8 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
rY = scaleOrientation.y;
rZ = scaleOrientation.z;
rW = scaleOrientation.w;
glm::mat4 srM = glm::rotate( rW, glm::vec3( rX, rY, rZ ) );
glm::mat4 nsrM = glm::rotate( -rW, glm::vec3( rX, rY, rZ ) );
glm::mat4 srM = glm::rotate( glm::mat4( 1.0f ), rW, glm::vec3( rX, rY, rZ ) );
glm::mat4 nsrM = glm::rotate( glm::mat4( 1.0f ), -rW, glm::vec3( rX, rY, rZ ) );
// resultant transform:
// tx' = tM * cM * rM * srM * sM * nsrM * ncM