- light.LightType = LightType.Directional;
-
- // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
- // quaternion from Euler angles where the Y angle (rotation about the Y axis) is randomized. The mushroom model contains
- // LOD levels, so the StaticModel component will automatically select the LOD level according to the view distance (you'll
- // see the model get simpler as it moves further away). Finally, rendering a large number of the same object with the
- // same material allows instancing to be used, if the GPU supports it. This reduces the amount of CPU work in rendering the
- // scene.
- Material mushroomMat = cache.GetMaterial("Materials/Mushroom.xml");
- // Apply shader parameter animation to material
- ValueAnimation specColorAnimation=new ValueAnimation();
-
- specColorAnimation.SetKeyFrame(0.0f, new Color(0.1f, 0.1f, 0.1f, 16.0f));
- specColorAnimation.SetKeyFrame(1.0f, new Color(1.0f, 0.0f, 0.0f, 2.0f));
- specColorAnimation.SetKeyFrame(2.0f, new Color(1.0f, 1.0f, 0.0f, 2.0f));
- specColorAnimation.SetKeyFrame(3.0f, new Color(0.1f, 0.1f, 0.1f, 16.0f));
- // Optionally associate material with scene to make sure shader parameter animation respects scene time scale
- mushroomMat.Scene=scene;
- mushroomMat.SetShaderParameterAnimation("MatSpecColor", specColorAnimation, WrapMode.Loop, 1.0f);
-
- const uint numObjects = 200;