geometry not showing

Apr 7, 2012 at 10:40 AM
Edited Apr 7, 2012 at 10:42 AM

 

Hi,

If I setup a Game container with a Box object inside, like the sample code bellow, the container will not render the box.
This is somehow related to the rotation/scale set on the box object and because the camera is close to the object, but this is something I need to have. If I set the rotation to 0 and scale to 1, I can see the box.
I'm using SL 4 with Balder from changeset 4ee4dbd23918, I tried it with release 0.8.8.9 also and it's the same.

Is there a way to solve this?

Thanks,
Vitor Fernandes

    public class Balder3DTest : Grid
    {
        public Game Viewport { get; set; }

        public Balder3DTest()
        {
            this.Viewport = new Game();
            this.Viewport.Width = 768;
            this.Viewport.Height = 576;

            this.Children.Add(this.Viewport);

            Camera camera = new Camera();
            camera.Position = new Coordinate(0, 1, -7);
            camera.Target = new Coordinate(0, 1, 0);
            camera.Near = 0.0f;
            camera.Far = 1000.0f;
            camera.FieldOfView = 79.2;
            camera.Up = new Vector(0, 1, 0);

            this.Viewport.Camera = camera;

            OmniLight light = new OmniLight();
            light.Ambient = Balder.Colors.White;
            light.Diffuse = Balder.Colors.White;
            light.Specular = Balder.Colors.White;
            light.Position = new Coordinate(0, 0, -200);
           
            this.Viewport.Children.Add(light);

            Box b = new Box();
            b.Dimension = new Coordinate(30, 30, 1);
            b.Position = new Coordinate(0, 0, 0);
            b.Material = new Material()
            {
                Diffuse = Balder.Colors.Green,
                Ambient = Balder.Colors.Green,
                Wireframe = true,
                Shade = MaterialShade.Flat
            };
            b.Rotation.X = 10;
            b.Scale.X = b.Scale.Y = 5;

            this.Viewport.Children.Add(b);
        }
    }