I have a Geometry class
class Geometry
{
public:
std::string stdstrType;
bool bValid;
public:
Geometry()
Geometry( std::string strType , bool bValue )
Geometry(const Geometry &g)
~Geometry()
virtual void draw();
bool isValid();
void setValidState(bool bState);
virtual void Init();
std::string GetName();
};
Which is the base class for geometry objects like in this case for sphere class
class Sph : public Geometry
{
public:
Sph( float radius , float segments );
~Sph();
void init();
void CleanUp();
void draw();
private:
float fRadius, fSegments;
bool isInited;
unsigned int m_VAO, m_VBO;
int iNumsToDraw;
SumShader shader;
bool isChanged;
};
I have a Tree structure holding different Container objects and geometry is a data type in the Container object.
class Container
{
private:
std::string stdstrContainerName;
std::string stdstrPluginType;
Geometry Geom;
}
Since each item in the tree can hold a circle sphere or rectangle so i would like to Use the draw function of geometry to draw the Geometry object types. For this when i try to cast any Geometry Object type to Geometry i get a Error.
Geometry *geom = new Geometry;
geom = &sphere;
Container cont("Sphere" , "SPHERE" , *geometry );
myModel->SetContainer(child, cont);
1)Is this the Correct Approach .
2) How can i cast the Geometry Objects to the Geometry Pointer.
Aucun commentaire:
Enregistrer un commentaire