» Back To Index
The <box> node
Function
The box node makes it possible to build, in a simple way, a box by specifying its dimensions
(width, height and depth) and textures to be applied on the faces. This functionality is very
useful to quickly design illustrations for software packaging boxes.
For a better box control, you have to pass through the whole process of box creation that
requires the use of Hyperion meshes (meshplane type) and an example picture.
If a face has no texture, it is possible to set a plain color on it. Default color
is black.
The box cannot be used in cases where volumic shadows are employed. Indeed, to get
the shadow-volumes functions algorithm working, closed surfaces are required.
Yet the box is a meshplane assembly that comes down to a 3D shape made of open surfaces.
General syntax
<box
name=""
render="TRUE"
type="CUBE"
width="100.0"
height="100.0"
depth="100.0"
lighting="FALSE"
vertex_density="1" >
<color
face="RIGHT"
r="0.0"
g="0.0"
b="0.0"
a="1.0" />
<material_ambient
r="0.9"
g="0.9"
b="0.9"
a="1.0" />
<material_diffuse
r="1.0"
g="1.0"
b="1.0"
a="1.0" />
<material_specular
r="0.2"
g="0.2"
b="0.2"
a="1.0"
exp="24.0" />
<orientation
pitch="0.0"
yaw="0.0"
roll="0.0" />
<position
x="0.0"
y="0.0"
z="0.0" />
<texture
face="RIGHT"
name="" />
</box>
box
box is the xml tag that defines a box node.
Attributes:
- name - [STR127] - name of the node. This name will make it possible to refer this node throughout
the XML script.
- render - [BOOLEAN] - enables (TRUE) or disables (FALSE) the box rendering - default value: TRUE
- lighting - [BOOLEAN] - enables (TRUE) or disables (FALSE) lighting calculations when
rendering the box. When lighting calculations are activated, the values of the materials coefficients are taken into account - default value: FALSE
- width - [REAL] - box width - default value: 100.0
- height - [REAL] - box height - default value: 100.0
- depth - [REAL] - box depth - default value: 100.0
- type - [ENUM] - box type:
- USER: the user defines himself the box dimensions using the width, height et depth attributes.
- DVD: DVD format box: 136x192x15
- CDROM: CDROM format box: 143x125x11
- CUBE: cubic box: 100x100x100 - default value
- vertex_density - [INTEGER] - specifies the vertices density factor for all the box faces.
By default each face has two vertices along its two dimensions. That makes four vertices per face.
With a factor of 30, that will make: (30*2) * (30*2) = 3600 faces.
As soon as the density factor is higher than 1, the "high performance" mode for faces rendering is
activated.
The thiner the density of the grid, the more accurate will be the light and the specular
reflection calculations -
default value: 1
- group - [STR127] - name of the group in which you can add the current node. A group makes it possible to control the behavior of several objects in a
unique way.
Example
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<hyperion version="1.0" >
<scene name="myScene" show_ref_grid="TRUE" >
<background_color r="0.3" g="0.1" b="0.0" />
</scene>
<camera name="myCamera" />
<texture name="front_tex" filename="fakir.bmp" />
<texture name="right_tex" filename="metal16.gif" />
<box name="myBox" render="TRUE"
type="USER" width="120.0" height="100.0" depth="50.0"
lighting="FALSE" vertex_density="4" >
<position x="0.0" y="50.0" z="0.0" />
<material_ambient r="0.4" g="0.4" b="0.4" a="1.0" />
<material_diffuse r="0.6" g="0.6" b="0.6" a="1.0" />
<material_specular r="0.1" g="0.1" b="0.1" a="1.0" exp="24.0" />
<orientation pitch="0.0" yaw="0.0" roll="0.0" />
<texture face="FRONT" name="front_tex" />
<texture face="RIGHT" name="right_tex" />
<color face="TOP" r="0.2" g="0.2" b="0.2" />
</box>
</hyperion>
color element
color specifies the color to be applied to a box face.
Attributes:
- face - [ENUM] - side of the box:
- RIGHT
- LEFT
- TOP
- BOTTOM
- FRONT
- BACK
- r - [CLAMPED_REAL] - red component of the color. Float value ranging between 0.0 and 1.0 - default value: 0.0
- g - [CLAMPED_REAL] - green component of the color. Float value ranging between 0.0 and 1.0 - default value: 0.0
- b - [CLAMPED_REAL] - blue component of the color. Float value ranging between 0.0 and 1.0 - default value: 0.0
- r255 - [CLAMPED_INTEGER] - red component of the color. Integer value ranging between 0 and 255 - default value: 0
- r255 - [CLAMPED_INTEGER] - green component of the color. Integer value ranging between 0 and 255 - default value: 0
- r255 - [CLAMPED_INTEGER] - blue component of the color. Integer value ranging between 0 and 255 - default value: 0
material_ambient element
material_ambient specifies the ambient reflection factor of the box sides.
Attributes:
- r - [CLAMPED_REAL] - red component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- g - [CLAMPED_REAL] - green component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- b - [CLAMPED_REAL] - blue component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- a - [CLAMPED_REAL] - alpha component. Float value ranging between 0.0 et 1.0 - default value: 1.0
material_diffuse element
material_diffuse specifies the diffuse reflection factor of the box sides.
Attributes:
- r - [CLAMPED_REAL] - red component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- g - [CLAMPED_REAL] - green component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- b - [CLAMPED_REAL] - blue component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- a - [CLAMPED_REAL] - alpha component. Float value ranging between 0.0 et 1.0 - default value: 1.0
material_specular element
material_specular specifies the reflection specular factor of the box sides.
Attributes:
- r - [CLAMPED_REAL] - red component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- g - [CLAMPED_REAL] - green component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- b - [CLAMPED_REAL] - blue component. Float value ranging between 0.0 and 1.0 - default value: 0.9
- a - [CLAMPED_REAL] - alpha component. Float value ranging between 0.0 et 1.0 - default value: 1.0
- exp - [REAL] - specular exponent - default value: 24.0
orientation element
orientation specifies the orientation of the box around the axis of its local reference mark.
Attributes:
- pitch - [REAL] - rotation angle in degrees around the X axis - default value: 0.0
- yaw - [REAL] - rotation angle in degrees around the Y axis - default value: 0.0
- roll - [REAL] - rotation angle in degrees around the Z axis - default value: 0.0
Example
<box>
<orientation pitch="30.0" yaw="45.0" />
</box>
In this example, the box performs a rotation of 30.0 degrees around the x axis and of 45.0 degrees
around the y axis.
position element
position specifies the position of the box in the 3d scene.
Attributes:
- x - [REAL] - X coordinate of the position - default value: 0.0
- y - [REAL] - Y coordinate of the position - default value: 0.0
- z - [REAL] - Z coordinate of the position - default value: 0.0
texture element
texture specifies the name of the texture to be applied on a box side.
Attributes:
- face - [ENUM] - box face:
- RIGHT
- LEFT
- TOP
- BOTTOM
- FRONT
- BACK
- name - [STR127] - name of the texture to be applied.