|
|
@@ -14,7 +14,8 @@ Light::Light(LightType t, const char* fmtl, // Light
|
|
|
const char* name, Scene* scene, // Scene
|
|
|
uint movableFlags, Movable* movParent, // Movable
|
|
|
CollisionShape* cs) // Spatial
|
|
|
- : SceneNode(name, scene), Movable(movableFlags, movParent),
|
|
|
+ : SceneNode(name, scene),
|
|
|
+ Movable(movableFlags, movParent, *this),
|
|
|
Spatial(cs), type(t)
|
|
|
{
|
|
|
mtl.load(fmtl);
|
|
|
@@ -37,13 +38,26 @@ PointLight::PointLight(const char* fmtl,
|
|
|
uint movableFlags, Movable* movParent)
|
|
|
: Light(LT_POINT, fmtl, name, scene, movableFlags, movParent, &sphereW)
|
|
|
{
|
|
|
- Property<PerspectiveFrustum>* prop =
|
|
|
- new ReadWritePointerProperty<PerspectiveFrustum>("frustum", &frustum);
|
|
|
+ PropertyBase& pbase = findPropertyBaseByName("radius");
|
|
|
+ Property<float>& prop = pbase.upCast<Property<float> >();
|
|
|
+ ANKI_CONNECT(&prop, valueChanged, this, updateRadius);
|
|
|
|
|
|
- addNewProperty(prop);
|
|
|
-
|
|
|
- ANKI_CONNECT(prop, valueChanged, this, updateFrustumSlot);
|
|
|
+ sphereL.setCenter(Vec3(0.0));
|
|
|
+ sphereL.setRadius(prop.getValue());
|
|
|
}
|
|
|
|
|
|
|
|
|
+//==============================================================================
|
|
|
+// SpotLight =
|
|
|
+//==============================================================================
|
|
|
+
|
|
|
+//==============================================================================
|
|
|
+SpotLight::SpotLight(const char* fmtl,
|
|
|
+ const char* name, Scene* scene,
|
|
|
+ uint movableFlags, Movable* movParent)
|
|
|
+ : Light(LT_SPOT, fmtl, name, scene, movableFlags, movParent, &frustum),
|
|
|
+ Frustumable(frustum)
|
|
|
+{}
|
|
|
+
|
|
|
+
|
|
|
} // end namespace
|