Пример #1
0
        public Object3D(Vector3 pos, Matrix rotation, Vector3 scale, Object3DSettings renderSettings) : base(RenderEngine.Game)
        {
            if (renderSettings == null)
            {
                settings = new Object3DSettings();
            }
            else
            {
                settings = renderSettings;
            }

            maxForwardSpeed  = 0.2f;
            maxBackwardSpeed = 0.1f;
            maxTurningSpeed  = 0.1f;

            this.pos    = pos;
            this.oldPos = pos;
            this.yaw    = 0.0f;
            this.pitch  = 0.0f;
            this.roll   = 0.0f;
            this.scale  = scale;

            this.physics     = null;
            this.currentTime = 0.0f;

            this.worldMatrix  = Matrix.Identity;
            this.transMatrix  = Matrix.Identity;
            this.rotMatrix    = Matrix.Identity;
            this.scaleMatrix  = Matrix.CreateScale(scale);
            this.rotationQuat = Quaternion.Identity;
            rotateObjectQuaternion(rotation);

            this.viewVector      = new Vector3(0.0f, 0.0f, -1.0f);
            this.rightVector     = new Vector3(1.0f, 0.0f, 0.0f);
            this.upVector        = new Vector3(0.0f, 1.0f, 0.0f);
            this.localViewVector = Vector3.Zero;

            viewRay  = new Ray(pos, viewVector);
            rightRay = new Ray(pos, rightVector);
            upRay    = new Ray(pos, upVector);

            this.moving = false;
            this.mode   = "go";

            bs = new BoundingSphere();
            bb = new BoundingBox();

            rand = new Random();
        }
Пример #2
0
 public Skybox(SceneContainer scene, Vector3 pos, Matrix rotation, Vector3 scale, float width, float depth, Object3DSettings renderSettings) : base(scene, pos, rotation, scale, renderSettings)
 {
     this.scene = scene;
     this.width = width;
     this.depth = depth;
     initVertexBuffer();
     // Chapter 4.3.1, Listing 4.3.7
     // load textures
     backTexture   = scene.Game.Content.Load <Texture2D>("Textures/skybox0001");
     frontTexture  = scene.Game.Content.Load <Texture2D>("Textures/skybox0002");
     rightTexture  = scene.Game.Content.Load <Texture2D>("Textures/skybox0003");
     leftTexture   = scene.Game.Content.Load <Texture2D>("Textures/skybox0004");
     topTexture    = scene.Game.Content.Load <Texture2D>("Textures/skybox0005");
     bottomTexture = scene.Game.Content.Load <Texture2D>("Textures/skybox0006");
     //cube = new TextureCube(device, 1, 1, TextureUsage.None, SurfaceFormat.Dxt5);
 }
Пример #3
0
 public Object3D(SceneContainer scene, Vector3 pos, Matrix rotation, Vector3 scale, Object3DSettings renderSettings) : this(pos, rotation, scale, renderSettings)
 {
     scene.addObject(this); //setScene is called in addObject
 }