Question difference in normal graphics and D3d9

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
So why do somethings work great in normal graphics but run it in d3d9. They don't work? for instance in regular graphics the lander from the Endurance space system has a rotating chair. but in d3d9 the chair doesn't animate. Same code.
Code:
if (chairrot == 1)    {
        VECTOR3 weight_v;
        GetWeightVector(weight_v);

        double const current_g = MAGNETUDE(weight_v) / GetMass();
        double const angle = ((current_g < 0.98) ? PI : atan2(weight_v.x, weight_v.y));
        double const radians = (angle / PI);
        {
            double const anim = 1 - abs(((radians < 0) ? -0.5 : 0.5) + abs(radians / 2));
            SetAnimation(anim_PILOTCHAIR, anim);
            SetAnimation(anim_COPILOTCHAIR, anim);

            sprintf(oapiDebugString(), "chairrot %d; anim %lf;", chairrot, anim);


        }
    }
I can see the anim change but the anim_PILOTCHAIR isn't moving in d3d9
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,870
Reaction score
2,867
Points
188
Website
github.com
You should read the documentation of SetAnimation(), especially the part about argument limits...
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
documents in d3d9? if it matters this is happening in 2010.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,870
Reaction score
2,867
Points
188
Website
github.com
documents in d3d9? if it matters this is happening in 2010.

My guess is that this isn't related to graphics engines or Orbiter versions, but to the value of "anim": it has to be between 0 and 1. If it is outside that range... well, some weird thing might happen, or it might crash, or it might not animate, and what happens can easily be different in MOGE and D3D9.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
Ok. yes the animation state is between 0 and 1. But I works in normal graphics but not in D3d9?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
Thanks. Checking it. Now I get a CTD on rotattion. in the log:
Finished initialising status
Finished initialising camera
D3D9Surface.cpp Line:1487 Error:-2005530516 pDevice->UpdateSurface(pTemp, NULL, pSurf, NULL)
Finished initialising panels
Finished setting up render state
D3D9Client: [Scene Initialized]
 
Top