public:
// \90e\83R\83\93\83e\83i\8fã\82Å\82Ì\83I\83u\83W\83F\83N\83g\82Ì\83C\83\93\83f\83b\83N\83X
- int m_ObjectIndex;
- std::string m_Name;
+ int m_ObjectIndex;
- std::string m_FilePath;
- geom::GeomFileFormat m_FileFormat;
+ std::string m_Name;
- bool m_Visible;
- bool m_VertexOnlyMode;
+ // \83t\83@\83C\83\8b\82©\82ç\8dì\82ç\82ê\82½\83I\83u\83W\83F\83N\83g\82Ì\83\\81[\83X\8fî\95ñ
+ std::string m_FilePath;
+ geom::GeomFileFormat m_FileFormat;
+
+ bool m_Visible;
+ bool m_VertexOnlyMode;
boost::ptr_vector<MeshBuf> m_MeshAry;
- GeoNodeTree m_GTree;
+ GeoNodeTree m_GTree;
- TextureLib m_TextureLib;
+ TextureLib m_TextureLib;
};
return true;
}
+gl::GlTexture* GeomTextureSet::TakeTexture(TextureType type)
+{
+ gl::GlTexture* tex_buf = NULL;
+ if (type == TextureType::Color)
+ std::swap(tex_buf, TexColor);
+ else if (type == TextureType::Normal)
+ std::swap(tex_buf, TexNormal);
+
+ return tex_buf;
+}
+
+bool GeomTextureSet::IsChild(const gl::GlTexture* tex) const
+{
+ if (TexColor == tex)
+ return true;
+ if (TexNormal == tex)
+ return true;
+
+ return false;
+}
+
}
{
TexColor = NULL;
TexNormal = NULL;
+
+ TexScale = 1.0f;
}
void ReleaseAll(void)
gl::GlTexture* GetTexNormal(void) { return TexNormal; }
gl::MatcapImage& GetTexMatcap(void) { return TexMatcap; }
+ gl::GlTexture* TakeTexture(TextureType type);
+ bool IsChild(const gl::GlTexture* tex) const;
+
private:
bool IsActiveTexture(gl::GlTexture* tex) const;
gl::GlTexture* TexNormal;
gl::MatcapImage TexMatcap;
+ float TexScale;
+
private:
MeshBuf* Parent;
};
void MeshBuf::ReleaseTextureUnit(GeomTextureSet* ts, TextureType type)
{
- gl::GlTexture* tex_buf = NULL;
- if (type == TextureType::Color)
- std::swap(tex_buf, ts->TexColor);
- else if (type == TextureType::Normal)
- std::swap(tex_buf, ts->TexNormal);
-
+ gl::GlTexture* tex_buf = ts->TakeTexture(type);
if (!IsExistTextureLink(tex_buf))
tex_buf->FinalizeTexture();
}
{
for (GeomTextureSet& ts : m_Textures)
{
- if (ts.TexColor == tex)
- return true;
- if (ts.TexNormal == tex)
+ if (ts.IsChild(tex))
return true;
}
bool m_Visible;
std::string m_Name;
- lib_geo::BaseMesh m_Mesh;
+ lib_geo::BaseMesh m_Mesh;
std::map<int, bool> m_SelVerts;
std::map<int, FaceGroup> m_FaceMatGroup;
std::vector<VertexLinker> m_VertLinkers;
- lib_geo::CrossSection m_CrossSection;
+ lib_geo::CrossSection m_CrossSection;
std::vector<lib_geo::CrossSection> m_CrossSectionLog;
PolylineContext m_PolylineContext;
m_Rotate.vec_rotate(dst);
- if(!IsRightHandCoord())
+ if (!IsRightHandCoord())
dst.z = -dst.z;
return dst;
{
lm::vec3f dst = v;
- if(!IsRightHandCoord())
+ if (!IsRightHandCoord())
dst.z = -dst.z;
m_Rotate.get_conjugate().vec_rotate(dst);
mat.at(2, 0) = ez.x; mat.at(2, 1) = ez.y; mat.at(2, 2) = ez.z; mat.at(2, 3) = 0.0f;
mat.at(3, 0) = 0.0f; mat.at(3, 1) = 0.0f; mat.at(3, 2) = 0.0f; mat.at(3, 3) = 1.0f;
- if(!IsRightHandCoord())
+ if (!IsRightHandCoord())
mat = mat * lm::matrix4f::get_scale(1.0f, 1.0f, -1.0f);
}
lm::vec3f ey(0.0f, 0.0f, 0.0f);
lm::vec3f ez(0.0f, 0.0f, 0.0f);
- switch(m_CoordType)
+ switch (m_CoordType)
{
case COORD_RUF: ex.x = 1.0f; ey.y = 1.0f; ez.z = 1.0f; break;
case COORD_RUB: ex.x = 1.0f; ey.y = 1.0f; ez.z = 1.0f; break;
//! RightHand = OpenGL standard coordinate
bool SceneTransform::IsRightHandCoord(void) const
{
- switch(m_CoordType)
+ switch (m_CoordType)
{
case COORD_RUF:
case COORD_UFR:
void SceneTransform::SetGLForeFaceAngle(void)
{
- if(IsRightHandCoord())
+ if (IsRightHandCoord())
glFrontFace(GL_CCW);
else
glFrontFace(GL_CW);
glPushAttrib(GL_TRANSFORM_BIT);
glMatrixMode(GL_TEXTURE);
-
glLoadIdentity();
- if(m_FlipY)
+ if (m_FlipY)
{
glTranslated(0, 1, 0);
glScaled(1, -1, 1);
void View3D::PushAndIdentityGLModelProjMatrix(void)
{
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ PushBeginGLMat(GL_PROJECTION);
+ PushBeginGLMat(GL_MODELVIEW);
}
void View3D::PopGLModelProjMatrix(void)
{
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ PopEndGLMat(GL_MODELVIEW);
+ PopEndGLMat(GL_PROJECTION);
glMatrixMode(GL_MODELVIEW);
}
void View3D::PushAndIdentityGLAllMatrix(void)
{
PushAndIdentityGLModelProjMatrix();
- glMatrixMode(GL_TEXTURE);
+ PushBeginGLMat(GL_TEXTURE);
+}
+
+void View3D::PopGLAllMatrix(void)
+{
+ PopEndGLMat(GL_TEXTURE);
+ PopGLModelProjMatrix();
+}
+
+void View3D::PushBeginGLMat(GLenum mode)
+{
+ glMatrixMode(mode);
glPushMatrix();
glLoadIdentity();
}
-void View3D::PopGLAllMatrix(void)
+void View3D::PopEndGLMat(GLenum mode)
{
- glMatrixMode(GL_TEXTURE);
+ glMatrixMode(mode);
glPopMatrix();
- PopGLModelProjMatrix();
}
void View3D::RenderCurrentTextureToBillboard(int left, int top, int width, int height)
void PopGLModelProjMatrix(void);
void PopGLAllMatrix(void);
+ void PushBeginGLMat(GLenum mode);
+ void PopEndGLMat(GLenum mode);
+
void SelectClosestVertOnMouseDown(QMouseEvent *e);
void SelectObjectOnMouseDown(QMouseEvent *e);