private SceneNodeBase GetRootElement() { var group = new GroupNode(); var lightPosition = new vec3(0, 3, 5) * 2; var localLight = new SpotLight(lightPosition, new vec3(0, 0, 0), 60, 1, 500) { Color = new vec3(1, 1, 1), }; { var lightContainer = new LightContainerNode(localLight); { var model = new Teapot(); var node = ShadowMappingNode.Create(model, Teapot.strPosition, Teapot.strNormal, model.GetModelSize()); node.Diffuse = Color.Gold.ToVec3(); node.RotateSpeed = 1; lightContainer.Children.Add(node); } { var model = new GroundModel(); var node = ShadowMappingNode.Create(model, GroundModel.strPosition, GroundModel.strNormal, model.ModelSize); node.Diffuse = Color.AliceBlue.ToVec3(); node.Scale *= 30; node.WorldPosition = new vec3(0, -3, 0); lightContainer.Children.Add(node); } group.Children.Add(lightContainer); } { var rectangle = RectangleNode.Create(); rectangle.TextureSource = localLight; rectangle.RotationAngle = 45; rectangle.WorldPosition = new vec3(5, 1, 5) * 3; rectangle.Scale *= 4; group.Children.Add(rectangle); } { var cube = LightPostionNode.Create(); cube.WorldPosition = lightPosition; cube.SetLight(localLight); group.Children.Add(cube); } return(group); }
private SceneNodeBase GetRootElement() { var group = new GroupNode(); { var model = new Teapot(); var node = ShadowMappingNode.Create(model, Teapot.strPosition, Teapot.strNormal, model.GetModelSize()); node.Color = Color.Gold.ToVec3(); node.RotateSpeed = 1; group.Children.Add(node); } { var model = new GroundModel(); var node = ShadowMappingNode.Create(model, GroundModel.strPosition, GroundModel.strNormal, model.ModelSize); node.Color = Color.White.ToVec3(); node.Scale *= 100; node.WorldPosition = new vec3(0, -3, 0); group.Children.Add(node); } return(group); }