Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fixing tacho band and needles in HUD
07-20-2007, 09:55 AM,
Fixing tacho band and needles in HUD
I'm trying to fix the missing tacho band and needles in HUD. My change is in revision 1777. It's not working yet.

What I have done is added a function UTILITY:Big Grinraw2DRotation() to draw 2d texture with a rotation value. It's similar to UTILITY:Big Grinraw2D() with an additional parameter for rotation.
SCENENODE &rotatenode = parentnode->AddNode();

                //rotate this scenenode
                QUATERNION q;
                q.Rotate(r, 0,1,0);

I've only changed the tacho band drawing code to test this new function. But it seems the rotation has no effect at all. Is my use of scenenode and transformation correct?
07-20-2007, 10:15 AM,
Hmm... that looks correct to me. I'll have to take a look at this more later to figure out what's going on. Try rotating on the Z axis instead of the Y.
07-20-2007, 10:23 AM,
I've tried both Y and Z axis, same result.
07-20-2007, 10:19 PM,
Okay, I fixed this in R1778. Turns out I wasn't bothering to transform 2d scenegraph elements when they're drawn inside the GRAPHICS class. Note that if you want the rotation to be about a specific point (such as the center) you should build the 2d rectangle about 0,0,0 then add the rotation and translation.
07-20-2007, 11:35 PM,
Okay, R1779 should work as you'd expect. You can use the Draw2DRotation function like normal now. Be aware, though, that I removed the transform node, and instead just transform the vertices manually when the object is created. This should actually be faster, because the object is only created once (if you draw it every frame), but was kind of just an arbitrary design decision.
07-20-2007, 11:50 PM,
In R1780 I changed Draw2DRotation to be just another overload of Draw2D instead, so be aware.
07-21-2007, 02:52 AM,
Thanks Joe. I went ahead and fixed the tacho band, red band and all the needles in HUD now (r1781). Smile
07-21-2007, 11:34 AM,
07-21-2007, 03:56 PM,
Nice thing. thanks! Smile
07-25-2007, 11:36 PM,
Yay now i can drive manually! (kind of hard to do so with no visual or sound)(when is sound going to be fixed on PPC anyway?)

99 (one more to 100) Big Grin Big Grin )
07-27-2007, 11:11 AM,
kidrock Wrote:Yay now i can drive manually! (kind of hard to do so with no visual or sound)(when is sound going to be fixed on PPC anyway?)

Interesting... you can use the application? PPC? OSX 10.4? What kind of video card do you have? Since the fix to the tacho needles, all my menus are offset in the y direction by half a screen. And the cursor won't move off the bottom edge of the screen. I'm not absolutely current, but by looking at the logs, this issue doesn't seem to be addressed.

Anyways, I was planning on investigating after I finished some build-system stuff, but I am trying to figure out why this behavior hasn't been reported yet.
07-28-2007, 10:42 PM,
Quote:all my menus are offset in the y direction by half a screen

If you don't figure it out, can you post a screenshot?
07-30-2007, 07:41 AM,
Well... I've got a fix, but I can't say I really "figured it out". It doesn't make much sense to me.

The problem is that on my machine, VERTEX::Set(const VERTEX&) doesn't seem to work reliably. The funny thing is when I tried to inject printfs to see exactly what was happening, the particular display I was investigating would magically correct itself. It doesn't matter what the printf was.

if I change the implementation from
memcpy(&x, &(other.x), sizeof(float) * 3 );
to a more mundane
x = other.x;
y = other.y;
z = other.z;
Then the offset problem I was seeing goes away. This also seems to fix problems with the needle rotation, track dispaly ( I was seeing many missing segments ), and crashes that were happening when I run off the road ( it happens a lot Smile ).

The only thing that I can come up with is that many there is some bug in my memcpy implementation or it is configure to run asynchronously or something ( crazy talk, I know ).

Anyways, I was wondering if there is any objection to checking this in. I would conditionally compile it, but I can't think of what to switch on.
07-30-2007, 11:25 PM,
Maybe on your platform it wasn't putting x at the beginning of the data. The reason I use memcpy is because it's faster than three assignments, and this function gets called a LOT. Can you try changing it to something like this:
memcpy(this, &(other), sizeof(VERTEX) );
Does that fix things for you?
07-31-2007, 09:56 AM,
I had thought the order of members in the class might have been a cause, but that wouldn't explain the printf statements correcting the problem. In any case, your suggestion also seems to solve the issue.

I had figured the implementation was a performance enhancement and is why I did not check in my fix immediately. Anyways I got to wondering about which approach would actually be faster... surely, function call overhead would negate any performance benefits fancy assembly code in memcpy got you. However, I ran some tests, and over 1 billion iterations the memcpy is 2 seconds faster than the three assignments ( 23 vs 21 ) on my machine.

So... I was wrong. Anyways, I'll leave the code change in my local copy until the repository is updated.


Forum Jump:

Users browsing this thread: 1 Guest(s)