PuppetInitialize
routinepascal ComponentResult PTBlockyPuppetInitialize(PTBLPrivateGlobals** storage, ComponentInstance aConductor) { TQ3GroupObject aGroup = nil; TQ3GeometryObject myBox; TQ3BoxData myBoxData; TQ3SetObject faces[6]; short face; TQ3ColorRGB faceColor; TQ3ColorRGB faceSeeThru; ComponentResult anError; anError = PuppetInitialize((**storage).delegate, aConductor); anError = PuppetGetGroupObject((**storage).target, &aGroup); // set up the colored faces for the box data myBoxData.faceAttributeSet = faces; myBoxData.boxAttributeSet = nil; // set up some color information faceColor.r = faceColor.g = faceColor.b = 0.8; faceSeeThru.r = kNoteTransparency; faceSeeThru.g = kNoteTransparency; faceSeeThru.b = kNoteTransparency; for (face = 0; face < 6; face++) { myBoxData.faceAttributeSet[face] = Q3AttributeSet_New(); ::Q3AttributeSet_Add(myBoxData.faceAttributeSet[face], kQ3AttributeTypeDiffuseColor, &faceColor); ::Q3AttributeSet_Add(myBoxData.faceAttributeSet[face], kQ3AttributeTypeTransparencyColor, &faceSeeThru); } // set up te basic properties of the box ::Q3Point3D_Set(&myBoxData.origin, 0, -(6 * kNoteSize), 0); ::Q3Vector3D_Set(&myBoxData.orientation, 0, 12 * kNoteSize, 0); ::Q3Vector3D_Set(&myBoxData.majorAxis, 0, 0, kNoteLength); ::Q3Vector3D_Set(&myBoxData.minorAxis, kNoteWidth, 0, 0); // create the box itself myBox = ::Q3Box_New(&myBoxData); ::Q3Group_AddObject(aGroup, myBox); ::Q3Object_Dispose(myBox); // dispose of the objects we created here for( face = 0; face < 6; face++) { if (myBoxData.faceAttributeSet[face] != nil) ::Q3Object_Dispose(myBoxData.faceAttributeSet[face]); } return anError; }