One of the additions I'm most proud of is the ability to build objects of any complexity.
You can begin creation of a new object, add limb at will (either as blanks or from existing mesh id's), set properties for those limbs, link them together by specifying their parent limb, and then when you are all done, issue the creation command.
Here's a simple example:
sync on
sync rate 60
autocam off
dot 0, 0, rgb(255, 0, 0)
get image 1, 0, 0, 1, 1
dot 0, 0, rgb(0, 255, 0)
get image 2, 0, 0, 1, 1
dot 0, 0, rgb(0, 0, 255)
get image 3, 0, 0, 1, 1
dot 0, 0, rgb(255, 255, 0)
get image 4, 0, 0, 1, 1
make object cube 1, 1.0
rotate object 1, 45.0, 0.0, 45.0
make mesh from object 1, 1
delete object 1
BEGIN NEW OBJECT
` Top Triangle, red
ADD NEW LIMB 3, 0, 274, 0
SET NEW LIMB NAME "T0"
SET NEW LIMB TEXTURE 1
SET NEW LIMB CULL 0
` Pivot limb
Pivot = ADD NEW LIMB()
SET NEW LIMB NAME "Pivot"
SET NEW LIMB OFFSET 0.0, -1.0, 0.0
` Middle-bottom triangle - untextured, culled
Limb = ADD NEW LIMB(3, 0, 274, 0)
SET NEW LIMB NAME "T1"
SET NEW LIMB ROTATION 0.0, 180.0, 0.0
SET NEW LIMB PARENT Pivot
SET NEW LIMB CULL 1
` Right-bottom triangle, green
ADD NEW LIMB 3, 0, 274, 0
SET NEW LIMB NAME "T2"
SET NEW LIMB OFFSET 1.0, 0.0, 0.2
SET NEW LIMB TEXTURE 2
SET NEW LIMB PARENT Limb
SET NEW LIMB CULL 0
` Left-bottom triangle, blue, not affected by lights
ADD NEW LIMB 3, 0, 274, 0
SET NEW LIMB NAME "T3"
SET NEW LIMB OFFSET -1.0, 0.0, -0.2
SET NEW LIMB TEXTURE 3
SET NEW LIMB PARENT Limb
SET NEW LIMB CULL 0
SET NEW LIMB TRANSPARENT 1
SET NEW LIMB LIGHT 0
` Bottom cube, yellow, generated from mesh data
ADD NEW LIMB FROM MESH 1
SET NEW LIMB NAME "CUBE"
SET NEW LIMB OFFSET 0.0, -1.0, 0.0
SET NEW LIMB PARENT Limb
SET NEW LIMB CULL 0
SET NEW LIMB TEXTURE 4
FINISH NEW OBJECT 1
` Set vertex data for all limbs that have a name starting with 'T' (triangle)
for Limb = 0 to get limb count(1)
lock vertexdata for limb 1, Limb
if left$( limb name$(1, Limb), 1 ) = "T"
set vertexdata position 0, -1.0, 0.0, 0.0
set vertexdata normals 0, 0.0, 0.0, 1.0
set vertexdata position 1, 1.0, 0.0, 0.0
set vertexdata normals 1, 0.0, 0.0, 1.0
set vertexdata position 2, 0.0, 1.0, 0.0
set vertexdata normals 2, 0.0, 0.0, 1.0
endif
unlock vertexdata
next
color backdrop rgb(0, 0, 0)
move camera -4.0
move camera down 0.5
do
set cursor 0, 0
for i = 0 to get limb count(1)
print i; " -> "; padright$(limb name$(1, i), 10);
print " - Parent = "; num(get limb parent(1, i), 2);
print ", Child = "; num(get limb child(1, i), 2);
print ", Sibling = "; num(get limb sibling(1, i), 2)
next
yrotate object 1, wrapvalue(object angle y(1) + 1.5)
rotate limb 1, get limb by name(1, "Pivot"), 0.0, object angle y(1), 0.0
rotate limb 1, get limb by name(1, "Cube"), 0.0, wrapvalue(object angle y(1) * -3.0), 0.0
sync
loop
function Num(v as integer, Size as integer)
local Result as string
if v < 0
Result = padleft$("*", Size)
else
Result = padleft$(str$(v), Size)
endif
endfunction Result
Limb properties that can be set are:
- Parent limb
- Limb name
- Texture
- Offset
- Rotation
- Scaling
- Transparency
- Culling
- Lighting
Note that the object is not created until the command FINISH NEW OBJECT is called, and the current settings can be dumped simply by starting a new object using BEGIN NEW OBJECT.