07-20-2007, 09:55 AM,
|
|
rookie1
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
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 Grin Big Grin](https://www.vdrift.net/Forum/images/smilies/biggrin.gif) raw2DRotation() to draw 2d texture with a rotation value. It's similar to UTILITY: ![Big Grin Big Grin](https://www.vdrift.net/Forum/images/smilies/biggrin.gif) raw2D() with an additional parameter for rotation.
Code: SCENENODE &rotatenode = parentnode->AddNode();
//rotate this scenenode
QUATERNION q;
q.Rotate(r, 0,1,0);
rotatenode.GetTransform().SetRotation(q);
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:23 AM,
|
|
rookie1
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
I've tried both Y and Z axis, same result.
|
|
07-25-2007, 11:36 PM,
|
|
kidrock
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 230
Threads: 17
Joined: Apr 2007
|
|
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](https://www.vdrift.net/Forum/images/smilies/biggrin.gif) )
|
|
07-27-2007, 11:11 AM,
|
|
bugsyv
Junior Member
![*](images/star.png) ![*](images/star.png)
|
Posts: 46
Threads: 6
Joined: May 2007
|
|
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-30-2007, 07:41 AM,
|
|
bugsyv
Junior Member
![*](images/star.png) ![*](images/star.png)
|
Posts: 46
Threads: 6
Joined: May 2007
|
|
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
Code: memcpy(&x, &(other.x), sizeof(float) * 3 );
to a more mundane
Code: 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 Smile](https://www.vdrift.net/Forum/images/smilies/smile.gif) ).
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,
|
|
joevenzon
Administrator
![*](images/star.png) ![*](images/star.png) ![*](images/star.png) ![*](images/star.png) ![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 2,679
Threads: 52
Joined: Jun 2005
|
|
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:
Code: memcpy(this, &(other), sizeof(VERTEX) );
Does that fix things for you?
|
|
07-31-2007, 09:56 AM,
|
|
bugsyv
Junior Member
![*](images/star.png) ![*](images/star.png)
|
Posts: 46
Threads: 6
Joined: May 2007
|
|
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.
Thanks!
|
|
|