00001 // Filename: fltLightSourceDefinition.h 00002 // Created by: drose (26Aug00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef FLTLIGHTSOURCEDEFINITION_H 00020 #define FLTLIGHTSOURCEDEFINITION_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "fltRecord.h" 00025 00026 #include <luse.h> 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : FltLightSourceDefinition 00030 // Description : Represents a single entry in the light source 00031 // palette. This completely defines the color, etc. of 00032 // a single light source, which may be referenced later 00033 // by a FltLightSource bead in the hierarchy. 00034 //////////////////////////////////////////////////////////////////// 00035 class FltLightSourceDefinition : public FltRecord { 00036 public: 00037 FltLightSourceDefinition(FltHeader *header); 00038 00039 enum LightType { 00040 LT_infinite = 0, 00041 LT_local = 1, 00042 LT_spot = 2 00043 }; 00044 00045 int _light_index; 00046 string _light_name; 00047 Colorf _ambient; 00048 Colorf _diffuse; 00049 Colorf _specular; 00050 LightType _light_type; 00051 float _exponential_dropoff; 00052 float _cutoff_angle; // in degrees 00053 00054 // yaw and pitch only for modeling lights, which are positioned at 00055 // the eyepoint. 00056 float _yaw; 00057 float _pitch; 00058 00059 float _constant_coefficient; 00060 float _linear_coefficient; 00061 float _quadratic_coefficient; 00062 bool _modeling_light; 00063 00064 protected: 00065 virtual bool extract_record(FltRecordReader &reader); 00066 virtual bool build_record(FltRecordWriter &writer) const; 00067 00068 public: 00069 virtual TypeHandle get_type() const { 00070 return get_class_type(); 00071 } 00072 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00073 static TypeHandle get_class_type() { 00074 return _type_handle; 00075 } 00076 static void init_type() { 00077 FltRecord::init_type(); 00078 register_type(_type_handle, "FltLightSourceDefinition", 00079 FltRecord::get_class_type()); 00080 } 00081 00082 private: 00083 static TypeHandle _type_handle; 00084 00085 friend class FltHeader; 00086 }; 00087 00088 #endif 00089 00090