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 * Allocate and initialize a texture node. 00050 * @param data The texture color data 00051 * @param type The texture type 00052 * @param mode The texture environment mode 00053 * @param unit The texture unit (0 for no multitexturing) 00054 * @return A new texture node 00055 */ 00056 LsgTexture* LsgTexture_create(LsgImage* data, int type, unsigned int mode, unsigned int unit); 00057 00058 /** 00059 * Constructor method for LsgTexture. Create a new texture object of a given type 00060 * with the provided pixel data. 00061 * @param self The instance variable 00062 * @param data The texture color data 00063 * @param type The texture type 00064 * @param mode The texture environment mode 00065 * @param unit The texture unit (0 for no multitexturing) 00066 */ 00067 void LsgTexture_init(LsgTexture* self, LsgImage* data, int type, unsigned int mode, unsigned int unit); 00068 00069 /** 00070 * Bind the texture object to the current texture engine and display all 00071 * children. 00072 * @param self The instance variable 00073 * @param frustum The view frustum 00074 */ 00075 void LsgTexture_display(LsgTexture* self, LsgFrustum* frustum); 00076 00077 /** 00078 * Destructor method for LsgTexture. Delete the texture object and the list of 00079 * child nodes. 00080 * @param self The instance variable 00081 */ 00082 void LsgTexture_destroy(LsgTexture* self); 00083 00084 /** 00085 * Clean all children. Reuse parent implementation. 00086 */ 00087 #define LsgTexture_clean(self) LsgGroup_clean(&(self)->super); 00088 00089 /** 00090 * Update all children. Reuse parent implementation. 00091 */ 00092 #define LsgTexture_update(self, now) LsgGroup_update(&(self)->super, now); 00093 00094 /** 00095 * Check collision with all children. Reuse parent implementation. 00096 */ 00097 #define LsgTexture_collide(self, v, n) LsgGroup_collide(&(self)->super, v, n); 00098 00099 #endif