Rotating a 2D Array so it's Isometric
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>
Ben
anyway - problems been solved
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>
This type of knowledge could prove useful to alot of people so maybe you should write up an article on it.
Dino M. Gambone
Good judgement is gained through experience. Experience, however, is gained through bad judgement.
Dino M. Gambone
Good judgment is gained through experience. Experience, however, is gained through bad judgment.
Currently working on Rise of Praxis MUD: http://www.riseofpraxis.net/
I cant [at the moment] transfer UDT''s - I get loads of VB errors, even if the C++ source is correct...
I''m working on it though...
Jack,
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>
Dino M. Gambone
Good judgement is gained through experience. Experience, however, is gained through bad judgement.
Dino M. Gambone
Good judgment is gained through experience. Experience, however, is gained through bad judgment.
Currently working on Rise of Praxis MUD: http://www.riseofpraxis.net/
I''m pretty sure it''s to do with my prototypes in C++...
I was getting a "Bad Calling Convention" error from Visual Basic...
I had code like:
typedef struct _D3DTLVERTEX
{
float sx;
float sy;
float sz;
float rhw;
float specular
long color;
float tu;
float tv;
}D3DTLVERTEX;
Not necessarily in that order...
and
Private Type D3DTLVERTEX
sx as single
sy as single
sz as single
rhw as single
specular as single
color as long
tu as single
tv as single
end type
They were in the same order in both languages...
and I was using
void _stdcall AlterVertex(D3DTLVERTEX *v)
{
//Stuff here
}
but someone advised me to use a different type of declaration - but I cant remember it off the top of my head
Jack,
PS - anyone ever documented this before?
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>
void _stdcall AlterVertex(D3DTLVERTEX &v);
And the function would be declared in VB as:
Declare Sub AlterVertex Lib "DLL" (ByRef Vertex as D3DTLVERTEX)
Also, shouldn''t there be a __declspec(dllexport) on the C++ function. Since functions are bound only when they are called, you wouldn''t get an error until calling the function. If the function isn''t exported from the DLL, then VB won''t be able to find the function in the DLL and thus give you that error message.
Another thing I have noticed is that some compilers will mangle the function name. Check to see if function name isn''t something like _AlterVertex. QuikView will allow you to check if the function is exported and the actual name.
To move them into alignment I used
XPos=x*a-y*b
YPos=x*c+y*d
(same fomula used to rotate 2-d except without sine and cosine)
where a,b,c and d are caculated based on whatever tile you''re using. They''re usually a muliple of some number.
d is the base number
a=d*4
b=d*2
c=d*3
I also have a QuickBASIC demo of a wire-frame track that you can "drive" around. The car always goes up and the track rotates around it. If that''s sort of what you''re trying to do.
Also a demo with filled squares that you can walk around. The floor rotates and the player can move in four directions if I remember correctly. Been awhile. It''s also in QuickBASIC.
If you''re interested in the source to any of those let me know. I use BASIC for testing things quickly and easily. The source can be easily ported to any language.
Ben
My stooopid mistake - I declared it in VB as "function" when it should be "Sub"... whoops.
Now works fine...
Second, the ISO thing...
All I do is generate a normal 2D grid using TLVertices, then rotate it by 45 degrees... the demo sounds cool, but I''ve never used QBasic, jumped into VB4 about 3 years ago, then VC++5 about 1 year ago..
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>