Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 841 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Make a mdl model with engine..? #432479
11/06/13 17:20
11/06/13 17:20

M
Malice
Unregistered
Malice
Unregistered
M



Is it possible to write a small script that places 6 vertices in a box shape, links them with faces, applies a texture and saves the object out of the engine as a mdl?

Re: Make a mdl model with engine..? [Re: ] #432483
11/06/13 17:32
11/06/13 17:32
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
You have to use the MDL SDK wink

Re: Make a mdl model with engine..? [Re: Ch40zzC0d3r] #432484
11/06/13 17:42
11/06/13 17:42

M
Malice
Unregistered
Malice
Unregistered
M



Cool - If I fallow up on this experiment in a few months can I pm you (or anyone else that's willing) for advice on how to achieve that. It's stepping out of my skill zone but I'm sure I can figure most of it out on my own if I put in the work.

Re: Make a mdl model with engine..? [Re: ] #432486
11/06/13 18:12
11/06/13 18:12
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
no. there is an example of it, using some directx functions to create a simple entity... but you need 8 vertices for a box tongue for tomorrow I can get the link from my other pc.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Make a mdl model with engine..? [Re: sivan] #432487
11/06/13 18:19
11/06/13 18:19

M
Malice
Unregistered
Malice
Unregistered
M



Thanks savin - lol yes 8 verts, I was thinking 6 directions.

Re: Make a mdl model with engine..? [Re: sivan] #432488
11/06/13 18:22
11/06/13 18:22
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
and how do you want to save it with directx to .mdl? grin
However, its simple to inlcude it to your VC++ project and make a little plugin to achieve this. You should first try it on your own, but if you have problems just contact me.

Re: Make a mdl model with engine..? [Re: Ch40zzC0d3r] #432489
11/06/13 18:27
11/06/13 18:27

M
Malice
Unregistered
Malice
Unregistered
M



Thanks Ch40zzC0d3r. Absolutely I will figure it out before asking anything. That is the fun of coding right?

Re: Make a mdl model with engine..? [Re: ] #432498
11/06/13 21:41
11/06/13 21:41
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
You can check my code below, maybe it helps.

Code:
#include <default.c>
#include <ackphysx.h>
#include <d3d9.h>

#define PRAGMA_PATH "%EXE_DIR%\samples"

#define NVB 9  // Number of Vertices
#define NIB 42 // Number of Indexes
#define NAB 14 // Number of Attributes

LPD3DXMESH pMesh;
D3DVERTEX pvb[NVB];

short pib[NIB];
long  pab[NAB];

ENTITY* ent;

function create_house(ENTITY *entity) {

	//printf("Total number of mesh vertices = %d", (long)ent_status(entity, 1));
	
	int num_triangles = NAB;
	int num_vertices  = NVB;
	
	// Vertices

	pvb[0].x = -8;pvb[0].y =  8;pvb[0].z = -8;
	pvb[1].x =  8;pvb[1].y =  8;pvb[1].z = -8;
	pvb[2].x =  8;pvb[2].y =  8;pvb[2].z =  8;
	pvb[3].x = -8;pvb[3].y =  8;pvb[3].z =  8;
	pvb[4].x = -8;pvb[4].y = -8;pvb[4].z = -8;
	pvb[5].x =  8;pvb[5].y = -8;pvb[5].z = -8;
	pvb[6].x =  8;pvb[6].y = -8;pvb[6].z =  8;
	pvb[7].x = -8;pvb[7].y = -8;pvb[7].z =  8;
	pvb[8].x =  0;pvb[8].y = 32;pvb[8].z =  0;
	
	// Triangles / Attributes
	
	pib[ 0] = 6;pib[ 1] = 2;pib[ 2] = 7; pab[ 0] = 0;
	pib[ 3] = 3;pib[ 4] = 7;pib[ 5] = 2; pab[ 1] = 1;
	pib[ 6] = 7;pib[ 7] = 3;pib[ 8] = 4; pab[ 2] = 2;
	pib[ 9] = 0;pib[10] = 4;pib[11] = 3; pab[ 3] = 3;
	pib[12] = 4;pib[13] = 0;pib[14] = 5; pab[ 4] = 4;
	pib[15] = 1;pib[16] = 5;pib[17] = 0; pab[ 5] = 5;
	pib[18] = 5;pib[19] = 1;pib[20] = 6; pab[ 6] = 6;
	pib[21] = 2;pib[22] = 6;pib[23] = 1; pab[ 7] = 7;
	pib[24] = 7;pib[25] = 4;pib[26] = 6; pab[ 8] = 8;
	pib[27] = 5;pib[28] = 6;pib[29] = 4; pab[ 9] = 9;
	pib[30] = 3;pib[31] = 8;pib[32] = 0; pab[10] = 10;
	pib[33] = 2;pib[34] = 8;pib[35] = 3; pab[11] = 11;
	pib[36] = 1;pib[37] = 8;pib[38] = 2; pab[12] = 12;
	pib[39] = 0;pib[40] = 8;pib[41] = 1; pab[13] = 13;
	
	D3DXCreateMesh(num_triangles, num_vertices, D3DXMESH_MANAGED , pvertexdecl, pd3ddev, &pMesh);

	D3DVERTEX *pnewvb;  pMesh->LockVertexBuffer(0, (void**)&pnewvb);
	short *pnewib;  pMesh->LockIndexBuffer(0, (void**)&pnewib);
	long *pnewab;  pMesh->LockAttributeBuffer(0, &pnewab);
	
	memcpy(pnewvb, pvb, num_vertices*ent_status(entity,22));
	memcpy(pnewib, pib, num_triangles*3*sizeof(short));
	memcpy(pnewab, pab, num_triangles*sizeof(long));
	
	pMesh->UnlockVertexBuffer();
	pMesh->UnlockIndexBuffer();
	pMesh->UnlockAttributeBuffer();
	
	D3DXComputeNormals(pMesh,0);

	//int entBuffer = ent_buffers(entity,0,0,&pnewvb,&pnewib,&pnewab);
	//printf("Number of triangles of the mesh = %i", entBuffer);
	
	ent_setmesh(entity, pMesh, 0, 0); //printf("ent_setmesh(entity, pMesh, 0, 0);");
	
	//int entBuffer = ent_buffers(entity,0,0,&pnewvb,&pnewib,&pnewab);
	//printf("Number of triangles of the mesh = %i", entBuffer);

	//printf("Total number of mesh vertices = %d", (long)ent_status(entity, 1));
}

function init_mesh() {
	
	ent = ent_create(CUBE_MDL, vector(-100, 0, 0), NULL);
	ent_clone(ent); set(ent, SHADOW|CAST);
	
	create_house(ent);
	wait_for(create_house);
	c_setminmax(ent);

	pXent_settype(ent,PH_RIGID,PH_CONVEX);
	wait(1);
}

function spot1() {

	set(me, SPOTLIGHT|CAST|LIGHT);
	my.lightrange = 500;
	vec_set(my.blue,vector(255,100,100));
	
	while(1) {
		my.pan += 3*time_step;
		my.tilt = -60;
		wait(1);
	}
}

function spot2() {

	set(me, SPOTLIGHT|CAST|LIGHT);
	my.lightrange = 500;
	vec_set(my.blue,vector(255,50,100));
	
	while(1) {
		my.pan -= 3*time_step;
		my.tilt = -60;
		wait(1);
	}
}

function main() {

	random_seed(0);
	vec_set(sky_color,vector(76,51,25));
	video_set(1024, 768, 32, 2);
	fps_max = 60; sun_light = 0;
	shadow_stencil = 1;
	physX_open();
	level_load("small.hmp");
	vec_set(ambient_color,vector(40,40,40));
	vec_set(camera.x,vector(-211,-77,50));
	vec_set(camera.pan,vector(35,-19,0));
	pXent_settype(level_ent,PH_STATIC,PH_POLY);
	
	init_mesh(); wait_for(init_mesh);
	int i; for(i=1;i<NAB+1;i++)
	ent_setskin(ent, bmap_fill(bmap_createblack(32,32,24),vector(50+integer(random(255)),100+integer(random(255)),100+integer(random(255))),100),i);
	ent.ambient = 50;
	//printf("Total number of model skins = %d", (long)ent_status(ent, 8));
	you = ent_create(CUBE_MDL,vector(0,0,200),spot1);
	you = ent_create(CUBE_MDL,vector(100,0,200),spot2);
	
	def_move();
	
	while(1) {
		pX_pick(); // pick and move the mesh with the cursor
		wait(1);
	}
}

function on_esc_event() {
	
	pMesh = ent_getmesh(ent,0,0);
	pMesh->Release();
	ent_setmesh(ent,0,0,0);
	sys_exit("");
}



Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: Make a mdl model with engine..? [Re: rojart] #432499
11/06/13 22:28
11/06/13 22:28

M
Malice
Unregistered
Malice
Unregistered
M



Thanks rojart

The straight LiteC is can fallow but I'm going to have to do some learning for the rest... This will be a fun challenge. It actual doesn't look that hard to figure out, did you just fill some arrays and then run them through some dx functions?

Re: Make a mdl model with engine..? [Re: ] #432502
11/06/13 23:34
11/06/13 23:34
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
Woooah! Awesome script rojart! and all from code! I'm blown away....

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

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