Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Joey, flink, AndrewAMD, ozgur, Ayumi), 1,195 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
D3DVERTEX Pointer help #300033
11/29/09 04:20
11/29/09 04:20
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
Hello,

I have searched the forums and read all the documentation but I'm still having trouble figuring out the D3DVERTEX pointer in lite-c. I've attempted calling this code:
Code:
ENTITY* terrain = ent_create("maps/default.hmp",nullvector,NULL);
CONTACT* c = ent_getvertex(ent,NULL,1);
D3DVERTEX* vertexlst = ent_setvertex(ent,c,1);

...

debug_output = vertexlst[2].x;



But every time vertexlst[2].x returns a 0. vertexlst[1] always returns the right value but its the only thing in the array. I'm guessing it's because i'm just grabbing '1' of the mesh when I call ent_getvertex. Should I loop through by calling "ent_status(terrain,1)" to get the total vertices's and create my own array? E.G...

Code:
vert = ent_status(terrain,1);

for (a=0;a < vert;a++) {
 CONTACT* c = ent_getvertex(ent,NULL,a);
 D3DVERTEX* verttmp = ent_setvertex(ent,c,a);
 vertlst[a] = verttmp[1];
}



Or am I just doing something wrong?

Re: D3DVERTEX Pointer help [Re: DrunkenPirate] #300039
11/29/09 07:55
11/29/09 07:55
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
ent_setvertex returns a CONTACT*, not a D3DVERTEX*.

But CONTACT contains a D3DVERTEX pointer.

Re: D3DVERTEX Pointer help [Re: Spirit] #300125
11/29/09 23:09
11/29/09 23:09
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
Thank you! I misunderstood the manual.

EDIT: Okay, I believe I have it working for anyone that needs it:
Code:
VECTOR* pos = nullvector;
D3DVERTEX* vertlst;
CONTACT* c_tmp = ent_getvertex(terrain,NULL,1);
CONTACT* c = ent_setvertex(terrain,c_tmp,1);
vertlst = c.v;
var a, maxVert = ent_status(terrain,1);
	
while(1) {
 for (a=0;a < maxVert;a++) {
  vec_set(pos,vector(vertlst[a].x,vertlst[a].z,vertlst[a].y));
  draw_point3d(pos.x,vector(50,255,50),100,1);
 }
 wait(1);
}



I noticed a typo in the manual I think. It says to swap x,y coordinates when converting d3dvertex positions to engine positions but it is in fact the y,z coordinates that need to be swapped.

Last edited by DrunkenPirate; 11/30/09 00:06.
Re: D3DVERTEX Pointer help [Re: DrunkenPirate] #300134
11/30/09 06:20
11/30/09 06:20
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
I have another question and didn't want to start a new thread.

How can I check if a D3DVERTEX is empty? I have a defined length array of D3DVERTEX pointers filled with a undefined amount of D3DVERTEX entries. I want to draw a point on every D3DVERTEX but I need to avoid attempting to access empty array indicies (causing a overflow? & crash). Any way to retrieve the size (amount of entries) in a D3DVERTEX array? Should I create a var array with pointers (which would be easier to "count") which link to the D3DVERTEX pointer?

Re: D3DVERTEX Pointer help [Re: DrunkenPirate] #300143
11/30/09 08:07
11/30/09 08:07
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Online
Expert
Joey  Online
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
why don't you save the length into a separate var? or why not using dynamic arrays?

Re: D3DVERTEX Pointer help [Re: Joey] #300279
12/01/09 07:49
12/01/09 07:49
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
I don't know the length of the array it is generated for me by the engine. (Its the CONTACT* c.v array I'm talking about)


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