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