lucifer1101
Member
|
Deleting a Mesh Base (Mshb)
in the tutorial code 07 mesh im trying to fix it because the way you have it isnt deleting the original mesh.
To get the white working properly i just scaled the new torus to .001 of its original size, but when i want to make it smaller it isnt going to work unless i can delete the mshb when pressing x button.
I also looked at the else discriptions and used that when displaying it, but all it does is constantly draw it there because the other else's are drawing it because no other buttons are being pressed.....
Im an official Esenthel Nooblet
|
|
12-25-2008 07:09 AM |
|
lucifer1101
Member
|
Re: Deleting a Mesh Base (Mshb)
i just tried mshb.del(), but it did not do what i want.
I just need a way of stopping the mshb.draw() when key x is being pressed, i thaught about using a variable to do this but do not know how..
Im an official Esenthel Nooblet
|
|
12-25-2008 07:23 AM |
|
Esenthel
Administrator
|
Re: Deleting a Mesh Base (Mshb)
Hi
I'm not sure what you want to achieve
currently the tutorial looks like this
if (mouse button is pressed) then draw a flat colored torus shape
otherwise : draw a light shaded torus from a mesh
how would you like to make it working?
if you don't want to draw a mesh you don't have to delete it, you can just not draw it
if( ! Kb.b(KB_X) ) mesh.draw(); // something like that won't draw a mesh when 'x' is pressed
|
|
12-25-2008 02:15 PM |
|
craksy
Member
|
Re: Deleting a Mesh Base (Mshb)
yea... for stuff like that i normally do something like:
if(!1=1) mesh.draw();
keeping in mind that 1 allways is equal to 1, can solve many problems in programming
|
|
12-25-2008 04:20 PM |
|
lucifer1101
Member
|
Re: Deleting a Mesh Base (Mshb)
thankyou for your replies it really helped, here is what my code ended up as...
Code:
void Draw()
{
D.clear(TURQ);
LightDir(1,Vec(0,0,1)).set(); // set directional light in (0,0,1) direction before rendering to achieve lighting (NOTE: only directional light is supported in simple rendering mode)
if(Ms.b(0)) // when left mouse button on
{
Torus(1,0.3001).draw(WHITE,true); // draw flat colored torus through Torus shape
}
if(Ms.b(1)) // when left mouse button on
{
Torus(1,0.3001).draw(BLACK,true); // draw flat colored torus through Torus shape
}
if(Kb.b(KB_SPACE))
{
Torus(0.5,0.1).draw(WHITE,true);
}
if (!Kb.b(KB_SPACE)) mshb.draw(NULL);
}
/******************************************************************************/
now im on to a different thing, rotation and scaling.
any suggestions where i should look?
Im an official Esenthel Nooblet
|
|
12-25-2008 11:39 PM |
|
Esenthel
Administrator
|
Re: Deleting a Mesh Base (Mshb)
please check "Matrix.cpp" tutorial
|
|
12-26-2008 12:01 PM |
|