add and use BasicVector3.vec2()
This commit is contained in:
parent
4697d7940c
commit
4471302857
|
|
@ -108,6 +108,13 @@ public:
|
|||
return m_elements;
|
||||
}
|
||||
|
||||
BasicVector2<Element>& vec2(){
|
||||
return reinterpret_cast<BasicVector2<Element>&>( x() );
|
||||
}
|
||||
const BasicVector2<Element>& vec2() const {
|
||||
return reinterpret_cast<const BasicVector2<Element>&>( x() );
|
||||
}
|
||||
|
||||
void set( const Element value ){
|
||||
x() = y() = z() = value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,8 +143,7 @@ public:
|
|||
matrix4_transform_vector4( volume.GetViewport(), position );
|
||||
// globalOutputStream() << position << " Viewport\n";
|
||||
// globalOutputStream() << volume.GetViewport()[0] << " " << volume.GetViewport()[5] << " Viewport size\n";
|
||||
m_label.screenPos.x() = position.x();
|
||||
m_label.screenPos.y() = position.y();
|
||||
m_label.screenPos = position.vec3().vec2();
|
||||
// globalOutputStream() << m_label.screenPos << "\n";
|
||||
|
||||
renderer.PushState();
|
||||
|
|
|
|||
|
|
@ -312,9 +312,7 @@ void Texdef_EmitTextureCoordinates( const TextureProjection& projection, std::si
|
|||
|
||||
for ( Winding::iterator i = w.begin(); i != w.end(); ++i )
|
||||
{
|
||||
Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).vertex );
|
||||
( *i ).texcoord[0] = texcoord[0];
|
||||
( *i ).texcoord[1] = texcoord[1];
|
||||
( *i ).texcoord = matrix4_transformed_point( local2tex, ( *i ).vertex ).vec2();
|
||||
|
||||
( *i ).tangent = tangent;
|
||||
( *i ).bitangent = bitangent;
|
||||
|
|
|
|||
|
|
@ -782,8 +782,7 @@ public:
|
|||
for( std::size_t i = 0; i < 3; ++i ){
|
||||
if( points[i].w() > 0.005f ){
|
||||
updateTex( i, bounds.extents[i] );
|
||||
m_labels[i].screenPos.x() = points[i].x();
|
||||
m_labels[i].screenPos.y() = points[i].y();
|
||||
m_labels[i].screenPos = points[i].vec3().vec2();
|
||||
renderer.addRenderable( m_labels[i], g_matrix4_identity );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1239,9 +1239,7 @@ void Patch::ProjectTexture( TextureProjection projection, const Vector3& normal
|
|||
|
||||
for ( PatchControlIter i = m_ctrl.data(); i != m_ctrl.data() + m_ctrl.size(); ++i )
|
||||
{
|
||||
Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).m_vertex );
|
||||
( *i ).m_texcoord[0] = texcoord[0];
|
||||
( *i ).m_texcoord[1] = texcoord[1];
|
||||
( *i ).m_texcoord = matrix4_transformed_point( local2tex, ( *i ).m_vertex ).vec2();
|
||||
}
|
||||
|
||||
controlPointsChanged();
|
||||
|
|
@ -1256,9 +1254,7 @@ void Patch::ProjectTexture( const texdef_t& texdef, const Vector3* direction ){
|
|||
|
||||
for ( PatchControlIter i = m_ctrl.data(); i != m_ctrl.data() + m_ctrl.size(); ++i )
|
||||
{
|
||||
Vector3 texcoord = matrix4_transformed_point( local2tex, ( *i ).m_vertex );
|
||||
( *i ).m_texcoord[0] = texcoord[0];
|
||||
( *i ).m_texcoord[1] = texcoord[1];
|
||||
( *i ).m_texcoord = matrix4_transformed_point( local2tex, ( *i ).m_vertex ).vec2();
|
||||
}
|
||||
|
||||
controlPointsChanged();
|
||||
|
|
|
|||
|
|
@ -5850,8 +5850,7 @@ private:
|
|||
const Matrix4 uvTransform = transform_local2object( matrix4_affine_inverse( transform ), m_faceLocal2tex, m_faceTex2local );
|
||||
for( std::size_t i = 0; i < m_patchCtrl.size(); ++i ){
|
||||
const Vector3 uv = matrix4_transformed_point( uvTransform, Vector3( m_patchCtrl[i].m_texcoord ) );
|
||||
m_patch->getControlPointsTransformed()[i].m_texcoord.x() = uv.x();
|
||||
m_patch->getControlPointsTransformed()[i].m_texcoord.y() = uv.y();
|
||||
m_patch->getControlPointsTransformed()[i].m_texcoord = uv.vec2();
|
||||
}
|
||||
// m_patch->controlPointsChanged();
|
||||
m_patch->UpdateCachedData();
|
||||
|
|
@ -6461,8 +6460,7 @@ public:
|
|||
const Matrix4 translation = matrix4_translation_for_vec3( result );
|
||||
for( std::size_t i : indices ){
|
||||
const Vector3 uv = matrix4_transformed_point( translation, Vector3( m_patchCtrl[i].m_texcoord ) );
|
||||
m_patch->getControlPointsTransformed()[i].m_texcoord.x() = uv.x();
|
||||
m_patch->getControlPointsTransformed()[i].m_texcoord.y() = uv.y();
|
||||
m_patch->getControlPointsTransformed()[i].m_texcoord = uv.vec2();
|
||||
m_patchRenderPoints.m_points[i].vertex = vertex3f_for_vector3( uv );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user