Code: Select all
class Line : public VertexBuffer{
int id;
public:
Line():VertexBuffer(){id=-1;}
void AddLine(double x1, double y1,double z1, double x2,double y2, double z2);
virtual void render();
void SetID(int ID);
int GetID();
};
Code: Select all
class VertexBuffer: public scene::ISceneNode {
public:
Irrlicht_params *params;
core::aabbox3d<f32> Box;
vector<video::S3DVertex> vertex;
video::SMaterial Material;
BOOL ccw;
BOOL update;
int width;
double posX,posY,posZ,scaleX,scaleY,scaleZ;
double red,green,blue,gamma,nX,nY,nZ;
VertexBuffer(): scene::ISceneNode(NULL, NULL,0){...}
~VertexBuffer(){Remove();}
void SetScale(double x, double y,double z);
void SetPosition(double x, double y,double z);
void SetWidth(int w);
void SetDefaultColor(double r,double g,double b,double i);
void SetDefaultN(double nx,double ny,double nz);
void New(Irrlicht_params *ip);
void SetPosition(int index, double x, double y, double z);
void SetColor(int index, double r, double g, double b, double i);
virtual void OnRegisterSceneNode();
virtual const core::aabbox3d<f32>& getBoundingBox() const
{ return Box; }
virtual u32 getMaterialCount() const{ return 1; }
virtual video::SMaterial& getMaterial(u32 i){ return Material; }
void Remove(){
this->remove();
vertex.clear();
}
Irrlicht_params * Params();
protected:
void AddVertex(double x,double y,double z);
};
PROBLEM:
The strange thing happens after I put the Line class in a deque or vector.
vector <Line> line;
Imagine I want to draw a contourmap. I put the lines of each altitude/ level into a vector element. 10 levels mean 10 vector elements holding the polylines. When I remove only one level of contourlines, in other words one element from the Line vector, Irrlicht seems to stop rendering the other elements of the vector . Despite 9 level of lines are seen properly in the debuger, only 5 levels gets rendered . I have no clue why this happens.
Interestingly using pointers in the vector :
Code: Select all
vector < * Line> line;
What the hack is up with the customscenenode. What method is used when removing a node, why does only pointer vectors work?