Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, Aku_Aku, 1 invisible), 579 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
drawing models (lines ?) #472902
05/28/18 23:20
05/28/18 23:20
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline 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:
Quote:
-Crayon Physics Deluxe
-Love balls

And a small video:
Crayon Trailer

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: drawing models (lines ?) [Re: 3run] #472904
05/29/18 06:37
05/29/18 06:37
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Store line segments in a list and create mesh at runtime with DirectX functions


Visit my site: www.masterq32.de
Re: drawing models (lines ?) [Re: MasterQ32] #472912
05/29/18 12:37
05/29/18 12:37
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
What you meant by line segments? Can you please explain a bit more? Do I need to separate what user has drawn into the segments?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Check this out:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=464687#Post464687

The following should work as a code base for setting up the mesh:

Code:
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
Re: drawing models (lines ?) [Re: Superku] #472917
05/29/18 15:48
05/29/18 15:48
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Wow! Thank you Superku, I don't know how I even missed that txesmi's awesome contribution! And for your code as well, thank you. laugh

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1