00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "Teddy/TeddyConfig.h"
00026 #if defined( TEDDY_INCLUDE_LW_SCENE )
00027
00028
00029 #include "Teddy/Imports/LWLight.h"
00030 #include "Teddy/Imports/LWMotion.h"
00031 #include "Teddy/Imports/LWModel.h"
00032 #include "Teddy/Imports/LWMotion.h"
00033 #include "Teddy/Imports/LWChannelEnvelope.h"
00034 #include "Teddy/SysSupport/Messages.h"
00035 using namespace Teddy::Graphics;
00036 using namespace Teddy::Materials;
00037 using namespace Teddy::SysSupport;
00038
00039
00040 namespace Teddy {
00041 namespace Imports {
00042
00043
00044 LWLight::LWLight():LWInstance(){
00045 light = NULL;
00046 ambient_color = Color::BLACK;
00047 amb_intensity = 0.0;
00048 }
00049
00050 void LWLight::setColor( double r, double g, double b ){
00051 this->color = Color( r, g, b );
00052 dmsg( M_LWS, "Light color %f, %f, %f", r, g, b );
00053
00054 }
00055
00056 void LWLight::setType ( int type ){ this->type = type; }
00057 void LWLight::setFalloffType ( int falloff_type ){ this->falloff_type = falloff_type; }
00058 void LWLight::setRange ( double range ){ this->range = range; }
00059 void LWLight::setConeAngle ( double cone_angle ){ this->cone_angle = cone_angle; }
00060 void LWLight::setEdgeAngle ( double edge_angle ){ this->edge_angle = edge_angle; }
00061 void LWLight::setIntensity ( double intensity ){ this->intensity = intensity; }
00062 void LWLight::setFalloff ( double falloff ){ this->falloff = falloff; }
00063 void LWLight::setAffectCaustics ( int affect_caustics ){ this->affect_caustics = affect_caustics; }
00064 void LWLight::setAffectDiffuse ( int affect_diffuse ){ this->affect_diffuse = affect_diffuse ; }
00065 void LWLight::setAffectSpecular ( int affect_specular ){ this->affect_specular = affect_specular; }
00066 void LWLight::setAffectOpenGL ( int affect_opengl ){ this->affect_opengl = affect_opengl ; }
00067 void LWLight::setUseConeAngle ( int use_cone_angle ){ this->use_cone_angle = use_cone_angle ; }
00068 void LWLight::setLensFlare ( int lens_flare ){ this->lens_flare = lens_flare ; }
00069 void LWLight::setFlareIntensity ( double flare_intensity ){ this->flare_intensity = flare_intensity; }
00070 void LWLight::setFlareDissolve ( double flare_dissolve ){ this->flare_dissolve = flare_dissolve ; }
00071 void LWLight::setLensFlareFade ( int lens_flare_fade ){ this->lens_flare_fade = lens_flare_fade; }
00072 void LWLight::setLensFlareOptions ( int lens_flare_options ){ this->lens_flare_options = lens_flare_options; }
00073 void LWLight::setFlareRandStreakInt ( double flare_rand_streak_int ){ this->flare_rand_streak_int = flare_rand_streak_int; }
00074 void LWLight::setFlareRandStreakDens ( double flare_rand_streak_dens ){ this->flare_rand_streak_dens = flare_rand_streak_dens; }
00075 void LWLight::setFlareRandStreakSharp( double flare_rand_streak_sharp ){ this->flare_rand_streak_sharp = flare_rand_streak_sharp; }
00076 void LWLight::setShadowType ( int shadow_type ){ this->shadow_type = shadow_type ; }
00077 void LWLight::setShadowCasting ( int shadow_casting ){ this->shadow_casting = shadow_casting ; }
00078 void LWLight::setShadowMapSize ( int shadow_map_size ){ this->shadow_map_size = shadow_map_size ; }
00079 void LWLight::setShadowMapAngle ( double shadow_map_angle ){ this->shadow_map_angle = shadow_map_angle ; }
00080 void LWLight::setShadowFuzziness ( double shadow_fuzziness ){ this->shadow_fuzziness = shadow_fuzziness ; }
00081
00082
00083 Light *LWLight::getLight(){
00084 return this->light;
00085 }
00086
00087
00088 void LWLight::genLight(){
00089 light = new Light( getModelName() );
00090 dmsg( M_LWS, "genLight color % 8.4f, % 8.4f, % 8.4f", color.rgba[0], color.rgba[1], color.rgba[2] );
00091
00092 switch( type ){
00093 case 0:
00094 light->setType( Light::TYPE_DIRECTIONAL ); break;
00095 case 1:
00096 light->setType( Light::TYPE_POSITIONAL ); break;
00097 case 2:
00098 break;
00099 case 3:
00100 break;
00101 case 4:
00102 break;
00103 default:
00104 break;
00105 }
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 light->setAmbient ( Color::BLACK );
00116 light->setDiffuse ( color );
00117 light->setSpecular( Color::WHITE );
00118
00119
00120
00121
00122 light->enable ();
00123 }
00124
00125
00126 };
00127 };
00128
00129
00130 #endif // TEDDY_INCLUDE_LW_SCENE