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  * \relates LsgTransform
00050  * Allocate and initialize a transformation node.
00051  * @return a new LsgTransform instance
00052  */
00053 LsgTransform* LsgTransform_create(void);
00054 
00055 /**
00056  * \relates LsgTransform
00057  * Constructor method for LsgTransform. Initialize the transformation to identity.
00058  * @param self      The instance variable
00059  */
00060 void LsgTransform_init(LsgTransform* self);
00061 
00062 /**
00063  * \relates LsgTransform
00064  * Update all children and recompute the bounding box.
00065  * @param self      The instance variable
00066  * @param now       The current time
00067  */
00068 void LsgTransform_update(LsgTransform* self, float now);
00069 
00070 /**
00071  * \relates LsgTransform
00072  * Display all children with a transformed view frustum and changed OpenGL
00073  * modelview matrix.
00074  * @param self      The instance variable
00075  * @param frustum   The view frustum
00076  */
00077 void LsgTransform_display(LsgTransform* self, LsgFrustum* frustum);
00078 
00079 /**
00080  * \relates LsgTransform
00081  * Compute collision with transformed children.
00082  * @param self      The instance variable
00083  * @param v         Some vertex
00084  * @param nearest   A buffer to store the nearest vertex to v that would collide
00085  *                  with any child
00086  * @return 1 if v after being transformed collides with at least one child,
00087  *         0 otherwise
00088  */
00089 int  LsgTransform_collide(LsgTransform* self, Vertex v, Vertex nearest);
00090 
00091 /**
00092  * Clean all children. Reuse parent implementation.
00093  */
00094 #define LsgTransform_clean(self)       LsgGroup_clean(&(self)->super)
00095 
00096 /**
00097  * Destructor method for LsgTransform. Reuse parent implementation.
00098  */
00099 #define LsgTransform_destroy(self)     LsgGroup_destroy(&(self)->super)
00100 
00101 #endif

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