.\"
.\" Copyright (c) 2010 Hypertriton, Inc.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 28, 2010
.Dt SG_VOXEL 3
.Os
.ds vT FreeSG API Reference
.ds oS FreeSG 1.0
.Sh NAME
.Nm SG_Voxel
.Nd FreeSG voxel object
.Sh SYNOPSIS
.Bd -literal
#include
#include
.Ed
.Sh DESCRIPTION
The
.Nm
node renders a three-dimensional array of real-valued "cells".
.Sh INHERITANCE HIERARCHY
.Xr AG_Object 3 ->
.Xr SG_Node 3 ->
.Nm .
.Sh INITIALIZATION
.nr nS 1
.Ft "SG_Voxel *"
.Fn SG_VoxelNew "SG_Node *parent" "const char *name"
.Pp
.Ft void
.Fn SG_VoxelAlloc3 "SG_Voxel *vol" "Uint width" "Uint height" "Uint depth"
.Pp
.Ft int
.Fn SG_VoxelSet3 "SG_Voxel *vol" "int x" "int y" "int z" "M_Real value"
.Pp
.Ft void
.Fn SG_VoxelReset3 "SG_Voxel *vol" "M_Real value"
.Pp
.nr nS 0
The
.Fn SG_VoxelNew
function creates a new voxel object at the origin of the
.Fa parent
node.
.Pp
.Fn SG_VoxelAlloc3
allocates a voxel of specified dimensions.
.Pp
.Fn SG_VoxelSet3
sets the value of the cell at coordinates
.Fa x ,
.Fa y ,
.Fa z
to the specified
.Fa value .
Returns 0 on success, -1 if the coordinates are invalid.
.Pp
The
.Fn SG_VoxelReset3
function resets the value of all cells to the specified
.Fa value .
.Sh STRUCTURE DATA
For the
.Nm
object:
.Pp
.Bl -tag -compact -width "M_Real ***map "
.It Ft M_Real ***map
Three-dimensional array of cell values.
.It Ft int w
Total width.
.It Ft int h
Total height.
.It Ft int d
Total depth.
.El
.Sh SEE ALSO
.Xr M_Real 3 ,
.Xr SG 3 ,
.Xr SG_Intro 3 ,
.Xr SG_Node 3
.Sh HISTORY
The
.Nm
node class first appeared in FreeSG 1.0.