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_TEXTURE_H 00024 #define LSG_TEXTURE_H 1 00025 00026 /** 00027 * \file texture.h 00028 * \brief Texture properties 00029 */ 00030 00031 #include <lescegra/sg/group.h> 00032 00033 #include <lescegra/util/image.h> 00034 00035 /** 00036 * \ingroup scene 00037 * \brief Texture properties 00038 * 00039 * Apply a texture properties to all children. 00040 */ 00041 typedef struct { 00042 LsgGroup super; 00043 unsigned int id; 00044 unsigned int mode; 00045 unsigned int unit; 00046 } LsgTexture; 00047 00048 /** 00049 * \relates LsgTexture 00050 * Allocate and initialize a texture node. 00051 * @param data The texture color data 00052 * @param type The texture type 00053 * @param mode The texture environment mode 00054 * @param unit The texture unit (0 for no multitexturing) 00055 * @return A new texture node 00056 */ 00057 LsgTexture* LsgTexture_create(LsgImage* data, int type, unsigned int mode, unsigned int unit); 00058 00059 /** 00060 * \relates LsgTexture 00061 * Constructor method for LsgTexture. Create a new texture object of a given type 00062 * with the provided pixel data. 00063 * @param self The instance variable 00064 * @param data The texture color data 00065 * @param type The texture type 00066 * @param mode The texture environment mode 00067 * @param unit The texture unit (0 for no multitexturing) 00068 */ 00069 void LsgTexture_init(LsgTexture* self, LsgImage* data, int type, unsigned int mode, unsigned int unit); 00070 00071 /** 00072 * \relates LsgTexture 00073 * Bind the texture object to the current texture engine and display all 00074 * children. 00075 * @param self The instance variable 00076 * @param frustum The view frustum 00077 */ 00078 void LsgTexture_display(LsgTexture* self, LsgFrustum* frustum); 00079 00080 /** 00081 * \relates LsgTexture 00082 * Destructor method for LsgTexture. Delete the texture object and the list of 00083 * child nodes. 00084 * @param self The instance variable 00085 */ 00086 void LsgTexture_destroy(LsgTexture* self); 00087 00088 /** 00089 * Clean all children. Reuse parent implementation. 00090 */ 00091 #define LsgTexture_clean(self) LsgGroup_clean(&(self)->super); 00092 00093 /** 00094 * Update all children. Reuse parent implementation. 00095 */ 00096 #define LsgTexture_update(self, now) LsgGroup_update(&(self)->super, now); 00097 00098 /** 00099 * Check collision with all children. Reuse parent implementation. 00100 */ 00101 #define LsgTexture_collide(self, v, n) LsgGroup_collide(&(self)->super, v, n); 00102 00103 #endif