Friday, December 10, 2004

More TPointer

More important things about TPointers.

* They operate automatically (as do all TRays). Put one in the scene graph and it picks every render cycle.

* Once TPointer has selected an object, it will not test any other items unless they are closer that the currently selected object.

* There is something special about the TPointer attached to the TAvatar that allows it to actually interact with objects in the scene. This has to do with replicated vs non-replicated picking....need to know more about this.

TPointer & Event Processing...

I have been learning about the Croquet event processing loop, in my attempt to get a pickable overhead view.

1) It all starts with Squeak and Morphic. The TeapotMorph is just another morph as far as Squeak is concerned. By default it registers itself for the full compliment of mouse and keyboard events.

2) I haven't fully groked Squeaks focus handling. Sometimes it uses mouse-over, sometimes it is click-to-focus. Unfortunately, click-to-focus does not seem to work on the TeaportMorph and keystrokes continue to go to the last selected morph. You can force it by putting this in a mouse event:
ActiveHand keyboardFocus: teaportMorph.

3) The TeapotMorph's default behavior is to route all it's events to it's activeCamera, which is a TUserCamera. The interesting call for me is camera >> pointerXY: evt position. This takes the viewpoint coordinates of the mouse and updates the TPointer that is attached to the userCamera.

Tuesday, December 07, 2004


We now have a working simple MPEG movie player in our Croquet Gallery. It would have been very easy to just embed one of the the two morphic players in a TMorphMonitor, but we have decided to go 100% Moph-free wheneven possible. The winning stratagy was to have the player be a subclass of TRectangle with a texture, and the MPEGFile object's videoReadFrameInto on that texture's form.

Interesting/Weird Stuff:
1) The default TMaterial causes my player to be completely invisible. Setting the material's ambiant alpha to 1.0 is a must.

2) The MPEGDisplayMorph has code that looks like it is sync'ing the video with the soundtrack, but it is not. It's just making an estimate based on when the soundtrack started playing & how much time has passed, which is why it does not handle pause. I keep my own starttime & reset it on pause.

3) Squeaks mpeg player seems to choke on some of our mpegs. Chopping them up into smaller segments makes it happier. But chopping involved re-encoding, so who knows.

4) I experimented with rendering the video on render vs step. Putting it in render does get more video frames on the screen (on my computer I average every 3rd frame in step and every 2nd frame in render), but the video is very jittery when done in render, which surprises me. Why would one render cycle take a different amount of time than the next?