Sunday, May 27, 2012

Lessons learned

I was finally able to test the panel generator code, and there was some glitches, nothing outside of my bounds though.
First most, using "==" to compare strings doesn't work. It apparently compares where the strings are located instead of their values. So, by using StringA.equals(StringB), it properly compares the names.
Second, using getPixel() and setPixel() are VERY slow. I should have known this from my C# days. So now each unique image is converted to an int[] and saved. Then that array is used each time a new panel is needed.
And lastly, creating a new array of panels for each spool was stupid and slow. Now, each spool has panels already applied to it. After all, it's not like a spool will have less panels than it's max number of panel slots.


Now, the problem I'm having is accessing each object in the loaded model. Previously when each model was just one object, I didn't care about the object's name...now it's one of those important things. When loading the objects, the engine seems to like naming each object something besides it's actual name. I've already sent a message to the developer of how to fix this problem, hopefully the reply will be quick :-/.

Till then, I'll work up some hacky and use assumed places (modeled after the obj's file object placements). After I get this workaround finished, the panel generator should be complete and I'll be able to get my first screenshot of generated panels :-).


Here is some finally good news though, I know how to fix the camera problem :-D. The reel will be on an angle and the camera will be facing it directly and move left/right. The difference is that there will be an invisible object (named cPoint) which will move across the reel (not attached to it, just along it). it's pivot point will be 0,0,0 (the same as the reel's pivot point). Each time the camera wants to move, it will un-rotate cPoint, move it left/right, rotate it back, move the camera left/right, then adjust the camera's z by using cPoint's z value + some number. Damn, I can't wait till the panel upgrade code is finished so I can test this. It's been bugging me for the last 2 weeks (and these weeks have been very long).

No comments:

Post a Comment