Creative Basic
D3DShapeEx Users Guide
v1.02
Coded by ZeroDog
Introduction:
This is a component extension for Creative Basic. It is used in the same manner as the D3DShape function, and the shapes created with it can be manipulated as any other shape created with the D3DShape function by using the D3DCommand function. Unfortunatly, as this is a component exension, there is no syntax highlighting in the Creative Basic IDE for this extension.
Currently there are 8 shapes available:
@SHAPEPLANE
@SHAPEPLANECUBE
@SHAPERADFACE
@SHAPERADFACECYLINDER
@SHAPEHOLLOWRADFACE
@SHAPEHOLLOWRADFACECYLINDER
@SHAPERADFACECONE
@SHAPEHOLLOWRADFACECONE
Future shapes planned:
@SHAPERADFACEFRUSTRUM
@SHAPEHOLLOWRADFACEFRUSTRUM
@SHAPETORUS
@SHAPESPRING
Installation:
Before you can use the D3DShapeEx component, there are a few things you must do:
First, place the D3DShapeEx.ibo in your Creative Basic component folder. This will make it much easier to find when you need it.
   Ex:    C:\Program Files\Ionic Wind\Creative BASIC\components
There is a pre-created component included in the archive that you can use, or you can create the component yourself from the source code included in the archive.
Second, you must add the component to your source code by selecting "Component" from the Creative Basic IDE menu, and then select "Include/Remove". Then click the "Add" button and select the D3DShapeEx.cbo from the file dialog box.
Finally, you must initialize the D3DShapeEx function in your source code. Add
GOSUB InitD3DShapeEx
to the top of your source code and you're done.
Parameters and Usage:
Using the D3DShapeEx component:
Use the D3DShapeEx in the same manner as you would the D3DShape:
INT = D3DShapeEx(ref,type {,parameters})
ref is the parent of the shape. Can be the scene, or another D3DFrame (shape, light, etc)
type can be any one of the @SHAPE ID's listed in the following section.
{parameters} a number of float or int variables, depending on the shape being created.
Shape Parameters:
@SHAPEPLANE xFaceCount, yFaceCount, {OPT doubleSided}
xFaceCount = INT the number of faces wide the plane will be.
yFaceCount = INT the number of faces high the plane will be.
doubleSided = INT If set to 1 then the plane will be doubleSided. If ommited or set to 0 then the plane will be single sided.
Examples:
grass=D3DShapeEx(scene,@SHAPEPLANE,5,12,0) :'5 faces wide, 12 long, single sided
wall=D3DShapeEx(scene,@SHAPEPLANE,20,10,1) :'20 faces wide, 10 high, double sided
@SHAPEPLANECUBE xFaceCount, yFaceCount, zFaceCount, outFace, inFace
xFaceCount = INT the number of faces wide the planecube will be.
yFaceCount = INT the number of faces high the planecube will be.
zFaceCount = INT the number of faces deep the planecube will be.
outFace = INT 1 or 0. If set to 1 then the planecube will be created with the faces facing outwards.
inFace = INT 1 or 0. If set to 1 then the planecube will be created with the faces facing inwards.
If you set both outFace and inFace to 1 then the planecube will be created with both outside faces, and inside faces.
Examples:
rosebox=D3DShapeEx(scene,@SHAPEPLANECUBE,2,12,2,1,0) :'2 faces wide, 12 high, 2 deep, outside faces.
room=D3DShapeEx(scene,@SHAPEPLANECUBE,10,11,12,0,1) :'10 faces wide, 11 high, 12 deep, inside faces.
icecube=D3DShapeEx(scene,@SHAPEPLANECUBE,2,2,2,1,1) :'2 faces wide, 2 high, 2 deep, in and outside faces.
@SHAPERADFACE radius, points, OPT{doubleSided}
radius = FLOAT the radius of the radface.
points = INT the number of points (sides) of the radface.
doubleSided = INT If set to 1 then the radface will be doubleSided. If ommited or set to 0 then the radface will be single sided.
Examples:
dot=D3DShapeEx(scene,@SHAPERADFACE,3,36,1) :'radius of 3, 36 sides, double sided.
triangle=D3DShapeEx(scene,@SHAPERADFACE,2,3,0) :'radius of 2, 3 sides, single sided.
pentagon=D3DShapeEx(scene,@SHAPERADFACE,10,5,1) :'radius of 10, 5 sides, double sided.
@SHAPERADFACECYLINDER radius, points, height, outFace, inFace
radius = FLOAT the radius of the radfacecylinder.
points = INT the number of points (sides) of the radfacecylinder.
height = FLOAT the height of the radfacecylinder.
outFace = INT 1 or 0. If set to 1 then the radfacecylinder will be created with the faces facing outwards.
inFace = INT 1 or 0. If set to 1 then the radfacecylinder will be created with the faces facing inwards.
If you set both outFace and inFace to 1 then the radfacecylinder will be created with both outside faces, and inside faces.
Examples:
roundBar=D3DShapeEx(scene,@SHAPERADFACECYLINDER,3,36,100,1,0) :'radius 3, 36 sides, height 100, outside faces.
attic=D3DShapeEx(scene,@SHAPERADFACECYLINDER,20,3,25,1,1) :'radius 20, 3 sides, length 25, double sided.
stopSign=D3DShapeEx(scene,@SHAPERADFACECYLINDER,2,8,0.1,1,0) :'radius of 2, 8 sides, 0.1 thick, outside faces.
@SHAPEHOLLOWRADFACE radius, points, insideRadius, OPT{doubleSided}
radius = FLOAT the outside radius of the hollowradface.
points = INT the number of points (sides) of the hollowradface.
insideRadius = FLOAT the inside radius of the hollowradface.
doubleSided = INT If set to 1 then the hollowradface will be doubleSided. If ommited or set to 0 then the hollowradface will be single sided.
Examples:
ring=D3DShapeEx(scene,@SHAPEHOLLOWRADFACE,3,36,2,1) :'radius 3, 36 sides, inside radius 2, double sided.
frame=D3DShapeEx(scene,@SHAPEHOLLOWRADFACE,8,4,7,0) :'radius 8, 4 sides, inside radius 7, single sided.
warnSign=D3DShapeEx(scene,@SHAPEHOLLOWRADFACE,5,3,4,1) :'radius 5, 3 sides, inside radius 4, double sided
@SHAPEHOLLOWRADFACECYLINDER radius, points, insideRadius, height, outFace, inFace
radius = FLOAT the outside radius of the hollowradfacecylinder.
points = INT the number of points (sides) of the hollowradfacecylinder.
insideRadius = FLOAT the inside radius of the hollowradfacecylinder.
height = FLOAT the height of the hollowradfacecylinder.
outFace = INT 1 or 0. If set to 1 then the hollowradfacecylinder will be created with the faces facing outwards.
inFace = INT 1 or 0. If set to 1 then the hollowradfacecylinder will be created with the faces facing inwards.
If you set both outFace and inFace to 1 then the hollowradfacecylinder will be created with both outside faces, and inside faces.
Examples:
tube=D3DShapeEx(scene,@SHAPEHOLLOWRADFACECYLINDER,3,36,2,10,1,0) :'radius 3, 36 sides, inside radius 2, height 10, ouside faces.
core=D3DShapeEx(scene,@SHAPEHOLLOWRADFACECYLINDER,20,8,5,20,0,1) :'radius 20, 8 sides, inside radius 5, height 20, inside faces.
tri=D3DShapeEx(scene,@SHAPEHOLLOWRADFACECYLINDER,25,3,5,20,1,1) :'radius 25, 3 sides, inside radius 5, height 20, double sided
@SHAPERADFACECONE radius, points, height, outFace, inFace
radius = FLOAT the radius of the radfacecone.
points = INT the number of points (sides) of the radfacecone.
height = FLOAT the height of the radfacecone.
outFace = INT 1 or 0. If set to 1 then the radfacecone will be created with the faces facing outwards.
inFace = INT 1 or 0. If set to 1 then the radfacecone will be created with the faces facing inwards.
If you set both outFace and inFace to 1 then the radfacecone will be created with both outside faces, and inside faces.
Examples:
Cone=D3DShapeEx(scene,@SHAPERADFACECONE,3,36,100,1,0) :'radius 3, 36 sides, height 100, outside faces.
pyramid=D3DShapeEx(scene,@SHAPERADFACECONE,20,3,25,1,1) :'radius 20, 3 sides, height 25, double sided.
steeple=D3DShapeEx(scene,@SHAPERADFACECONE,2,8,20.5,1,0) :'radius of 2, 8 sides, height 20.5 high, outside faces.
@SHAPEHOLLOWRADFACECONE radius, points, insideRadius, height, outFace, inFace
radius = FLOAT the outside radius of the hollowradfacecone.
points = INT the number of points (sides) of the hollowradfacecone.
insideRadius = FLOAT the inside radius of the hollowradfacecone.
height = FLOAT the height of the hollowradfacecone.
outFace = INT 1 or 0. If set to 1 then the hollowradfacecone will be created with the faces facing outwards.
inFace = INT 1 or 0. If set to 1 then the hollowradfacecone will be created with the faces facing inwards.
If you set both outFace and inFace to 1 then the hollowradfacecone will be created with both outside faces, and inside faces.
Examples:
icecream=D3DShapeEx(scene,@SHAPEHOLLOWRADFACECONE,3,36,2,10,1,0) :'radius 3, 36 sides, inside radius 2, height 10, ouside faces.
dish=D3DShapeEx(scene,@SHAPEHOLLOWRADFACECONE,20,8,5,2,0,1) :'radius 20, 8 sides, inside radius 5, height 2, inside faces.
tri=D3DShapeEx(scene,@SHAPEHOLLOWRADFACECONE,25,3,5,20,1,1) :'radius 25, 3 sides, inside radius 5, height 20, double sided