RE: Dynamic Terrain ?
you would look into the Vtx3DTexCol;
and using VI you can call stuff.
exemple of a class i was using before ( credit to pherael )
Memc<MobileDecal> MD;
class MobileDecal
{
ImagePtr image;
Vec pos;
flt size;
flt alpha = 1; // 0 to 1.
flt angle = 180;
MobileDecal & create(ImagePtr img, Vec pos, flt size=1)
{
T.pos = pos;
image = img;
T.size = size;
return T;
}
void moveTo(Vec pos, flt angle)
{
T.pos = pos;
T.angle = angle;
}
void moveTo(Vec pos)
{
T.pos = pos;
}
void setSize(flt size)
{
T.size = size;
}
void setAlpha(flt alpha)
{
T.alpha = alpha;
}
void draw()
{
SetMatrix();
Vtx3DTexCol v[4];
flt halfsize = size/2;
FREPA(v)
{
v[i].color = ColorAlpha(alpha);
}
Vec vt[4];
vt[0].set(-halfsize, size , 0);
vt[1].set(-halfsize, 0 , 0);
vt[2].set(halfsize, 0 , 0);
vt[3].set(halfsize, size , 0);
Matrix m(pos, Cam.matrix.orn());
REPAO(vt).mul(m);
v[0].pos.set(pos.x+vt[0].x, pos.y+vt[0].y, pos.z+vt[0].z); v[0].tex.set(0, 1);
v[1].pos.set(pos.x+vt[1].x, pos.y+vt[1].y, pos.z+vt[1].z); v[1].tex.set(0, 0);
v[2].pos.set(pos.x+vt[2].x, pos.y+vt[2].y, pos.z+vt[2].z); v[2].tex.set(1, 0);
v[3].pos.set(pos.x+vt[3].x, pos.y+vt[3].y, pos.z+vt[3].z); v[3].tex.set(1, 1);
/*v[0].pos.set(pos.x-Cos(angle)*size , pos.y, pos.z+Sin(angle)*size);
v[1].pos.set(pos.x-Sin(angle)*size , pos.y + size, pos.z-Cos(angle)*size);
v[2].pos.set(pos.x+Cos(angle)*size , pos.y + size, pos.z-Sin(angle)*size);
v[3].pos.set(pos.x+Sin(angle)*size , pos.y, pos.z+Cos(angle)*size); */
VI.image(image());
VI.face(v[0], v[1], v[2], v[3]);
VI.end ();
}
}
|