// Recursive Object Macros - Create an object comprised of copies of the whole! #declare RO_Pos = array[100] // Offset position of copy #declare RO_Scale = array[100] // Scale of copy #declare RO_Rot = array[100] // Rotation of copy #declare RO_Texture = array[100] // Texture of copy #declare RO_Lev = array[100] // Level of copy relative to main object #declare RO_Count = 0; // Number of copies // ROAddCopy - Add the definition of a copy to the system. // Pos Position of copy // Scale Scale applied o copy // Rot Rotation applied to copy // Text Texture for copy // Level Reduction of maximum detail level for this copy. ie 1 means make this // copy 1 level simpler than the maximum in the call to RODraw. See below. #macro ROAddCopy(Pos, Scale, Rot, Text, Level) #declare RO_Pos[RO_Count] = Pos; #declare RO_Scale[RO_Count] = Scale; #declare RO_Rot[RO_Count] = Rot; #declare RO_Texture[RO_Count] = Text #declare RO_Lev[RO_Count] = Level; #declare RO_Count = RO_Count + 1; #end // RODraw - Create recursive object // Obj Object used to create RO // Level Maximum level of recursion. Watch this, usually less than 7 or 8, start with 2 or 3. #macro RODraw(Obj, Level) #local Copy = 0; union{ #while (Copy0) // If more levels to do object{ RODraw(Obj, Level-(1+RO_Lev[Copy])) // Create a copy at the correct level scale RO_Scale[Copy] rotate RO_Rot[Copy] translate RO_Pos[Copy] } #else object{ Obj // Use the base object texture { RO_Texture[Copy] } scale RO_Scale[Copy] rotate RO_Rot[Copy] translate RO_Pos[Copy] } #end #local Copy = Copy + 1; #end } #end