Updates to GEO loader from Geoff Michel.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,12 @@
|
||||
/*===========================================================================*\
|
||||
|
||||
NAME: geoTypes.h
|
||||
NAME: geoTypes.h
|
||||
|
||||
DESCRIPTION: Constants fro Node types etc.
|
||||
DESCRIPTION: Constants fro Node types etc.
|
||||
|
||||
AUTHOR: Andy Bushnell
|
||||
AUTHOR: Andy Bushnell
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
PROPRIETARY RIGHTS NOTICE:
|
||||
|
||||
@@ -41,58 +41,58 @@ COPYRIGHT NOTICE:
|
||||
|
||||
|
||||
#ifndef uint
|
||||
#define uint unsigned int
|
||||
#define uint unsigned int
|
||||
#endif
|
||||
|
||||
#ifndef ushort
|
||||
//#define ushort unsigned short
|
||||
//#define ushort unsigned short
|
||||
#endif
|
||||
|
||||
#ifndef ubyte
|
||||
#define ubyte unsigned char
|
||||
#define ubyte unsigned char
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* constants to identify the plugin type
|
||||
*/
|
||||
const uint GEO_PLUGIN_TYPE_UNDEFINED = 1;
|
||||
const uint GEO_PLUGIN_TYPE_GEOMETRY_IMPORTER = 2;
|
||||
const uint GEO_PLUGIN_TYPE_GEOMETRY_EXPORTER = 3;
|
||||
const uint GEO_PLUGIN_TYPE_IMAGE_IMPORTER = 4;
|
||||
const uint GEO_PLUGIN_TYPE_TOOL = 5;
|
||||
const uint GEO_PLUGIN_TYPE_BEHAVIOR = 6;
|
||||
const uint GEO_PLUGIN_TYPE_GROUP_NODE_DEF = 7;
|
||||
const uint GEO_PLUGIN_TYPE_LAST = GEO_PLUGIN_TYPE_GROUP_NODE_DEF;
|
||||
const uint GEO_PLUGIN_TYPE_UNDEFINED = 1;
|
||||
const uint GEO_PLUGIN_TYPE_GEOMETRY_IMPORTER = 2;
|
||||
const uint GEO_PLUGIN_TYPE_GEOMETRY_EXPORTER = 3;
|
||||
const uint GEO_PLUGIN_TYPE_IMAGE_IMPORTER = 4;
|
||||
const uint GEO_PLUGIN_TYPE_TOOL = 5;
|
||||
const uint GEO_PLUGIN_TYPE_BEHAVIOR = 6;
|
||||
const uint GEO_PLUGIN_TYPE_GROUP_NODE_DEF = 7;
|
||||
const uint GEO_PLUGIN_TYPE_LAST = GEO_PLUGIN_TYPE_GROUP_NODE_DEF;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** user tool constant - put in favorites menu & toolbar */
|
||||
const uint GEO_TOOL_TYPE_USER = 1;
|
||||
const uint GEO_TOOL_TYPE_USER = 1;
|
||||
|
||||
/** create tool constant - put in create menu & toolbar */
|
||||
const uint GEO_TOOL_TYPE_CREATE = 2;
|
||||
const uint GEO_TOOL_TYPE_CREATE = 2;
|
||||
|
||||
/** modify tool constant - put in modify menu & toolbar */
|
||||
const uint GEO_TOOL_TYPE_MODIFY = 3;
|
||||
const uint GEO_TOOL_TYPE_MODIFY = 3;
|
||||
|
||||
/** helper point tool constant - put in helpers menu & toolbar */
|
||||
const uint GEO_TOOL_TYPE_HELPER_PT = 4;
|
||||
const uint GEO_TOOL_TYPE_HELPER_PT = 4;
|
||||
|
||||
/** appearance tool constant - put in plugins menu & toolbar */
|
||||
const uint GEO_TOOL_TYPE_APPEARANCE = 5;
|
||||
const uint GEO_TOOL_TYPE_APPEARANCE = 5;
|
||||
|
||||
/** behavior tool constant - put in plugins menu & toolbar */
|
||||
const uint GEO_TOOL_TYPE_BEHAVIOR = 6;
|
||||
const uint GEO_TOOL_TYPE_BEHAVIOR = 6;
|
||||
|
||||
/** behavior tool constant - put in plugins menu & toolbar */
|
||||
const uint GEO_TOOL_TYPE_OPTIMIZE = 7;
|
||||
const uint GEO_TOOL_TYPE_OPTIMIZE = 7;
|
||||
|
||||
/** convenience constant */
|
||||
const uint GEO_TOOL_TYPE_LAST = GEO_TOOL_TYPE_OPTIMIZE;
|
||||
const uint GEO_TOOL_TYPE_LAST = GEO_TOOL_TYPE_OPTIMIZE;
|
||||
|
||||
|
||||
|
||||
@@ -102,155 +102,155 @@ const uint GEO_TOOL_TYPE_LAST = GEO_TOOL_TYPE_OPTIMIZE;
|
||||
*
|
||||
* The GEO Node Type Class Hierarchy is as follows...
|
||||
*
|
||||
* GEO_DB_BASE
|
||||
* GEO_DB_GROUP
|
||||
* GEO_DB_BILLBOARD
|
||||
* GEO_DB_SEQUENCE
|
||||
* GEO_DB_LOD
|
||||
* GEO_DB_SWITCH
|
||||
* GEO_DB_RENDERGROUP
|
||||
* GEO_DB_BASE_GROUP
|
||||
* GEO_DB_EXTERNAL
|
||||
* GEO_DB_INSTANCE
|
||||
* GEO_DB_PAGE
|
||||
* GEO_DB_TRANSFORM (*)
|
||||
* GEO_DB_GEOMETRY
|
||||
* GEO_DB_SURFACE
|
||||
* GEO_DB_COORDINATE_SURFACE
|
||||
* GEO_DB_POLYGON
|
||||
* GEO_DB_LIGHTPT
|
||||
* GEO_DB_MESH (*)
|
||||
* GEO_DB_PARAMETRIC_SURFACE (*)
|
||||
* GEO_DB_QUADRIC (*)
|
||||
* GEO_DB_TEXT
|
||||
* GEO_DB_BASE_SURFACE (*)
|
||||
* GEO_DB_VERTEX
|
||||
* GEO_DB_HEADER
|
||||
* GEO_DB_BASE
|
||||
* GEO_DB_GROUP
|
||||
* GEO_DB_BILLBOARD
|
||||
* GEO_DB_SEQUENCE
|
||||
* GEO_DB_LOD
|
||||
* GEO_DB_SWITCH
|
||||
* GEO_DB_RENDERGROUP
|
||||
* GEO_DB_BASE_GROUP
|
||||
* GEO_DB_EXTERNAL
|
||||
* GEO_DB_INSTANCE
|
||||
* GEO_DB_PAGE
|
||||
* GEO_DB_TRANSFORM (*)
|
||||
* GEO_DB_GEOMETRY
|
||||
* GEO_DB_SURFACE
|
||||
* GEO_DB_COORDINATE_SURFACE
|
||||
* GEO_DB_POLYGON
|
||||
* GEO_DB_LIGHTPT
|
||||
* GEO_DB_MESH (*)
|
||||
* GEO_DB_PARAMETRIC_SURFACE (*)
|
||||
* GEO_DB_QUADRIC (*)
|
||||
* GEO_DB_TEXT
|
||||
* GEO_DB_BASE_SURFACE (*)
|
||||
* GEO_DB_VERTEX
|
||||
* GEO_DB_HEADER
|
||||
*
|
||||
* (*) Not available in Geo Version 1.0
|
||||
*/
|
||||
const uint GEO_DB_BASE = 0x00000003;
|
||||
const uint GEO_DB_GROUP = (0x00000004 | GEO_DB_BASE);
|
||||
const uint GEO_DB_SEQUENCE = (0x00000010 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_LOD = (0x00000020 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_SWITCH = (0x00000040 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_RENDERGROUP = (0x00000080 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_GEOMETRY = (0x00000100 | GEO_DB_BASE);
|
||||
const uint GEO_DB_SURFACE = (0x00000200 | GEO_DB_GEOMETRY);
|
||||
const uint GEO_DB_COORDINATE_SURFACE = (0x00000400 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_POLYGON = (0x00000800 | GEO_DB_COORDINATE_SURFACE);
|
||||
const uint GEO_DB_MESH = (0x00001000 | GEO_DB_POLYGON);
|
||||
const uint GEO_DB_PARAMETRIC_SURFACE = (0x00002000 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_QUADRIC = (0x00004000 | GEO_DB_PARAMETRIC_SURFACE);
|
||||
const uint GEO_DB_PAGE = (0x00008000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_TEXT = (0x00040000 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_VERTEX = (0x00080000 | GEO_DB_GEOMETRY);
|
||||
const uint GEO_DB_HEADER = (0x00100000 | GEO_DB_BASE);
|
||||
const uint GEO_DB_TRANSFORM = (0x00200000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_BASE_GROUP = (0x00400000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_BASE_SURFACE = (0x00800000 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_EXTERNAL = (0x01000000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_INSTANCE = (0x04000000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_LIGHTPT = (0x08000000 | GEO_DB_POLYGON);
|
||||
const uint GEO_DB_BASE = 0x00000003;
|
||||
const uint GEO_DB_GROUP = (0x00000004 | GEO_DB_BASE);
|
||||
const uint GEO_DB_SEQUENCE = (0x00000010 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_LOD = (0x00000020 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_SWITCH = (0x00000040 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_RENDERGROUP = (0x00000080 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_GEOMETRY = (0x00000100 | GEO_DB_BASE);
|
||||
const uint GEO_DB_SURFACE = (0x00000200 | GEO_DB_GEOMETRY);
|
||||
const uint GEO_DB_COORDINATE_SURFACE = (0x00000400 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_POLYGON = (0x00000800 | GEO_DB_COORDINATE_SURFACE);
|
||||
const uint GEO_DB_MESH = (0x00001000 | GEO_DB_POLYGON);
|
||||
const uint GEO_DB_PARAMETRIC_SURFACE = (0x00002000 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_QUADRIC = (0x00004000 | GEO_DB_PARAMETRIC_SURFACE);
|
||||
const uint GEO_DB_PAGE = (0x00008000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_TEXT = (0x00040000 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_VERTEX = (0x00080000 | GEO_DB_GEOMETRY);
|
||||
const uint GEO_DB_HEADER = (0x00100000 | GEO_DB_BASE);
|
||||
const uint GEO_DB_TRANSFORM = (0x00200000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_BASE_GROUP = (0x00400000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_BASE_SURFACE = (0x00800000 | GEO_DB_SURFACE);
|
||||
const uint GEO_DB_EXTERNAL = (0x01000000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_INSTANCE = (0x04000000 | GEO_DB_GROUP);
|
||||
const uint GEO_DB_LIGHTPT = (0x08000000 | GEO_DB_POLYGON);
|
||||
|
||||
// older version types for Compatability & convenience
|
||||
//
|
||||
const uint GEO_DB_ALL = GEO_DB_BASE;
|
||||
const uint GEO_DB_ALL_GROUP_TYPES = GEO_DB_GROUP;
|
||||
const uint GEO_DB_ALL_SURFACE_TYPES = GEO_DB_SURFACE;
|
||||
const uint GEO_DB_ALL_SHAPE_TYPES = GEO_DB_PARAMETRIC_SURFACE;
|
||||
const uint GEO_DB_ALL_GEOMETRY_TYPES = GEO_DB_GEOMETRY;
|
||||
const uint GEO_DB_ALL = GEO_DB_BASE;
|
||||
const uint GEO_DB_ALL_GROUP_TYPES = GEO_DB_GROUP;
|
||||
const uint GEO_DB_ALL_SURFACE_TYPES = GEO_DB_SURFACE;
|
||||
const uint GEO_DB_ALL_SHAPE_TYPES = GEO_DB_PARAMETRIC_SURFACE;
|
||||
const uint GEO_DB_ALL_GEOMETRY_TYPES = GEO_DB_GEOMETRY;
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** constants to identify the type of picking to be done */
|
||||
const uint GEO_PICK_GROUP = 0x00000001;
|
||||
const uint GEO_PICK_PRIM = 0x00000002;
|
||||
const uint GEO_PICK_VERTEX = 0x00000004;
|
||||
const uint GEO_PICK_EDGE = 0x00000008; // Future
|
||||
const uint GEO_PICK_GRID = 0x00000010;
|
||||
const uint GEO_PICK_NON_NODE = 0x00000020; // manipulators, user geometry etc.
|
||||
const uint GEO_PICK_EXTERNAL = 0x00000040;
|
||||
const uint GEO_PICK_GROUP = 0x00000001;
|
||||
const uint GEO_PICK_PRIM = 0x00000002;
|
||||
const uint GEO_PICK_VERTEX = 0x00000004;
|
||||
const uint GEO_PICK_EDGE = 0x00000008; // Future
|
||||
const uint GEO_PICK_GRID = 0x00000010;
|
||||
const uint GEO_PICK_NON_NODE = 0x00000020; // manipulators, user geometry etc.
|
||||
const uint GEO_PICK_EXTERNAL = 0x00000040;
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** constants to identify mouse button usage */
|
||||
const uint GEO_NO_MOUSE = 0x00000000;
|
||||
const uint GEO_LEFT_MOUSE = 0x00000001;
|
||||
const uint GEO_MIDDLE_MOUSE = 0x00000002;
|
||||
const uint GEO_RIGHT_MOUSE = 0x00000004;
|
||||
const uint GEO_LEFT_AND_RIGHT_MOUSE = 0x00000008;
|
||||
const uint GEO_MIDDLE_AND_RIGHT_MOUSE = 0x00000010;
|
||||
const uint GEO_NO_MOUSE = 0x00000000;
|
||||
const uint GEO_LEFT_MOUSE = 0x00000001;
|
||||
const uint GEO_MIDDLE_MOUSE = 0x00000002;
|
||||
const uint GEO_RIGHT_MOUSE = 0x00000004;
|
||||
const uint GEO_LEFT_AND_RIGHT_MOUSE = 0x00000008;
|
||||
const uint GEO_MIDDLE_AND_RIGHT_MOUSE = 0x00000010;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** Predefined model unit identifier. database model units can be modified
|
||||
* via set/getUnits
|
||||
*/
|
||||
const uint GEO_DB_INCHES = 1;
|
||||
const uint GEO_DB_FEET = 2;
|
||||
const uint GEO_DB_YARDS = 3;
|
||||
const uint GEO_DB_MILES = 4;
|
||||
const uint GEO_DB_CENTIMETERS = 5;
|
||||
const uint GEO_DB_METERS = 6;
|
||||
const uint GEO_DB_KILOMETERS = 7;
|
||||
const uint GEO_DB_INCHES = 1;
|
||||
const uint GEO_DB_FEET = 2;
|
||||
const uint GEO_DB_YARDS = 3;
|
||||
const uint GEO_DB_MILES = 4;
|
||||
const uint GEO_DB_CENTIMETERS = 5;
|
||||
const uint GEO_DB_METERS = 6;
|
||||
const uint GEO_DB_KILOMETERS = 7;
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** Constants to define the modeler's intended "up" direction if that
|
||||
* makes any sense
|
||||
*/
|
||||
|
||||
const int GEO_DB_UP_AXIS_X = 1;
|
||||
const int GEO_DB_UP_AXIS_Y = 2; // the default
|
||||
const int GEO_DB_UP_AXIS_Z = 3;
|
||||
|
||||
const int GEO_DB_UP_AXIS_X = 1;
|
||||
const int GEO_DB_UP_AXIS_Y = 2; // the default
|
||||
const int GEO_DB_UP_AXIS_Z = 3;
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** Constants to control the drawing effect
|
||||
*
|
||||
* Constants to control the drawing of geometry primitives - usefull if user
|
||||
* wants to call standard draw method in a tool postDraw callback
|
||||
*/
|
||||
const uint GEO_DB_SOLID = 0x00000001;
|
||||
const uint GEO_DB_WIRE = 0x00000002;
|
||||
const uint GEO_DB_OUTLINED = 0x00000008;
|
||||
const uint GEO_DB_SOLID = 0x00000001;
|
||||
const uint GEO_DB_WIRE = 0x00000002;
|
||||
const uint GEO_DB_OUTLINED = 0x00000008;
|
||||
|
||||
const uint GEO_DB_ZBUFFER = 0x00000100;
|
||||
const uint GEO_DB_BACKFACE = 0x00000400;
|
||||
const uint GEO_DB_ZBUFFER = 0x00000100;
|
||||
const uint GEO_DB_BACKFACE = 0x00000400;
|
||||
|
||||
const uint GEO_DB_DRAW_FACE_NORMALS = 0x00001000;
|
||||
const uint GEO_DB_DRAW_VERTEX_NORMALS = 0x00002000;
|
||||
const uint GEO_DB_DRAW_FACE_NORMALS = 0x00001000;
|
||||
const uint GEO_DB_DRAW_VERTEX_NORMALS = 0x00002000;
|
||||
|
||||
const uint GEO_DB_TEXTURE = 0x00010000;
|
||||
const uint GEO_DB_HIGHLIGHT = 0x00020000;
|
||||
const uint GEO_DB_PICKING = 0x00040000;
|
||||
const uint GEO_DB_HIGHLIGHT_DASHED = 0x00080000;
|
||||
const uint GEO_DB_TEXTURE = 0x00010000;
|
||||
const uint GEO_DB_HIGHLIGHT = 0x00020000;
|
||||
const uint GEO_DB_PICKING = 0x00040000;
|
||||
const uint GEO_DB_HIGHLIGHT_DASHED = 0x00080000;
|
||||
|
||||
const uint GEO_DB_ILLUMINATED = 0x01000000;
|
||||
const uint GEO_DB_NORMAL_PER_PRIM = 0x04000000;
|
||||
const uint GEO_DB_NORMAL_PER_VERTEX = 0x08000000;
|
||||
const uint GEO_DB_ILLUMINATED = 0x01000000;
|
||||
const uint GEO_DB_NORMAL_PER_PRIM = 0x04000000;
|
||||
const uint GEO_DB_NORMAL_PER_VERTEX = 0x08000000;
|
||||
|
||||
const uint GEO_DB_COLOR_PER_GEODE = 0x10000000;
|
||||
const uint GEO_DB_COLOR_PER_PRIM = 0x20000000;
|
||||
const uint GEO_DB_COLOR_PER_VERTEX = 0x40000000;
|
||||
const uint GEO_DB_COLOR_PER_GEODE = 0x10000000;
|
||||
const uint GEO_DB_COLOR_PER_PRIM = 0x20000000;
|
||||
const uint GEO_DB_COLOR_PER_VERTEX = 0x40000000;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** Constants to control the switch Node behavior
|
||||
*
|
||||
* Switch Nodes can either be addative (in which case the
|
||||
@@ -259,16 +259,16 @@ const uint GEO_DB_COLOR_PER_VERTEX = 0x40000000;
|
||||
*
|
||||
* Selctive control is not implemented.
|
||||
*/
|
||||
const uint GEO_SWITCH_TYPE_ADDATIVE = 1;
|
||||
const uint GEO_SWITCH_TYPE_SELECTIVE = 2;
|
||||
const uint GEO_SWITCH_TYPE_ADDATIVE = 1;
|
||||
const uint GEO_SWITCH_TYPE_SELECTIVE = 2;
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** Type Tokens for Node & Tool Gui Widgets */
|
||||
const int GUI_FLOAT = 1;
|
||||
const int GUI_INT = 2;
|
||||
const int GUI_STRING = 3;
|
||||
const int GUI_FLOAT = 1;
|
||||
const int GUI_INT = 2;
|
||||
const int GUI_STRING = 3;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -278,19 +278,19 @@ typedef void geoWidget;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/** Animated String padding tokens */
|
||||
const int GEO_TEXT_PAD_NONE = 0;
|
||||
const int GEO_TEXT_PAD_WITH_SPACES = 1;
|
||||
const int GEO_TEXT_PAD_WITH_ZEROES = 2;
|
||||
const int GEO_TEXT_PAD_NONE = 0;
|
||||
const int GEO_TEXT_PAD_WITH_SPACES = 1;
|
||||
const int GEO_TEXT_PAD_WITH_ZEROES = 2;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Polygon draw style types
|
||||
//
|
||||
const int GEO_POLY_DSTYLE_SOLID = 0;
|
||||
const int GEO_POLY_DSTYLE_OPEN_WIRE = 1;
|
||||
const int GEO_POLY_DSTYLE_CLOSED_WIRE = 2;
|
||||
const int GEO_POLY_DSTYLE_POINTS = 3;
|
||||
const int GEO_POLY_DSTYLE_SOLID_BOTH_SIDES = 4;
|
||||
const int GEO_POLY_DSTYLE_SOLID = 0;
|
||||
const int GEO_POLY_DSTYLE_OPEN_WIRE = 1;
|
||||
const int GEO_POLY_DSTYLE_CLOSED_WIRE = 2;
|
||||
const int GEO_POLY_DSTYLE_POINTS = 3;
|
||||
const int GEO_POLY_DSTYLE_SOLID_BOTH_SIDES = 4;
|
||||
|
||||
|
||||
|
||||
@@ -298,63 +298,63 @@ const int GEO_POLY_DSTYLE_SOLID_BOTH_SIDES = 4;
|
||||
// Polygon shade style types
|
||||
//
|
||||
|
||||
const int GEO_POLY_SHADEMODEL_FLAT = 0;
|
||||
const int GEO_POLY_SHADEMODEL_GOURAUD = 1;
|
||||
const int GEO_POLY_SHADEMODEL_LIT = 2;
|
||||
const int GEO_POLY_SHADEMODEL_LIT_GOURAUD = 3;
|
||||
const int GEO_POLY_SHADEMODEL_FLAT = 0;
|
||||
const int GEO_POLY_SHADEMODEL_GOURAUD = 1;
|
||||
const int GEO_POLY_SHADEMODEL_LIT = 2;
|
||||
const int GEO_POLY_SHADEMODEL_LIT_GOURAUD = 3;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Texture Mapping types
|
||||
//
|
||||
|
||||
const int GEO_POLY_PLANAR_MAP = 0;
|
||||
const int GEO_POLY_CYLINDRICAL_MAP = 1;
|
||||
const int GEO_POLY_SPHERICAL_MAP = 2;
|
||||
const int GEO_POLY_PLANAR_MAP = 0;
|
||||
const int GEO_POLY_CYLINDRICAL_MAP = 1;
|
||||
const int GEO_POLY_SPHERICAL_MAP = 2;
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// STring type constants
|
||||
//
|
||||
const int GEO_TEXT_RASTER = 0;
|
||||
const int GEO_TEXT_STROKE = 1;
|
||||
const int GEO_TEXT_RASTER = 0;
|
||||
const int GEO_TEXT_STROKE = 1;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Justification constants
|
||||
//
|
||||
const int GEO_TEXT_LEFT_JUSTIFY = 0;
|
||||
const int GEO_TEXT_CENTER_JUSTIFY = 1;
|
||||
const int GEO_TEXT_RIGHT_JUSTIFY = 2;
|
||||
const int GEO_TEXT_LEFT_JUSTIFY = 0;
|
||||
const int GEO_TEXT_CENTER_JUSTIFY = 1;
|
||||
const int GEO_TEXT_RIGHT_JUSTIFY = 2;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Direction constants
|
||||
//
|
||||
const int GEO_TEXT_LEFT_TO_RIGHT = 0;
|
||||
const int GEO_TEXT_RIGHT_TO_LEFT = 1;
|
||||
const int GEO_TEXT_TOP_TO_BOTTOM = 2;
|
||||
const int GEO_TEXT_BOTTOM_TO_TOP = 3;
|
||||
const int GEO_TEXT_LEFT_TO_RIGHT = 0;
|
||||
const int GEO_TEXT_RIGHT_TO_LEFT = 1;
|
||||
const int GEO_TEXT_TOP_TO_BOTTOM = 2;
|
||||
const int GEO_TEXT_BOTTOM_TO_TOP = 3;
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LightPoint Type constants
|
||||
//
|
||||
const int GEO_DB_LIGHTPT_OMNI_DIRECTIONAL = 0;
|
||||
const int GEO_DB_LIGHTPT_UNI_DIRECTIONAL = 1;
|
||||
const int GEO_DB_LIGHTPT_BI_DIRECTIONAL = 2;
|
||||
const int GEO_DB_LIGHTPT_OMNI_DIRECTIONAL = 0;
|
||||
const int GEO_DB_LIGHTPT_UNI_DIRECTIONAL = 1;
|
||||
const int GEO_DB_LIGHTPT_BI_DIRECTIONAL = 2;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Texture Record Wrap S & T Modes
|
||||
const unsigned GEO_DB_TEX_CLAMP = 0x00000001;
|
||||
const unsigned GEO_DB_TEX_REPEAT = 0x00000002;
|
||||
const unsigned GEO_DB_TEX_CLAMP = 0x00000001;
|
||||
const unsigned GEO_DB_TEX_REPEAT = 0x00000002;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Texture Record MagFilter
|
||||
const unsigned GEO_DB_TEX_NEAREST = 0x00000001;
|
||||
const unsigned GEO_DB_TEX_LINEAR = 0x00000002;
|
||||
const unsigned GEO_DB_TEX_NEAREST = 0x00000001;
|
||||
const unsigned GEO_DB_TEX_LINEAR = 0x00000002;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -367,9 +367,9 @@ const unsigned GEO_DB_TEX_LINEAR_MIPMAP_LINEAR = 0x00000020;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Texture Record TexEnv
|
||||
const unsigned GEO_DB_TEX_MODULATE = 0x00000001;
|
||||
const unsigned GEO_DB_TEX_DECAL = 0x00000002;
|
||||
const unsigned GEO_DB_TEX_BLEND = 0x00000004;
|
||||
const unsigned GEO_DB_TEX_MODULATE = 0x00000001;
|
||||
const unsigned GEO_DB_TEX_DECAL = 0x00000002;
|
||||
const unsigned GEO_DB_TEX_BLEND = 0x00000004;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*===========================================================================*\
|
||||
|
||||
NAME: geoUnits.h
|
||||
NAME: geoUnits.h
|
||||
|
||||
DESCRIPTION: Constants to convert coordinate data to/from meters (Geo
|
||||
default)
|
||||
DESCRIPTION: Constants to convert coordinate data to/from meters (Geo
|
||||
default)
|
||||
|
||||
AUTHOR: Andy Bushnell
|
||||
AUTHOR: Andy Bushnell
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
PROPRIETARY RIGHTS NOTICE:
|
||||
|
||||
|
||||
This software contains proprietary information and trade secrets of Carbon
|
||||
Graphics LLC. No part or all of this software may be reproduced in any form,
|
||||
without the written permission of Carbon Graphics LLC.
|
||||
@@ -40,34 +40,34 @@ COPYRIGHT NOTICE:
|
||||
#define _GEO_UNITS_H_
|
||||
|
||||
|
||||
const float KM_TO_METERS = 1000.0f;
|
||||
const float CM_TO_METERS = 0.01f;
|
||||
const float MM_TO_METERS = 0.001f;
|
||||
const float NM_TO_METERS = 1852.0f;
|
||||
const float MILES_TO_METERS = 1609.344f;
|
||||
const float YARDS_TO_METERS = 0.9144f;
|
||||
const float FEET_TO_METERS = 0.3048f;
|
||||
const float INCHES_TO_METERS= 0.0254f;
|
||||
const float KM_TO_METERS = 1000.0f;
|
||||
const float CM_TO_METERS = 0.01f;
|
||||
const float MM_TO_METERS = 0.001f;
|
||||
const float NM_TO_METERS = 1852.0f;
|
||||
const float MILES_TO_METERS = 1609.344f;
|
||||
const float YARDS_TO_METERS = 0.9144f;
|
||||
const float FEET_TO_METERS = 0.3048f;
|
||||
const float INCHES_TO_METERS= 0.0254f;
|
||||
|
||||
const float METERS_TO_KM = 0.001f;
|
||||
const float METERS_TO_CM = 100.0f;
|
||||
const float METERS_TO_MM = 1000.0f;
|
||||
const float METERS_TO_NM = 0.0005399568035f;
|
||||
const float METERS_TO_MILES = 0.0006213711922f;
|
||||
const float METERS_TO_YARDS = 1.093613298f;
|
||||
const float METERS_TO_FEET = 3.280839895f;
|
||||
const float METERS_TO_INCHES= 39.37007874f;
|
||||
const float METERS_TO_KM = 0.001f;
|
||||
const float METERS_TO_CM = 100.0f;
|
||||
const float METERS_TO_MM = 1000.0f;
|
||||
const float METERS_TO_NM = 0.0005399568035f;
|
||||
const float METERS_TO_MILES = 0.0006213711922f;
|
||||
const float METERS_TO_YARDS = 1.093613298f;
|
||||
const float METERS_TO_FEET = 3.280839895f;
|
||||
const float METERS_TO_INCHES= 39.37007874f;
|
||||
|
||||
const float CM_TO_FEET = 0.03280839895f;
|
||||
const float CM_TO_INCHES = 0.3937007874f;
|
||||
const float FEET_TO_YARDS = 0.333333333f;
|
||||
const float FEET_TO_CM = 30.48f;
|
||||
const float FEET_TO_INCHES = 12.0f;
|
||||
const float INCHES_TO_FEET = 0.083333333f;
|
||||
const float INCHES_TO_CM = 2.54f;
|
||||
const float CM_TO_FEET = 0.03280839895f;
|
||||
const float CM_TO_INCHES = 0.3937007874f;
|
||||
const float FEET_TO_YARDS = 0.333333333f;
|
||||
const float FEET_TO_CM = 30.48f;
|
||||
const float FEET_TO_INCHES = 12.0f;
|
||||
const float INCHES_TO_FEET = 0.083333333f;
|
||||
const float INCHES_TO_CM = 2.54f;
|
||||
|
||||
const float MPH_TO_FPS = 1.4667f;
|
||||
const float MPH_TO_MPS = 0.447f;
|
||||
const float MPH_TO_FPS = 1.4667f;
|
||||
const float MPH_TO_MPS = 0.447f;
|
||||
|
||||
|
||||
|
||||
|
||||
163
src/osgPlugins/geo/osgGeoAnimation.h
Normal file
163
src/osgPlugins/geo/osgGeoAnimation.h
Normal file
@@ -0,0 +1,163 @@
|
||||
// animation features of the CarbonGraphics .geo format
|
||||
// require access to the internal Vars & External Vars.
|
||||
#ifndef _GEO_ANIM_H_
|
||||
#define _GEO_ANIM_H_
|
||||
|
||||
#include <osg/Timer>
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
|
||||
class georecord; // You don't need to know how I read a geo record,
|
||||
// but objects of this class are passed to some of the parsing routines.
|
||||
// The values are defined in osgGeoStructs.h which is distributed with OSG.
|
||||
|
||||
class geoValue {
|
||||
public:
|
||||
geoValue() {
|
||||
token=0; fid=0; val.d=0; name="";
|
||||
vmin=0; vmax=0;
|
||||
constrained=false;
|
||||
}
|
||||
geoValue(const unsigned int tok, const unsigned int fident) {
|
||||
token=tok; fid=fident; val.d=0; name="";
|
||||
vmin=0; vmax=0;
|
||||
constrained=false;
|
||||
}
|
||||
~geoValue() {}
|
||||
inline unsigned int getToken() const { return token;}
|
||||
inline unsigned int getFID() const { return fid;}
|
||||
inline double *getValue() { return &(val.d);}
|
||||
void setVal(double v) { val.d=v;
|
||||
if (constrained) {
|
||||
if (v>vmax) val.d=vmax;
|
||||
if (v<vmin) val.d=vmin;
|
||||
}
|
||||
}
|
||||
const std::string getName(void) const { return name;}
|
||||
void setName(const char *nm) { name=nm; }
|
||||
void setMinRange(const float f) { vmin=f;}
|
||||
void setMaxRange(const float f) { vmax=f; }
|
||||
void setConstrained(bool onoff=true) { constrained=onoff;}
|
||||
private:
|
||||
union {
|
||||
double d;
|
||||
float f;
|
||||
int i;
|
||||
unsigned int ui;
|
||||
} val;
|
||||
unsigned int token; // type of field
|
||||
unsigned int fid; // field identifier
|
||||
float vmin, vmax;
|
||||
std::string name;
|
||||
bool constrained; // are values limited by min,max
|
||||
}; // a numerical value, may be one of several types
|
||||
class internalVars { // holds internal variables for whole model
|
||||
public:
|
||||
internalVars() { }
|
||||
~internalVars() {
|
||||
}
|
||||
void addInternalVars(const georecord &gr);
|
||||
void update(osg::Timer &_timer,osg::FrameStamp &_frameStamp);
|
||||
double *getVar(const unsigned fid) {
|
||||
int iord=0;
|
||||
for (std::vector<geoValue>::iterator itr=vars.begin();
|
||||
itr!=vars.end();
|
||||
++itr, iord++)
|
||||
{// for each field
|
||||
if ((*itr).getFID() == fid) {
|
||||
return ((*itr).getValue());
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<geoValue> vars; // these fields define internal vars
|
||||
};
|
||||
|
||||
class userVars {
|
||||
public:
|
||||
userVars() {}
|
||||
~userVars() {}
|
||||
unsigned int number() { return vars.size();}
|
||||
std::vector<geoValue> *getvars() { return &vars;}
|
||||
double *getVar(const unsigned fid) {
|
||||
for (std::vector<geoValue>::iterator itr=vars.begin(); itr<vars.end(); itr++) {
|
||||
if (itr->getFID() == fid) return (itr->getValue());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void addUserVar(const georecord &gr);
|
||||
void update() {
|
||||
for (std::vector<geoValue>::iterator itr=vars.begin();
|
||||
itr!=vars.end();
|
||||
++itr)
|
||||
{// for each user var
|
||||
// itr->setVal((*itr->getValue())+0.01);
|
||||
}
|
||||
}
|
||||
private:
|
||||
std::vector<geoValue> vars;
|
||||
};
|
||||
|
||||
class geoHeader: public osg::PositionAttitudeTransform {
|
||||
// structure for header of .geo file
|
||||
// adds position attitude orientation for not Z up models,
|
||||
// plus animation variables.
|
||||
public:
|
||||
geoHeader() { intVars=new internalVars; useVars=new userVars;
|
||||
extVars=new userVars;
|
||||
_frameStamp.setFrameNumber(0); // vars=NULL;
|
||||
tstart=_frameStamp.getReferenceTime();_initialTick = _timer.tick();
|
||||
ucb=NULL;
|
||||
};
|
||||
void setUserUpdate(void (*ufn)(const double time, userVars *locVars,userVars *extVars) )
|
||||
{ // pass the address of a user written function in the App process.
|
||||
ucb=ufn;
|
||||
}
|
||||
void addInternalVars(const georecord &gr) { intVars->addInternalVars(gr);}
|
||||
internalVars *getInternalVars(void) const { return intVars;}
|
||||
double *getVar(const unsigned fid) {
|
||||
double *dv=NULL;
|
||||
dv=intVars->getVar(fid);
|
||||
if (!dv) {
|
||||
dv=useVars->getVar(fid);
|
||||
if (!dv) {
|
||||
dv=extVars->getVar(fid);
|
||||
}
|
||||
}
|
||||
return dv;
|
||||
}
|
||||
void addUserVar(const georecord &gr)
|
||||
{ // this georecord defines a single variable of type<>
|
||||
useVars->addUserVar(gr);
|
||||
}
|
||||
void update() {
|
||||
osg::Timer_t _frameTick = _timer.tick();;
|
||||
_lastFrameTick=_frameTick;
|
||||
|
||||
_frameStamp.setFrameNumber(_frameStamp.getFrameNumber()+1);
|
||||
_frameStamp.setReferenceTime(_timer.delta_s(_initialTick,_frameTick));
|
||||
double time = _frameStamp.getReferenceTime();
|
||||
intVars->update(_timer, _frameStamp);
|
||||
useVars->update();
|
||||
extVars->update();
|
||||
if (ucb) ucb(time,useVars, extVars);
|
||||
}
|
||||
userVars *getLocalVars() const { return useVars;}
|
||||
userVars *getExternalVars() const { return extVars;}
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~geoHeader() {}
|
||||
|
||||
osg::Timer_t _lastFrameTick,_initialTick;
|
||||
osg::Timer _timer;
|
||||
double tstart; // start time
|
||||
osg::FrameStamp _frameStamp ; // time utilities
|
||||
internalVars *intVars;
|
||||
userVars *useVars;
|
||||
userVars *extVars;
|
||||
void (* ucb)(const double t, userVars *l,userVars *e); // called when variables are updated, you write this!
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -16,6 +16,7 @@ AUTHOR: Geoff Michel
|
||||
#ifndef _GEO_STRUCTS_H_
|
||||
#define _GEO_STRUCTS_H_
|
||||
|
||||
|
||||
class geoField { // holds one field of data as read from the disk of a GEO file
|
||||
public:
|
||||
geoField() {
|
||||
@@ -181,20 +182,28 @@ public:
|
||||
storage=(unsigned char *)norms;
|
||||
}
|
||||
}
|
||||
void warn(const char *type, unsigned tval) const { if (getType() != tval)
|
||||
osg::notify(osg::WARN) << "Wrong type " << type <<" expecting "<< getType() << std::endl;}
|
||||
unsigned int getUInt() const {warn("getUInt",DB_UINT); return *((unsigned int*)storage);} // return int value
|
||||
char *getChar() const {warn("getChar",DB_CHAR); return (char *)storage;} // return chars, eg for name or file name
|
||||
int getInt() const {warn("getInt", DB_INT); return *((int*)storage);} // return int value
|
||||
float getFloat() const {warn("getFloat", DB_FLOAT); return (*(float *)storage); }
|
||||
float *getFloatArr() const {warn("getFloatArr", DB_FLOAT); return ( (float *)storage); }
|
||||
float *getVec3Arr() const {warn("getVec3Arr", DB_VEC3F); return ( (float *)storage); }
|
||||
float *getMat44Arr() const {warn("getMat44Arr", DB_VEC16F); return ( (float *)storage); }
|
||||
double getDouble() const {warn("getDouble", DB_DOUBLE); return (*(double *)storage); }
|
||||
friend inline std::ostream& operator << (std::ostream& output, const geoField& gf)
|
||||
inline void warn(const char *type, unsigned tval) const { if (getType() != tval)
|
||||
osg::notify(osg::WARN) << "Wrong type " << type << (int)tval <<" expecting "<< (int)getType() << std::endl;}
|
||||
inline unsigned int getUInt() const {warn("getUInt",DB_UINT); return *((unsigned int*)storage);} // return int value
|
||||
inline char *getChar() const {warn("getChar",DB_CHAR); return (char *)storage;} // return chars, eg for name or file name
|
||||
inline unsigned char getUChar() const {warn("getUChar",DB_CHAR); return *storage;} // return chars, eg for name or file name
|
||||
inline int getInt() const {
|
||||
warn("getInt", DB_INT);
|
||||
int val;
|
||||
memcpy(&val,storage,sizeof(int));
|
||||
return val;} // return int value
|
||||
inline float getFloat() const {warn("getFloat", DB_FLOAT); return (*(float *)storage); }
|
||||
inline float *getFloatArr() const {warn("getFloatArr", DB_FLOAT); return ( (float *)storage); }
|
||||
inline int *getIntArr() const {warn("getIntArr", DB_INT); return ( (int *)storage); }
|
||||
inline float *getVec3Arr() const {warn("getVec3Arr", DB_VEC3F); return ( (float *)storage); }
|
||||
inline float *getMat44Arr() const {warn("getMat44Arr", DB_VEC16F); return ( (float *)storage); }
|
||||
inline double getDouble() const {warn("getDouble", DB_DOUBLE); return (*(double *)storage); }
|
||||
inline unsigned char *getUCh4Arr() const {warn("getUChArr", DB_VEC4UC); return ((unsigned char *)storage); }
|
||||
inline bool getBool() const {warn("getBool", DB_BOOL_WITH_PADDING); return (storage[0] != 0); }
|
||||
friend inline std::ostream& operator << (osgDB::Output& output, const geoField& gf)
|
||||
{
|
||||
if (gf.tokenId!=GEO_DB_LAST_FIELD) {
|
||||
output << " Field:token " << (int)gf.tokenId << " type " << (int)gf.TypeId
|
||||
output.indent() << " Field:token " << (int)gf.tokenId << " datatype " << (int)gf.TypeId
|
||||
<< " num its " << gf.numItems << " size " << gf.storeSize << std::endl;
|
||||
for (uint i=0; i<gf.numItems; i++) {
|
||||
int j,k;
|
||||
@@ -216,113 +225,122 @@ public:
|
||||
if (st.ch[0]) output << st.ch[0];
|
||||
break;
|
||||
case DB_SHORT:
|
||||
output << st.sh[0] << std::endl;
|
||||
output.indent() << st.sh[0] << std::endl;
|
||||
break;
|
||||
case DB_INT:
|
||||
output << st.in[0] << std::endl;
|
||||
output.indent() << st.in[0] << std::endl;
|
||||
break;
|
||||
case DB_FLOAT:
|
||||
output << st.ft[0] << std::endl;
|
||||
output.indent() << st.ft[0] << std::endl;
|
||||
break;
|
||||
case DB_LONG:
|
||||
output << st.ln[0] << std::endl;
|
||||
output.indent() << st.ln[0] << std::endl;
|
||||
break;
|
||||
case DB_ULONG:
|
||||
output << st.uln[0] << std::endl;
|
||||
output.indent() << st.uln[0] << std::endl;
|
||||
break;
|
||||
case DB_DOUBLE:
|
||||
output << st.dbl[0] << std::endl;
|
||||
output.indent() << st.dbl[0] << std::endl;
|
||||
break;
|
||||
case DB_VEC2F:
|
||||
for (j=0; j<2; j++) output << st.ft[j] << " ";
|
||||
output.indent() << st.ft[0] << " " << st.ft[1];
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC3F:
|
||||
output.indent();
|
||||
for (j=0; j<3; j++) output << st.ft[j] << " ";
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC4F:
|
||||
output.indent();
|
||||
for (j=0; j<4; j++) output << st.ft[j] << " ";
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC16F:
|
||||
for (j=0; j<4; j++) {
|
||||
output.indent();
|
||||
for (k=0; k<4; k++) output << st.ch[j*4+k] << " ";
|
||||
output << std::endl;
|
||||
}
|
||||
break;
|
||||
case DB_VEC2I:
|
||||
for (j=0; j<2; j++) output << st.in[j] << " ";
|
||||
output << std::endl;
|
||||
output.indent() << st.in[0] << " " << st.in[1] << std::endl;
|
||||
break;
|
||||
case DB_VEC3I:
|
||||
for ( j=0; j<3; j++) output << st.in[j] << " ";
|
||||
output.indent();
|
||||
for ( j=0; j<3; j++) output << " " << st.in[j];
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC4I:
|
||||
output.indent();
|
||||
for ( j=0; j<4; j++) output << st.in[j] << " ";
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC2D:
|
||||
output.indent();
|
||||
for ( j=0; j<2; j++) output << st.dbl[j] << " ";
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC3D:
|
||||
output.indent();
|
||||
for ( j=0; j<3; j++) output << st.dbl[j] << " ";
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC4D:
|
||||
output.indent();
|
||||
for ( j=0; j<4; j++) output << st.dbl[j] << " ";
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_VEC16D:
|
||||
for (j=0; j<4; j++) {
|
||||
output.indent();
|
||||
for (k=0; k<4; k++) output << st.dbl[j*4+k] << " ";
|
||||
output << std::endl;
|
||||
}
|
||||
break;
|
||||
case DB_VRTX_STRUCT:
|
||||
output << st.ch[0] << std::endl;
|
||||
output.indent() << st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_UINT:
|
||||
output << st.uin[0] << std::endl;
|
||||
output.indent() << st.uin[0] << std::endl;
|
||||
break;
|
||||
case DB_USHORT:
|
||||
output << st.ush[0] << std::endl;
|
||||
output.indent() << st.ush[0] << std::endl;
|
||||
break;
|
||||
case DB_UCHAR:
|
||||
output << (int)st.ch[0] << std::endl;
|
||||
output.indent() << (int)st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_EXT_STRUCT:
|
||||
output << st.ch[0] << std::endl;
|
||||
output.indent() << st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_SHORT_WITH_PADDING:
|
||||
output << st.ch[0] << std::endl;
|
||||
output.indent() << st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_CHAR_WITH_PADDING:
|
||||
output << st.ch[0] << std::endl;
|
||||
output.indent() << st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_USHORT_WITH_PADDING:
|
||||
output << st.ch[0] << std::endl;
|
||||
output.indent() << st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_UCHAR_WITH_PADDING:
|
||||
output << (int)st.ch[0] << std::endl;
|
||||
output.indent() << (int)st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_BOOL_WITH_PADDING:
|
||||
output << st.ch[0] << std::endl;
|
||||
output.indent() << st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_EXTENDED_FIELD_STRUCT:
|
||||
output << st.ch[0] << std::endl;
|
||||
output.indent() << st.ch[0] << std::endl;
|
||||
break;
|
||||
case DB_VEC4UC:
|
||||
output.indent();
|
||||
for ( j=0; j<4; j++) output << (int)st.uch[j] << " ";
|
||||
output << std::endl;
|
||||
break;
|
||||
case DB_DISCRETE_MAPPING_STRUCT:
|
||||
output << st.ch[i] << std::endl;
|
||||
output.indent() << st.ch[i] << std::endl;
|
||||
break;
|
||||
case DB_BITFLAGS:
|
||||
output << st.ch[i] << std::endl;
|
||||
output.indent() << st.ch[i] << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -341,11 +359,65 @@ public:
|
||||
typedef std::vector< geoField > geoFieldList;
|
||||
georecord() {id=0; parent=NULL; instance=NULL;}
|
||||
~georecord() {;}
|
||||
inline int getType(void) const {return id;}
|
||||
inline const uint getType(void) const {return id;}
|
||||
inline void setparent(georecord *p) { parent=p;}
|
||||
inline class georecord *getparent() { return parent;}
|
||||
inline std::vector<georecord *> getchildren(void) { return children;}
|
||||
inline class georecord *getparent() const { return parent;}
|
||||
inline std::vector<georecord *> getchildren(void) const { return children;}
|
||||
void addchild(class georecord *gr) { children.push_back(gr);}
|
||||
georecord *getLastChild(void) const { return children.back();}
|
||||
void addBehaviour(class georecord *gr) { behaviour.push_back(gr);}
|
||||
std::vector< georecord *>getBehaviour() const { return behaviour;}
|
||||
const geoFieldList getFields() const { return fields;}
|
||||
inline bool isVar(void) const {
|
||||
switch (id) {
|
||||
case DB_DSK_FLOAT_VAR:
|
||||
case DB_DSK_INT_VAR:
|
||||
case DB_DSK_LONG_VAR:
|
||||
case DB_DSK_DOUBLE_VAR:
|
||||
case DB_DSK_BOOL_VAR:
|
||||
case DB_DSK_FLOAT2_VAR:
|
||||
case DB_DSK_FLOAT3_VAR:
|
||||
case DB_DSK_FLOAT4_VAR:
|
||||
|
||||
case DB_DSK_INTERNAL_VARS:
|
||||
case DB_DSK_LOCAL_VARS:
|
||||
case DB_DSK_EXTERNAL_VARS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
inline bool isAction(void) const {
|
||||
switch (id) {
|
||||
case DB_DSK_CLAMP_ACTION:
|
||||
case DB_DSK_RANGE_ACTION :
|
||||
case DB_DSK_ROTATE_ACTION :
|
||||
case DB_DSK_TRANSLATE_ACTION :
|
||||
case DB_DSK_SCALE_ACTION :
|
||||
case DB_DSK_ARITHMETIC_ACTION :
|
||||
case DB_DSK_LOGIC_ACTION :
|
||||
case DB_DSK_CONDITIONAL_ACTION :
|
||||
case DB_DSK_LOOPING_ACTION :
|
||||
case DB_DSK_COMPARE_ACTION :
|
||||
case DB_DSK_VISIBILITY_ACTION :
|
||||
case DB_DSK_STRING_CONTENT_ACTION :
|
||||
case DB_DSK_COLOR_RAMP_ACTION:
|
||||
case DB_DSK_LINEAR_ACTION :
|
||||
case DB_DSK_TASK_ACTION :
|
||||
case DB_DSK_PERIODIC_ACTION :
|
||||
case DB_DSK_PERIODIC2_ACTION :
|
||||
case DB_DSK_TRIG_ACTION :
|
||||
case DB_DSK_INVERSE_ACTION :
|
||||
case DB_DSK_TRUNCATE_ACTION :
|
||||
case DB_DSK_ABS_ACTION :
|
||||
case DB_DSK_IF_THEN_ELSE_ACTION :
|
||||
case DB_DSK_DCS_ACTION :
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void readfile(std::ifstream &fin) {
|
||||
if (!fin.eof()) {
|
||||
fin.read((char *)&id,sizeof(int));
|
||||
@@ -366,7 +438,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
friend inline std::ostream& operator << (std::ostream& output, const georecord& gr)
|
||||
friend inline std::ostream& operator << (osgDB::Output& output, const georecord& gr)
|
||||
{
|
||||
if (gr.id == DB_DSK_PUSH) output << "Push" << std::endl;
|
||||
else if (gr.id == DB_DSK_POP) output << "Pop" << std::endl;
|
||||
@@ -398,27 +470,54 @@ public:
|
||||
else if (gr.id == DB_DSK_EXTERNAL) output << "External" << std::endl;
|
||||
else if (gr.id == DB_DSK_PAGE) output << "Page" << std::endl;
|
||||
else if (gr.id == DB_DSK_COLOR_PALETTE) output << "Colour palette" << std::endl;
|
||||
else output << " inp record " << gr.id << std::endl;
|
||||
else if (gr.id == DB_DSK_INTERNAL_VARS) output << "Internal vars" << std::endl;
|
||||
else if (gr.id == DB_DSK_LOCAL_VARS) output << "Local vars" << std::endl;
|
||||
else if (gr.id == DB_DSK_EXTERNAL_VARS) output << "External vars" << std::endl;
|
||||
// behaviours
|
||||
else if (gr.id == DB_DSK_BEHAVIOR) output << "Behaviour" << std::endl;
|
||||
else if (gr.id == DB_DSK_CLAMP_ACTION) output << "clamp action" << std::endl;
|
||||
else if (gr.id == DB_DSK_RANGE_ACTION) output << "range action" << std::endl;
|
||||
else if (gr.id == DB_DSK_ROTATE_ACTION) output << "rotate action" << std::endl;
|
||||
else if (gr.id == DB_DSK_TRANSLATE_ACTION) output << "translate action" << std::endl;
|
||||
else if (gr.id == DB_DSK_SCALE_ACTION) output << "scale action" << std::endl;
|
||||
else if (gr.id == DB_DSK_ARITHMETIC_ACTION) output << "arithmetic action" << std::endl;
|
||||
else if (gr.id == DB_DSK_LOGIC_ACTION) output << "logic action" << std::endl;
|
||||
else if (gr.id == DB_DSK_CONDITIONAL_ACTION) output << "conditional action" << std::endl;
|
||||
else if (gr.id == DB_DSK_LOOPING_ACTION) output << "looping action" << std::endl;
|
||||
else if (gr.id == DB_DSK_COMPARE_ACTION) output << "compare action" << std::endl;
|
||||
else if (gr.id == DB_DSK_VISIBILITY_ACTION) output << "visibility action" << std::endl;
|
||||
else if (gr.id == DB_DSK_STRING_CONTENT_ACTION) output << "string content action" << std::endl;
|
||||
// var types
|
||||
else if (gr.id == DB_DSK_FLOAT_VAR) output << "Float var" << std::endl;
|
||||
else if (gr.id == DB_DSK_INT_VAR) output << "Int var" << std::endl;
|
||||
else if (gr.id == DB_DSK_LONG_VAR) output << "Long var" << std::endl;
|
||||
else if (gr.id == DB_DSK_DOUBLE_VAR) output << "Double var" << std::endl;
|
||||
else if (gr.id == DB_DSK_BOOL_VAR) output << "Bool var" << std::endl;
|
||||
else output << " inp record " << gr.id << std::endl;
|
||||
|
||||
for (geoFieldList::const_iterator itr=gr.fields.begin();
|
||||
itr!=gr.fields.end();
|
||||
++itr)
|
||||
{
|
||||
output << *itr << std::endl;
|
||||
output << *itr;
|
||||
}
|
||||
output << std::endl;
|
||||
std::vector< georecord *>bhv=gr.getBehaviour();
|
||||
for (std::vector< georecord *>::const_iterator rcitr=bhv.begin();
|
||||
rcitr!=bhv.end();
|
||||
++rcitr)
|
||||
{
|
||||
output.indent() << "Behave ";
|
||||
output << (**rcitr);
|
||||
}
|
||||
return output; // to enable cascading, monkey copy from osg\plane or \quat, Ubyte4, vec2,3,4,...
|
||||
}
|
||||
/* const char *getCharField(const int fieldid) const {
|
||||
const geoField *gfd=getField(fieldid);
|
||||
if (gfd) return (char *)gfd->getstore(0);
|
||||
return NULL;
|
||||
} */
|
||||
const geoField *getField(const int fieldid) const { // return field if it exists.
|
||||
for (geoFieldList::const_iterator itr=fields.begin();
|
||||
itr!=fields.end();
|
||||
++itr)
|
||||
{
|
||||
if (itr->getToken()==fieldid) return &(*itr);
|
||||
if (itr->getToken()==fieldid) return itr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -452,11 +551,13 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
unsigned int getNumFields(void) const { return fields.size();}
|
||||
private:
|
||||
int id;
|
||||
uint id;
|
||||
std::vector<geoField> fields; // each geo record has a variable number of fields
|
||||
class georecord *parent; // parent of pushed/popped records
|
||||
class georecord *instance; // this record is an instance of the pointed to record
|
||||
std::vector< georecord *> behaviour; // behaviour & action records of this record
|
||||
std::vector< georecord *> children; // children of this record
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user