Croquet-Teapot


Croquet-Teapot Comment
TAttractor
TAttractor is a gravitational source.
TAvatar
TAvatar is the view the user presents of himself in a space. 
TBillboard
TBillboard always points toward the current camera allowing for such effects as a 2D billboard (if you add a textured rectangle to the frame).
TBoundSphere
This is the main bounds test object. It is used for object culling against view planes, ray testing, and for collision detection. It is defined heirarchically for the collision detection and object picking algorithms. 

Things to do:

	Add bidirectional boundsphere references to an octree.
	
TBox
TBox has a number of uses. It is an axis aligned bounding box (AABB) defined by two 3D corners. It is used by the TBoundSphere to help define the boundSphere tree. 
TButton
TButton is an active frame that tracks user events to initiate actions. When the user's pointer is over a child frame of a TButton it is highlighted. When it is clicked, a message can be sent to a target. TButton can have two different child frames to show a boolean state.
TButtonHolder
TButtonHolder contains and positions TButtons in a 2D surface.
TCamera
The z value of the camera matrix actually points away from the direction of view. This seems to be a standard approach for OpenGL. 

instance variables:

viewPort
Typically the underlying morph in this implementation. Any valid OpenGL buffer should work.
	
bounds
Usually nil, which means that its actual value will be derived from the bounds of the current viewPort. bounds is the area that is rendered into. You can set this (#bounds:) to have an explicit hard value.

viewAngle
This is the view angle of the camera measured top to bottom. The default is 45 degrees, which means that the angle of the top and bottom edges of the rendered image are 45 degrees apart.

zNear, zFar
The near and far clipping planes in the graphics engine.

zScreen
This is the z distance from the camera that the virtual screen would be. That is, when you have an x,y location on the real screen, you can add the zScreen value (x,y,zScreen) and normalize which gives you an accurate pointing vector in 3D space.

length
Computed by initClipPlanes and used to render the test camera.

clipPlanes, clipPlanesTransform
clipPlanes are the four frustum clip planes defined in the cameras local orientation.
clipPlanesTransform are the four clipPlanes in the cameras global orientation frame. This is what is used to determine if objects are visible inside of the view frustum.

viewClip 
This is used to test the visibility culling of the camera. It makes the clipping planes visible. This is obsolete, but it may be useful again if we ever start playing with the object clipping code again. 

portalClip
This is an additional clip plane defined by a portal. Objects on the near side of the portal need to be clipped away as well. This is a 4x4 transform.

portalPlane
This is a 3D vector calculated from the portalClip.

inPortal
A flag indicating whether we are rendering a portals contents from this camera or not. This is used to supress certain tests (such as finding floors), and to determine that the avatar should or should not be rendered.

texture
Simply a texture that gets added to the default rendered camera. Not used anymore unless you really need to see the default camera.

killFrame
A flag to indicate that the current rendered image is junk and should not be rendered. This suppresses a swapBuffers call.

goToPortal, goToPortalTransform
When a camera is moved through a portal into a new space, the new portal is set in goToPortal and the new transform inside the new space. Actually, goToPortal can be any valid frame, we are only looking for the root frame.
goToTransform is the global transform that the camera is moved to in the new world. See #skidoo for actual use.

lookAt, lookUp
Vectors that are computed from the global transform. They are the z-vector emerging from the camera in the center of the screen, and the y vector pointing straight up from the cameras view. These are useful for creating new objects directly in front of the camera.

renderInterval
Defines the time between renderings in milliseconds.









 
TCrosshair
This is a small crosshair in the center ofthe camera field of view.
TCube
TCube generates and renders a simple cube.
TCylinder
TCylinder generates an OGL generalized cylinder (cone).
TEditBox
TEditBox is used to manipulate and position a contained object in 3D space.
TForm
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.
TFrame
The TFrame class is designed as a heirarchical transformation frame. The rendering engine walks through the frame, performing the appropriate transformation associated with it, then it calls the render methods of the tObjects. Two passes are made through the frame heirarchy. The first is for non-alpha objects, the second for alpha. The base frame is owned by a TSpace object. We render from the root up because we want to minimize setting transforms.


" ***** This is how you rotate an object using a quaternion ball. The base position is stored in the selectedPoint and compared with the pointer selectedPoint.
	pointer event2D shiftPressed ifTrue:[
		pointer frame: self pickSphere: B3DVector3 new radiusSquared: selectedRadiusSquared.
		spin _ self rotFromBallPoints: selectedPoint to: pointer selectedPoint.
		trans _ self translation.
		self translationX: 0.0 y:0.0 z:0.0.
		self localTransform: (self localTransform composeWith: spin).
		self translation: trans.
		]"
" ***** This is how you move an object relative to a specified plane. In this case, it is the plane determined by either the camera or the surface normal when the object is selected. 
	- cameraNorm defines the plane perpendicular to the line of sight of the camera
	- selectedNorm defines the norm of the selected surface of the object.
	- slab frontNorm forces a normal to the front of the slab (for example).
	ifFalse:[
	(pointer frame: self pickPlane: selectedPoint normal: cameraNorm) ifTrue:[
		delta _ selectedPoint - pointer selectedPoint.
		self translation: (self translation - (self orientation localPointToGlobal: delta)).
		^ true.].]."
	^ false.
TGroup
TGroup is a TFrame which is always guaranteed to be invisible. It is used as a container and root object of a collection of child frames.
THandMorph
THandMorph is a HandMorph with a number of small changes to make it work better in the Croquet context such as turning off hardware support for the cursor.
TLaser
TLaser is used by the TUserCamera to show other users what this user is currently pointing at or manipulating.
TLeaf
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.
TLight
TLight

- Spaces. Each space can contain any number of lights, but only the closest eight are actually enabled, with the furthest two linearly fading depending upon distance ratios. The limit of eight lights is a hard coded issue with OpenGL. The lights and their frames are stored in an array in the TSpace object. When a TSpace is rendered, it activates the lights first.

- Visibility. Lights are render objects that can be visible or not. This is to help in placing them. A visible light is represented either with a TSphere for positional, a TCylinder for spot, or two TCylinders for directional. These objects are rendered with an alpha value in the color of the light. 

- Locality. A light can be applied only to a frame and its children by setting local to true. Otherwise, it is global to the containing space.

- Attenutation. This assumes constant attenuation for performance reasons.


Things to do:

	- Need to utilize material types for rendering light objects.
TLinedCylinder
Like TCylinder, but with its "lining" surface rendered the same as its outside surface.
TLoad3DSMax
TLoad3DSMax Notes:

There are two parts to the class - the parse routines and everything else. The actual #parse: method creates a block hierarchy - essentially a kind of parse tree, from the inputs. 3DS is somewhat regular in its construction, but there are a few things to be careful about. The tree that gets constructed is made up of a field name and a field. The field names are tokenized 3DS field names and the field is the child tree or the actual text field data - not parsed into actual numbers or anything yet. One improvement on performance might be to interleave this step with the next.

Once the tree exists, a second pass is made that converts the text fields and constructs the actual frame hierarchy. The field name of each node is matched and the appropriate #make****: routine is called on its contents. 

Once a raw mesh is set up inside the #makeGeometry: method, the #reconstruct: method is called. This does a lot of massaging and optimization of the raw vertices - including aliasing, etc. 

Anyway, start at:
	#initialize: fileName: scale: shadeAngle: textureMode: 

Based upon the field names in the tree constructed in #parse: you just make the call to the next #makeXXX:.

- Though we have all of the transforms for the heirarchy, the actual locations of the meshes is already transformed. If I can think of a good reason to un-transform the mesh elements and then add the transform to the actual frame, I will do it. For now, treat it as a solid body.

- The texture rotations are face centered. This requires an offset of 0.5, the rotation, and then putting it back. Not sure if I really want to pre-transform the texture uv coordinates. Also, not sure if this is already done, as the meshes are.

- This class will act as a template for importers, though they all seem so different that this may be easier said than done.
TLoadMDL
TLoadMDL is used to load Alice models.
TMaterial
TMaterial is used to maintain and set material properties of objects. It can also be rendered itself to aid the design of the material. It displays the canonical teapot when used this way.
TMesh
das 10/7/2002 11:49

TMesh
Almost all simple arrays are 0 based when indexed by other arrays. Not the materialList.

materialList - this is an OrderedCollection of materials that are used in the mesh. This is what the first element of the faceGroups refers to. This must always be a list.
alias - you can ignore this for now. It is important when we start doing mesh based transforms, because it tells you where the aliased vertices are.
vertices - 0 index based list of 3D vertices.
vtxNormals - the normal 3D vector for the given vertex.
alpha - checks the materials referenced by the facegroups for alpha values. Calculated for you based upon the materialList.
opaque  - same as alpha, but inverted.
textureUV - the 2D u,v coordinates of the texture at the associated vertex.
faceGroups - an array of materialList index (indexing starting at 1), and vertex face index arrays (index starting at 0). These are simply interleaved. 
boundsChanged - calculated for you at construction time. 
boundSphere - calculated for you.
boundsDepth - part of construction and used to determine the depth of the hierarchy.
boundMaterial - only used if you need to see the bound spheres or bound cubes.

These are the analogs to the equivalent TPrimitives. There are two sets because a TMesh may have some materials that have alpha components and some that don't. These are rendered at different times, so they need separate display lists.
glListID 
glListAlphaID 
glListValid 
glListAlphaValid 
glListEnabled
TOverlayButtons
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.
TOverlayRearView
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.
TParticle
TParticle

This is a very simple particle system.


size - the length or the particle array, determines max number of particles.
pPosition - B3DVector3Array of particle positions
pVelocity - B3DVector3Array of particle velocities
pAcceleration - B3DVector3Array of particle accelerations
pLifetime - number of seconds (floating point) of life that each particle has left
positionRange - the TBox within which new particles get created (see TBox >> #atRandom:)
velocityRange - the 3D velocity range within which the new particles start life.
accelerationRange - the 3D acceleration range applied to each particle on creation.
lifetimeRange - the lifespan range of each particle.
lastTime - for #the stepAt: method, used to determine time between this and the last cycle.
material - what color are the particles.

To use the particle system you do the following:

	ps _ TParticle initialize: ogl size: 1000
	ps setPositionRangeMin:(-0.1@-0.1@-0.1) max: (0.1@0.1@0.1).
	ps setVelocityRangeMin:(-1.2@6.4@-1.2) max:(1.2@9.6@1.2).
	ps setAccelerationRangeMin:(0@-10@0) max:(0@-8@0).
	ps setLifetimeRange: (1500 to: 2000).

These values are called inside of the initialize method, but this is how you would set your one.
TParticleTxtr
TParticleTxtr is a textured particle.
TPatch
Used to generate and maintain Bezier patches. See TTeapot for its usage.
TPhysicsEngine
Early physics engine. Much more to do.
TPointer
The TPointer object is the user pointer control. It is used to communicate user requests to the components. It is a subclassed TRay. The variables it uses are:

camera - this is the camera that the pointer is attached to. 
event2d - just the morphic event being passed in if we are working with a TMorph texture.
pointerXY - is the 2d location of the mouse.
keySelectedObject - if we pressed a key over an object, this keeps track of same
isDown - indicates that the mouse button is currently being pressed.
tool - a user tool, pretty minimal at the moment. Ultimately, the user will be able to pick up new tools and wield them.
TPortal
TPortal is used to connect and see between TSpace objects. A TPortal has a link to another TPortal which in turn is embedded in another space. If the TPortal is linked back to itself, which is the default, it is treated as a mirror.
TPortal3D
TPortal3D are a kind of 3D portal. They render a miniature version of a space (or a subset of it). The content of this portal can be manipulated normally.


TPrimitive
TPrimitive is the base class of a lot of the simple classes such as TCube, TSphere, TRectangle. It is primarily used to help manage graphics caching.
TPrimitiveMesh
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.
TPrimitiveString
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.
TPrimitiveText
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.
TQuad
TQuad is a TPrimitive used to render four sided objects.
TQuadTree
TQuadTree

This is a spatial "loose" quadtree. It is used for fast visibility and collision detection.

A loose octree/quadtree is one where an object is contained in only one octree cell. This cell is smallest cell that can completely contain the object, and the one that contains the "center" of the object. In our case, the one that contains the center of the bound sphere. The object is allowed to overlap onto adjacent cells, thus when we test for collisions, we need to compare to the current cell and all of its adjacents. The advantage is significantly simpler and faster bookkeeping.

To use the TQuadTree just use the initialize method:

#initializeWithSpace: space frame: frame.

This will figure out the proper size of the quadtree from the elements inside of frame and it will place the TBoundSpheres into their proper slots. Then just add the TQuadTree to another frame, usually the TSpace, and you are done.

TRay tests only work if the TRay is a downRay.

DAS
TRay
TRay specifies a position and orientation, usually inherited from it's parent TFrame. Though you can modify this. It is used to determine the closest object in a particular direction and the distance to that object. 

This is a factored TPointer change set. The new TRay class is concerned only with picking an object, while the new TPointer class is a subclass of TRay, but includes the events model. This means that the TCamera uses a TRay for the downPointer, and it also makes it easier to use a TRay for arbitrary objects looking for the floor. I also completely rewrote the actual matrix math. Essentially, a TRay is a TFrame with the ability to pick. Now it actually uses the local and global orientation matrices to perform the test. 

TRay tests are fairly expensive, so be careful with them. Also, I don't think you want to use a translation with them. I think more work needs to be done to make this robust.

The way a TRay works is you simply place it as a child frame, and it will automatically get called at the next render loop. You can use it directly by calling the following methods:

#pointerPick: or 
#pointerPickFloor: 

with a TBoundSphere as the argument (which in turn points to a TFrame) as the argument. If the return is true, then the TRay intersected the object.

You can also call one of the #frame:xxxx:xxxx: messages if you know the type of object you are attempting to select. If you wish to check a number of objects and keep only the closest, call the message #testDistance:false. Make sure you call #testDistance: true when you are done.

The following variables are for internal use only:
	framePointer - is the ray orientation relative to the object we are testing against.
	framePosition - is the ray location relative to the object we are testing against.
	sphereDistSquared - is the distance to the recently tested sphere. 
	currentFrame - this is the frame we are currently testing against.
	doSelect - turns the selection of the TRay on/off. This is used by the TPointer to keep the pointer from selecting other objects between a mouseDown/mouseUp.
	testDistance - a boolean that allows us to ignore the current distance when testing for object intersection. It is used when the user needs to determine intersection and to a specific object.
	downRay - boolean indicates whether this is a floor test ray or not.
	automatic - indicates whether a ray is tested automatically during rendering.
The following variables are for external use:

	selectedObject - this is the object that owns the selected object. It may be the same, but doesn't have to be.
	selectedFrame - this is the frame object that is selected.
	selectedFramePosition - this is the ray location relative to the selected object.
	selectedParent - this is the parent of the selectedFrame at the time of rendering/selection.
	selectedIndex - this may be used by the selectedObject. It is usually the surface index.
	selectedPoint - this is the selected point in the local selectedFrame reference.
	selectedNormal - this is the surface normal at the selectedPoint.
	selectedDistance - this is the distance from the ray position.
	selectedDistanceSquared - this is the squared distance from the ray position.
	
	lastSelectedObject - previously completed selectedObject
	lastSelectedFrame - previously completed selectedFrame
	lastSelectedPoint - previously completed selectedPoint
TRectangle
TRectangle is a TPrimitive used to render rectangles.
TRenderAlpha
This class is used to render the alpha (transparent) objects. As an alpha object is found, a TRenderAlpha object is created that includes:
	- the object
	- its parent frame (if needed - probably not)
	- its current world transform, which is used to transform the object into world coordinates.
	- the distance from the camera. This is used to sort the alpha objects when it is rendered later.
TRigidBody
TRigidBody is the core of the rigid body physics engine. It is itself a TFrame. At initialization, it is handed another frame, which presumably is some kind of mesh that can calculate its own inertia tensor. The TRigidBody is then installed into TPhysicsEngine, a physics engine which is responsible for updating it's state. This engine is designed to be independent of object position and orientation. It uses the current state of the frame and the current velocity and angular momentum to determine how the state will change. This does mean that if the object is currently undergoing a physical transform as it is being moved, it will continue to do so. 
TSelection
TSelection is the information of the selected object created by the TRay/TPointer.
TSelectionTracker
I am an example for simple selection tracking.
TSkyBox
TSkyBox is used to render a slowly rotating sky in the world.
TSnapshot
TSnapshot

This class holds a location and orientation inside of a TSpace for later use. It also generates a thumbnail from this location. This class can be used as a far portal, particularly if there is no far frame to be attached to.
TSpace
A TSpace object acts as the root render frame. It is the ultimate container, and is the entry point to a render tree. TSpace objects are contained in CroquetPlace objects, and can be linked via portals. 

croquetPlace - the CroquetPlace object that this TSpace belongs to.
color - the default color of the space. This is the color you see when there are no objects to render.
lightFrames - an OrderedCollection of all of the TLights in the hierarchy inside of this space.
portalFrames - an OrderedCollection of all ofthe TPortals in the hierarchy inside ofthis space.
rayFrames - an OrderedCollection of all of the TRays in the hierarchy inside of this space.
alphaObjects - a temporay OrderedCollection of the alpha objects to be drawn in each rendered frame.
currentParent - the current parent object of the frame being rendered. This is used for instanced objects.
currentTransform - the current transform of the frame.
cullBackFaces - this is a flag to turn this on and off for everything in the space.
fogOn fogStart fogEnd fogDensity - fog state variables.
ambientSound - current local sound - to be deprecated.
locator - url object.
dropInFrame

viewingParticipants - participants currently viewing (rendering) the space, directly or
	through portals they view the space from.
	viewingParticipants should be members of the tea party of every object in the space
	and all of the spaces visible through portals.  When a new viewingParticipant is added
	we walk through all the frames in the space, telling them about the new participant.
	When a new child is added, we first tell it about all of the participants that are viewing
	the space containing it, so it can ensure that participant is in its tea party. 
TSpaceImposter
TSpaceImposter

This class is used as a place holder for a complete space when it is viewed through a portal. It is a portal connected to a TSpace containing only a cube where the surfaces are rendered from the position of the connected frame. This gives the portal a true 3D effect without having to transfer the entire world.
TSpeaker
TSpeaker is used to show that an avatar has voice chat enabled and the voice speaker volume.
TSpellBox
TSpellBox is a test object used to allow the pointer to select a tool.
TSphere
TSphere is a TPrimitive used to render a sphere.

DAS
TTeapot
Standard Utah teapot. Used primarily for testing.
TTensor
The algorithm used by this class was first developed by Brian Mirtich as described in:
Brian Mirtich. Fast and accurate computation of polyhedral mass properties
Journal of Graphics Tools, 1(2): 31-50, 1996

This class will construct an inertia tensor. There are two initialize routines, one to specify mass, the other density. The class allows you to add any number of groups of faces and then calculate and return the results. There are two main return values - the tensor (tensor), a B3DMatrix4x4 and a center of mass (centerMass), a B3DVector3. Both of these values are available after the TTensor >> result message is sent.

 it _ TTensor new initializeMass: mass. " or use it _ TTensor new initializeDensity: density."

"Add any number of groups of faces. This allows for disjoint or complex vertex/face groups. Remember that everything added is treated as a single rigid body."

it addFaces: f1 vertices: v1.
it addFaces: f2 vertices: v2.
it addFaces: f3 vertices: v3.

inertiaTensor _ it result.
inertiaTensor _ it tensor.
centerofmass _ it centerMass.
TTexture
This is used to create a GL texture from a form, either directly or from a file.

This is dependent upon the TForm class, which handles the actual bits.

DAS
TTorus
A torus shape primitive.
TTriangle
TTriangle is a TPrimitive used to render triangles.

This creates and renders your simple OpenGL triangle. Usually used for testing, but you have to start somewhere...
TUserCamera
TUserCamera is a TCamera that is used by the user to manipulate his position in space and render same.
TWidget
TWidget is primarily used to load meshes that may be used as frames in TButtons. It sets up a number of properties such as initial materials and texture modes.
TWirePortal
Main comment stating the purpose of this class and relevant relationship to other classes.

Possible useful expressions for doIt or printIt.

Structure:
 instVar1		type -- comment about the purpose of instVar1
 instVar2		type -- comment about the purpose of instVar2

Any further useful comments about the general approach of this implementation.

^top


- made by Dandelion -