3 registered members (7th_zorro, Aku_Aku, 1 invisible),
579
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
drawing models (lines ?)
#472902
05/28/18 23:20
05/28/18 23:20
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hi guys! What would be the best way to draw models with a mouse? I mean some basic ones, like drawing primitives with lines. As an example, you can take a look at those games like: -Crayon Physics Deluxe -Love balls And a small video: Crayon TrailerBest regards!
|
|
|
Re: drawing models (lines ?)
[Re: 3run]
#472915
05/29/18 14:59
05/29/18 14:59
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Check this out: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=464687#Post464687The following should work as a code base for setting up the mesh:
ENTITY* createCoolMesh( polygon input )
{
D3DVERTEX *vertexBuffer;
short *indexBuffer;
long *attributeBuffer;
LPD3DXMESH newMesh = NULL;
int numVertices = polygon vertices;
int numTriangles = polygon triangles;
D3DXCreateMesh(numTriangles, numVertices, D3DXMESH_MANAGED , pvertexdecl, pd3ddev, &newMesh);
newMesh->LockVertexBuffer(0, &vertexBuffer);
newMesh->LockIndexBuffer(0, &indexBuffer);
newMesh->LockAttributeBuffer(0, &attributeBuffer);
set up vertexBuffer[i] (at least the xyz position) for every i < numVertices;
set up indexBuffer[i] for every i < numTriangles*3;
set attributeBuffer[i] to 0 for every i < numTriangles;
newMesh->UnlockVertexBuffer();
newMesh->UnlockIndexBuffer();
newMesh->UnlockAttributeBuffer();
D3DXComputeNormals(newMesh,0);
ENTITY* ent = ent_create, ent_clone, ent_setmesh
return ent;
}
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
|