Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

transform.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 * lescegra                                                           *
00003 *                                                                    *
00004 * http://geeky.kicks-ass.org/projects/lescegra.html                  *
00005 *                                                                    *
00006 * Copyright 2003 by Enno Cramer <uebergeek@web.de>                   *
00007 *                                                                    *
00008 * This library is free software; you can redistribute it and/or      *
00009 * modify it under the terms of the GNU Library General Public        *
00010 * License as published by the Free Software Foundation; either       *
00011 * version 2 of the License, or (at your option) any later version.   *
00012 *                                                                    *
00013 * This library is distributed in the hope that it will be useful,    *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *
00016 * Library General Public License for more details.                   *
00017 *                                                                    *
00018 * You should have received a copy of the GNU Library General Public  *
00019 * License along with this library; if not, write to the Free         *
00020 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
00021 *********************************************************************/
00022 
00023 #ifndef LSG_TRANSFORM_H
00024 #define LSG_TRANSFORM_H 1
00025 
00026 /**
00027  * \file  transform.h
00028  * \brief Geometry transformation node
00029  */
00030 
00031 #include <lescegra/sg/group.h>
00032 
00033 #include <lescegra/util/vertex.h>
00034 #include <lescegra/util/matrix.h>
00035 #include <lescegra/util/frustum.h>
00036 
00037 /**
00038  * \ingroup scene
00039  * \brief   Geometry transformation node
00040  *
00041  * Apply a transformation matrix to all subnodes.
00042  */
00043 typedef struct {
00044     LsgGroup super;
00045     Matrix tm;
00046 } LsgTransform;
00047 
00048 /**
00049  * Allocate and initialize a transformation node.
00050  */
00051 LsgTransform* LsgTransform_create(void);
00052 
00053 /**
00054  * Constructor method for LsgTransform. Initialize the transformation to identity.
00055  * @param self      The instance variable
00056  */
00057 void LsgTransform_init(LsgTransform* self);
00058 
00059 /**
00060  * Update all children and recompute the bounding box.
00061  * @param self      The instance variable
00062  * @param now       The current time
00063  */
00064 void LsgTransform_update(LsgTransform* self, float now);
00065 
00066 /**
00067  * Display all children with a transformed view frustum and changed OpenGL
00068  * modelview matrix.
00069  * @param self      The instance variable
00070  * @param frustum   The view frustum
00071  */
00072 void LsgTransform_display(LsgTransform* self, LsgFrustum* frustum);
00073 
00074 /**
00075  * Compute collision with transformed children.
00076  * @param self      The instance variable
00077  * @param v         Some vertex
00078  * @param nearest   A buffer to store the nearest vertex to v that would collide
00079  *                  with any child
00080  * @return 1 if v after being transformed collides with at least one child,
00081  *         0 otherwise
00082  */
00083 int  LsgTransform_collide(LsgTransform* self, Vertex v, Vertex nearest);
00084 
00085 /**
00086  * Clean all children. Reuse parent implementation.
00087  */
00088 #define LsgTransform_clean(self)       LsgGroup_clean(&(self)->super)
00089 
00090 /**
00091  * Destructor method for LsgTransform. Reuse parent implementation.
00092  */
00093 #define LsgTransform_destroy(self)     LsgGroup_destroy(&(self)->super)
00094 
00095 #endif

(c) 2003, by Enno Cramer
generated on 9 Jul 2003
lescegra - doxygen