carlightbase.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. class CarLightBase extends SpotLightBase
  2. {
  3. // What follows are just default light parameters which are overwriten down in the hierarchy in constructors.
  4. // 'Segregated' means value for a light source that consists of 1 bulb (ex.: when 1 of 2 headlights are destroyed)
  5. // 'Aggregated' means value for 1 light source that consists of 2 bulbs (ex.: when both headlights are shining, or brake & reverse lights are shining at once)
  6. // Aggregating lights saves a lot of performance
  7. float m_SegregatedBrightness = 20;
  8. float m_SegregatedRadius = 66;
  9. float m_SegregatedAngle = 90;
  10. vector m_SegregatedColorRGB = Vector(1.0, 0.8, 0.6);
  11. float m_AggregatedBrightness = 30;
  12. float m_AggregatedRadius = 100;
  13. float m_AggregatedAngle = 100;
  14. vector m_AggregatedColorRGB = Vector(1.0, 0.8, 0.6);
  15. void CarLightBase()
  16. {
  17. SetVisibleDuringDaylight(true);
  18. SetCastShadow(true);
  19. SetFlareVisible(true);
  20. FadeIn(0.3);
  21. SetFadeOutTime(0.25);
  22. }
  23. void AggregateLight()
  24. {
  25. SetRadiusTo(m_AggregatedRadius);
  26. SetSpotLightAngle(m_AggregatedAngle);
  27. SetBrightnessTo(m_AggregatedBrightness);
  28. SetAmbientColor(m_AggregatedColorRGB[0], m_AggregatedColorRGB[1], m_AggregatedColorRGB[2]);
  29. SetDiffuseColor(m_AggregatedColorRGB[0], m_AggregatedColorRGB[1], m_AggregatedColorRGB[2]);
  30. SetFlareVisible(false);
  31. }
  32. void SegregateLight()
  33. {
  34. SetRadiusTo(m_SegregatedRadius);
  35. SetSpotLightAngle(m_SegregatedAngle);
  36. SetBrightnessTo(m_SegregatedBrightness);
  37. SetAmbientColor(m_SegregatedColorRGB[0], m_SegregatedColorRGB[1], m_SegregatedColorRGB[2]);
  38. SetDiffuseColor(m_SegregatedColorRGB[0], m_SegregatedColorRGB[1], m_SegregatedColorRGB[2]);
  39. SetFlareVisible(true);
  40. }
  41. }