Compatibility fixes for GLM 0.9.9
Fixes: lp:1746546 * https://bugs.launchpad.net/kicad/+bug/1746546
This commit is contained in:
parent
8d0932dd58
commit
e0f7958dbd
|
@ -741,18 +741,18 @@ bool SCENEGRAPH::Prepare( const glm::dmat4* aTransform,
|
||||||
double rX, rY, rZ;
|
double rX, rY, rZ;
|
||||||
// rotation
|
// rotation
|
||||||
rotation_axis.GetVector( rX, rY, rZ );
|
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
|
// 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
|
// center
|
||||||
glm::dmat4 cM = 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::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
|
// scale
|
||||||
glm::dmat4 sM = glm::scale( glm::dmat4( 1.0 ), glm::dvec3( scale.x, scale.y, scale.z ) );
|
glm::dmat4 sM = glm::scale( glm::dmat4( 1.0 ), glm::dvec3( scale.x, scale.y, scale.z ) );
|
||||||
// scaleOrientation
|
// scaleOrientation
|
||||||
scale_axis.GetVector( rX, rY, rZ );
|
scale_axis.GetVector( rX, rY, rZ );
|
||||||
glm::dmat4 srM = 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( -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:
|
// resultant point:
|
||||||
// P' = T x C x R x SR x S x -SR x -C x P
|
// P' = T x C x R x SR x S x -SR x -C x P
|
||||||
|
|
|
@ -108,9 +108,9 @@ void C3D_RENDER_OGL_LEGACY::generate_ring_contour( const SFVEC2F &aCenter,
|
||||||
|
|
||||||
for( int ii = 0; ii < 3600; ii += delta )
|
for( int ii = 0; ii < 3600; ii += delta )
|
||||||
{
|
{
|
||||||
const SFVEC2F rotatedDir = glm::rotate( SFVEC2F( 1.0f, 0.0f ),
|
float angle = (float)( aInvertOrder ? ( 3600 - ii ) : ii )
|
||||||
(float)(aInvertOrder?(3600 - ii):ii) *
|
* 2.0f * glm::pi<float>() / 3600.0f;
|
||||||
2.0f * glm::pi<float>() / 3600.0f );
|
const SFVEC2F rotatedDir = SFVEC2F( cos( angle ), sin( angle ) );
|
||||||
|
|
||||||
aInnerContourResult.push_back( SFVEC2F( aCenter.x + rotatedDir.x * aInnerRadius,
|
aInnerContourResult.push_back( SFVEC2F( aCenter.x + rotatedDir.x * aInnerRadius,
|
||||||
aCenter.y + rotatedDir.y * aInnerRadius ) );
|
aCenter.y + rotatedDir.y * aInnerRadius ) );
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define VRML1_NODE_H
|
#define VRML1_NODE_H
|
||||||
|
|
||||||
#define GLM_FORCE_RADIANS
|
#define GLM_FORCE_RADIANS
|
||||||
#include <glm/gtx/transform.hpp>
|
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
|
@ -364,19 +364,19 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
rY = rotation.y;
|
rY = rotation.y;
|
||||||
rZ = rotation.z;
|
rZ = rotation.z;
|
||||||
rW = rotation.w;
|
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
|
// translation
|
||||||
float dX, dY, dZ;
|
float dX, dY, dZ;
|
||||||
dX = translation.x;
|
dX = translation.x;
|
||||||
dY = translation.y;
|
dY = translation.y;
|
||||||
dZ = translation.z;
|
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
|
// center
|
||||||
dX = center.x;
|
dX = center.x;
|
||||||
dY = center.y;
|
dY = center.y;
|
||||||
dZ = center.z;
|
dZ = center.z;
|
||||||
glm::mat4 cM = 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::vec3( -dX, -dY, -dZ ) );
|
glm::mat4 ncM = glm::translate( glm::mat4( 1.0f ), glm::vec3( -dX, -dY, -dZ ) );
|
||||||
// scale
|
// scale
|
||||||
glm::mat4 sM = glm::scale( glm::mat4( 1.0 ), glm::vec3( scale.x, scale.y, scale.z ) );
|
glm::mat4 sM = glm::scale( glm::mat4( 1.0 ), glm::vec3( scale.x, scale.y, scale.z ) );
|
||||||
// scaleOrientation
|
// scaleOrientation
|
||||||
|
@ -384,8 +384,8 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
rY = scaleOrientation.y;
|
rY = scaleOrientation.y;
|
||||||
rZ = scaleOrientation.z;
|
rZ = scaleOrientation.z;
|
||||||
rW = scaleOrientation.w;
|
rW = scaleOrientation.w;
|
||||||
glm::mat4 srM = 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( -rW, glm::vec3( rX, rY, rZ ) );
|
glm::mat4 nsrM = glm::rotate( glm::mat4( 1.0f ), -rW, glm::vec3( rX, rY, rZ ) );
|
||||||
|
|
||||||
// resultant transform:
|
// resultant transform:
|
||||||
// tx' = tM * cM * rM * srM * sM * nsrM * ncM
|
// tx' = tM * cM * rM * srM * sM * nsrM * ncM
|
||||||
|
|
Loading…
Reference in New Issue