Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, VoroneTZ), 1,485 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: various MDL related MDL7 SDK questions [Re: HeelX] #394075
02/09/12 19:56
02/09/12 19:56
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
It's unrelated to the SDK, but a requirement by engine functions that accept both char* and STRING*. They detect the difference through the STRING index, but this requires the char* to be at least 4 bytes in length.

Re: various MDL related MDL7 SDK questions [Re: jcl] #394086
02/09/12 22:15
02/09/12 22:15
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
So, what happens when I use the index to get the name "#0" with ent_bonehandle into a STRING* and pass that STRING* to ent_bonemove??

Re: various MDL related MDL7 SDK questions [Re: HeelX] #394149
02/10/12 15:46
02/10/12 15:46
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
That would work, the 4-bytes restriction is for char* only.

Re: various MDL related MDL7 SDK questions [Re: jcl] #395091
02/19/12 19:29
02/19/12 19:29
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
6) Are the normals stored with the Z-axis as the up-vector?

7) This is not directly a SDK related question: How are you calculating the center of a model in MED (Edit\Transform Global\Center Model)? --- I wrote for my dll a function for that and I simply sum up the vertex positions and divide by the number of vertices; but the model is still moved around when I hit the "center model" button in MED...

Here is some code:

Code:
DLLFUNC VECTOR* mdl_center (Mdl* m, BOOL centerx, BOOL centery, BOOL centerz)
{
    if (m)
    {
        int n = 0;

        VECTOR sum;
        vec_fill(&sum, 0);

        for (int i = 0; i < mdl_groups(m); i++)
        {
            MdlGroup* g = mdl_group(m, i);
            for (int j = 0; j < mdl_groupvertices(g); j++)
            {
                MdlVertex* v = mdl_groupvertex(g, j);
                vec_add(&sum, mdl_vertexpos(v));

                n++;
            }
        }

        if (n > 0)
        {
            sum.x = _VAR(_FLOAT(sum.x) / (float)n);
            sum.y = _VAR(_FLOAT(sum.y) / (float)n);
            sum.z = _VAR(_FLOAT(sum.z) / (float)n);

            mdl_move(m, centerx ? -_FLOAT(sum.x) : 0,
                        centery ? -_FLOAT(sum.y) : 0,
                        centerz ? -_FLOAT(sum.z) : 0);

            return(vector(sum.x, sum.y, sum.z));
        }
        else
            return(NULL);
    }
    else
        return(NULL);
}



Last edited by HeelX; 02/19/12 19:32.
Re: various MDL related MDL7 SDK questions [Re: HeelX] #395177
02/20/12 16:34
02/20/12 16:34
Joined: Apr 2010
Posts: 172
W
wdlmaster Offline
Member
wdlmaster  Offline
Member
W

Joined: Apr 2010
Posts: 172
Quote:
How are you calculating the center of a model in MED

By taking the outer most vertices (like a bounding box) ...

Page 3 of 3 1 2 3

Moderated by  old_bill, Tobias 

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