FOR THE VERSION 0.9.27
PART 5 - SCENE3D AND 3D OBJECTS
1 - 3D WORLD (object: SCENE3D)
1.1 - HANDLING THE 3D CAMERA IN A SCENE3D
As soon as a SCENE3D
is created, it owns a 3D camera placed at (0,0,5) and aiming the origin (0,0,0).
The 3D camera of a scene3d is the user "eye" watching
the 3D world.
It is possible to move the 3D camera and the point aimed by this 3D camera.
1.1.1 - Position the 3D camera
CAM_X_POSITION X | Set X-coordinate of the 3D camera position. |
CAM_Y_POSITION Y | Set Y-coordinate of the 3D camera position. |
CAM_Z_POSITION Z | Set Z-coordinate of the 3D camera position. |
CAM_POSITION X, Y, Z | Set X, Y, Z coordinates of the 3D camera position. |
by default, the 3D camera is at position (0,0,5)
CAM_PITCH A | Rotates the camera around its X-axis by the angle A. |
CAM_ROLL A | Rotates the camera around its Y-axis by the angle A. |
CAM_ROLL Z | Rotates the camera around its Z-axis by the angle A. |
Par défaut, la caméra 3D est orientée suivant le vecteur (0,0,1)
1.1.3 - Position the aimed point
POINT_X_POSITION X | Set X-coordinate of the point aimed by 3D camera. |
POINT_Y_POSITION Y | Set Y-coordinate of the point aimed by 3D camera. |
POINT_Z_POSITION Z | Set Z-coordinate of the point aimed by 3D camera. |
POINT_POSITION X, Y, Z | Set X, Y, Z coordinates of the point aimed by 3D camera. |
POINT_OBJECT N | The 3D camera points the 3D object number N. |
by default, the 3D camera aims the point in (0,0,0)
1.2 - HANDLING THE 3D LIGHT IN A SCENE3D
As soon as a SCENE3D
is created, it owns a 3D light placed at (0,0,5).
It is possible to move the 3D light.
LIGHT_X_POSITION X | Set X-coordinate of the 3D light position. |
LIGHT_Y_POSITION Y | Set Y-coordinate of the 3D light position. |
LIGHT_Z_POSITION Z | Set Z-coordinate of the 3D light position. |
LIGHT_POSITION X, Y, Z | Set X, Y, Z coordinates of the 3D light position. |
by default, the 3D light is at the same position as the 3D camera: (0,0,5)
1.3 - CREATE A 3D OBJECT IN A SCENE3D
To each 3D OBJECT, a number N is associated.
The 3D OBJECT is created at (0,0,0) and its color is gray.
3D_ACTOR N | Creates an actor (object MD2). |
3D_BOX N, Width, Height, Depth | Creates a box. |
3D_CONE N, Height, Radius | Creates a cone. |
3D_CUBE N,Side | Creates a cube. |
3D_CYLINDER N, Height, Top_Radius, Low_Radius | Creates a cylinder. |
3D_DODECAHEDRON N | Creates a dodecahedron. |
3D_LINE N | Creates a line. |
3D_MESH N | Creates a mesh (object 3DS). |
3D_SPHERE N, Radius | Creates a sphere. |
3D_TEAPOT N | Creates a teapot. |
3D_TEXT N, String$ | Creates a 3D text. |
3D_TORUS N, Outer_Radius, Inner_Radius | Creates a torus. |
3D_SKYBOX N | Creates a skybox. |
3D_PLANE N | Creates a plan. |
N = number of created 3D object
1.4 - COMMANDS ON 3D OBJECT (IN A SCENE3D)
For all the commands, N is the number of the 3D object.
3D_DELETE N | Deletes the 3D object number N. |
3D_DELETE_ALL | Deletes all the 3D objects. |
3D_SHOW N | Shows the 3D object number N. |
3D_HIDE N | Hides the 3D object number N. |
3D_X_POSITION N, X | Set X-coordinate of 3D object number N. |
3D_Y_POSITION N, Y | Set Y-coordinate of 3D object number N. |
3D_Z_POSITION N, Z | Set Z-coordinate of 3D object number N. |
3D_POSITION N, X, Y, Z | Set X,Y,Z coordinates of 3D object number N. |
3D_X_ROTATE N, AX | Rotates the 3D object number N of an angle of AX degrees around its own X-axis. |
3D_Y_ROTATE N, AY | Rotates the 3D object number N of an angle of AY degrees around its own Y-axis. |
3D_Z_ROTATE N, AZ | Rotates the 3D object number N of an angle of AZ degrees around its own Z-axis. |
3D_ROTATE N, AX, AY, AZ | Rotates the 3D object number N an angle of AX degrees around its own X-axis, then of an angle of AY degrees around its own Y-axis, then of an angle of AZ degrees around its own Z-axis. |
The angles AX, AY, AZ are in degrees
3D_X_SCALE N, CX | Scales the 3D object number N on its own X-axis direction with coefficient CX. |
3D_Y_SCALE N, CY | Scales the 3D object number N on its own Y-axis direction with coefficient CY. |
3D_Z_SCALE N, CZ | Scales the 3D object number N on its own Z-axis direction with coefficient CZ. |
3D_SCALE N, CX, CY, CZ | Scales the 3D object number N on its own X-axis direction with coefficient CX, then on its own Y-axis direction with coefficient CY, then on its own Z-axis direction with coefficient CZ. |
Stretch (increasing) if Cn > 1, shrinkage (decreasing) if Cn < 1
3D_COLOR N, R, G, B | The 3D object number N takes the color defined by R,G,B primary colors. |
0 <= R <= 255 (red)
0 <= G <= 255 (green)
0 <= B <= 255 (blue)
3D_LOAD_TEXTURE N, F | The 3D object number N takes the "BMP" texture from the file F. |
3D_IMAGE_TEXTURE N1, N2 | The 3D object number N1 takes the texture from the system object number N2. |
3D_LOAD_TEXTURE_BOTTOM N, F | The bottom face of the 3D_SKYBOX number N takes the texture from the file F. |
3D_LOAD_TEXTURE_FRONT N, F | The front face of the 3D_SKYBOX number N takes the texture from the file F. |
3D_LOAD_TEXTURE_RIGHT N, F | The right face of the 3D_SKYBOX number N takes the texture from the file F. |
3D_LOAD_TEXTURE_BACK N, F | The back face of the 3D_SKYBOX number N takes the texture from the file F. |
3D_LOAD_TEXTURE_LEFT N, F | The left face of the 3D_SKYBOX number N takes the texture from the file F. |
3D_LOAD_TEXTURE_TOP N, F | The top face of the 3D_SKYBOX number N takes the texture from the file F. |
3D_LOAD_OBJECT N, F | The structure "MD2" or "3DS" from the file F is loaded in the 3D object number N (3D_ACTOR or 3D_MESH). |
To change the text displayed in the 3D object.
3D_TEXT_CHANGE N, A$ | 3D_TEXT number N displays now A$. |
To change the width of a 3D line.
3D_LINE_WIDTH N, W | Set W pixels for width of the 3D_LINE number N. |
To link the behavior of a 3D object to another 3D object.
3D_CHAIN N, P | Chains the 3D object number N to the 3D object number P: the moves of the object number P are linked to the moves of the object number N. |
3D_CHAIN_BREAK N, P | Breaks the chain between the 3D objects number N and number P. |
To make a 3D object more or less transparent.
3D_TRANSPARENT N, T | Changes the transparence
of the 3D object number N. T is from 0 to 255 If T=0, the 3D object is opaque If T=255, the 3D object is transparent. |
To move a 3D object to its pointing direction.
3D_MOVE N, D | Moves the 3D object number
N by the distance D in its pointing direction. If D>0, 3D object moves forward If D<0, 3D object moves back |
To point a 3D object.
3D_POINT N, P | Points the 3D object number N at the 3D object number P. |
NUMBER_3D_OBJECTS | Returns the number of 3D objects. |
3D_COLLISION_AS_SPHERE N |
The 3d object number N is defined by its bounding sphere. |
3D_COLLISION_AS_CUBE N |
The 3D object number N is defined by a bounding axis-aligned "cube". |
3D_COLLISION_AS_ELLIPSOID N |
The 3D object number N is defined by its bounding axis-aligned ellipsoid. |
3D_COLLISION_AS_POINT N |
The 3D object number N is punctual. |
3D_COLLISION_AS_FACES N |
The 3D object number uses its faces. |
3D_U_TILE N, T |
Set the tile number on U-coordinate of the 3D_PLANE number N. |
3D_V_TILE N, T |
Set the tile number on V-coordinate of the 3D_PLANE number N. |
1.5 - FUNCTIONS OF A 3D OBJECT 3D (IN A SCENE3D)
For all the functions, N is the 3D object number.
O3D_X_POSITION(N) | Returns the X-coordinate of the 3D object number N. |
O3D_Y_POSITION(N) | Returns the Y-coordinate of the 3D object number N. |
O3D_Z_POSITION(N) | Returns the Z-coordinate of the 3D object number N. |
O3D_X_ROTATE(N) | Returns the rotation angle (expressed in degrees) of the 3D object number N around its own X-axis. |
O3D_Y_ROTATE(N) | Returns the rotation angle (expressed in degrees) of the 3D object number N around its own Y-axis. |
O3D_Z_ROTATE(N) | Returns the rotation angle (expressed in degrees) of the 3D object number N around its own Z-axis. |
The returned angles are expressed in degrees.
O3D_X_SCALE(N) | Returns the scale coefficient of the 3D object number N on its own X-axis. |
O3D_Y_SCALE(N) | Returns the scale coefficient of the 3D object number N on its own Y-axis. |
O3D_Z_SCALE(N) | Returns the scale coefficient of the 3D object number N on its own Z-axis. |
If returned value is > 1, there is a stretch (increasing)
If returned value is > 1, there is a shrinkage (decreasing)
If returned value is = 1, there is no modification
O3D_COLLISION(N1,N2) |
Returns 1 if the 3D objects number N1 and N2 collide, 0 otherwise. |
O3D_OBJECT_EXISTS(N) |
Returns 1 if the 3D object number N exists, 0 otherwise. |
O3D_OBJECT_TYPE(N) |
Returns the type of the 3D object number N. |
The type of a 3D object is coded as follows:
1=3D_CUBE
2=3D_BOX
3=3D_SPHERE
4=3D_CONE
5=3D_TORUS
6=3D_CYLINDER
7=3D_DODECAHEDRON
8=3D_TEAPOT
9=3D_TEXT
10=3D_LINE
11=3D_MESH
12=3D_ACTOR
14=3D_SKYBOX
15=3D_TERRAIN
16=3D_PLANE
FOG_ON | Starts the fog effect in the 3D target object (SCENE3D). |
FOG_OFF | Stops the fog effect in the 3D target object (SCENE3D). |
FOG_COLOR R, G, B | Set the fog color in the 3D target object (SCENE3D). |
FOG_DISTANCE_MIN D | Set the fog minimum distance in the 3D target object (SCENE3D). |
FOG_DISTANCE_MAX D | Set the fog maximum distance in the 3D target object (SCENE3D). |
Last update: January 22, 2017