|
Blender
V2.59
|
00001 /* 00002 * $Id: KX_Light.h 35063 2011-02-22 10:33:14Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00034 #ifndef __KX_LIGHT 00035 #define __KX_LIGHT 00036 00037 #include "RAS_LightObject.h" 00038 #include "KX_GameObject.h" 00039 00040 struct GPULamp; 00041 struct Scene; 00042 class KX_Camera; 00043 class RAS_IRasterizer; 00044 class RAS_IRenderTools; 00045 class MT_Transform; 00046 00047 class KX_LightObject : public KX_GameObject 00048 { 00049 Py_Header; 00050 protected: 00051 RAS_LightObject m_lightobj; 00052 class RAS_IRenderTools* m_rendertools; //needed for registering and replication of lightobj 00053 bool m_glsl; 00054 Scene* m_blenderscene; 00055 00056 public: 00057 KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,class RAS_IRenderTools* rendertools,const struct RAS_LightObject& lightobj, bool glsl); 00058 virtual ~KX_LightObject(); 00059 virtual CValue* GetReplica(); 00060 RAS_LightObject* GetLightData() { return &m_lightobj;} 00061 00062 /* OpenGL Light */ 00063 bool ApplyLight(KX_Scene *kxscene, int oblayer, int slot); 00064 00065 /* GLSL Light */ 00066 struct GPULamp *GetGPULamp(); 00067 bool HasShadowBuffer(); 00068 int GetShadowLayer(); 00069 void BindShadowBuffer(class RAS_IRasterizer *ras, class KX_Camera *cam, class MT_Transform& camtrans); 00070 void UnbindShadowBuffer(class RAS_IRasterizer *ras); 00071 void Update(); 00072 00073 void UpdateScene(class KX_Scene *kxscene) {m_lightobj.m_scene = (void*)kxscene;} 00074 00075 virtual int GetGameObjectType() { return OBJ_LIGHT; } 00076 00077 #ifdef WITH_PYTHON 00078 /* attributes */ 00079 static PyObject* pyattr_get_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); 00080 static int pyattr_set_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); 00081 static PyObject* pyattr_get_typeconst(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); 00082 static PyObject* pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); 00083 static int pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); 00084 #endif 00085 }; 00086 00087 #endif //__KX_LIGHT 00088