protected virtual void setupHUD()
        {
            hudScene.renderConfig.projectionMatrix = Matrix4.Identity;

            // HUD Triangle...
            //SSObject triObj = new SSObjectTriangle ();
            //hudScene.addObject (triObj);
            //triObj.Pos = new Vector3 (50, 50, 0);
            //triObj.Scale = new Vector3 (50.0f);

            // HUD text....
            fpsDisplay = new SSObjectGDISurface_Text ();
            fpsDisplay.Label = "FPS: ...";
            fpsDisplay.alphaBlendingEnabled = true;
            hudScene.AddObject (fpsDisplay);
            fpsDisplay.Pos = new Vector3 (10f, 10f, 0f);
            fpsDisplay.Scale = new Vector3 (1.0f);

            // wireframe mode text....
            wireframeDisplay = new SSObjectGDISurface_Text ();
            wireframeDisplay.alphaBlendingEnabled = true;
            hudScene.AddObject (wireframeDisplay);
            wireframeDisplay.Pos = new Vector3 (10f, 40f, 0f);
            wireframeDisplay.Scale = new Vector3 (1.0f);
            updateWireframeDisplayText ();
        }
        public void setupHUD()
        {
            hudScene = new SSScene ();

            // HUD Triangle...
            //SSObject triObj = new SSObjectTriangle ();
            //hudScene.addObject (triObj);
            //triObj.Pos = new Vector3 (50, 50, 0);
            //triObj.Scale = new Vector3 (50.0f);

            // HUD text....
            fpsDisplay = new SSObjectGDISurface_Text ();
            fpsDisplay.Label = "FPS: ...";
            hudScene.addObject (fpsDisplay);
            fpsDisplay.Pos = new Vector3 (10f, 10f, 0f);
            fpsDisplay.Scale = new Vector3 (1.0f);

            // wireframe mode text....
            wireframeDisplay = new SSObjectGDISurface_Text ();
            hudScene.addObject (wireframeDisplay);
            wireframeDisplay.Pos = new Vector3 (10f, 40f, 0f);
            wireframeDisplay.Scale = new Vector3 (1.0f);
            updateWireframeDisplayText (scene.renderConfig);
        }
示例#3
0
        protected override void setupScene()
        {
            base.setupScene();

            var droneMesh = SSAssetManager.GetInstance<SSMesh_wfOBJ> ("./drone2/", "Drone2.obj");
            //var droneMesh = SSAssetManager.GetInstance<SSMesh_wfOBJ> ("missiles", "missile.obj");
            var vandalMesh = SSAssetManager.GetInstance<SSMesh_wfOBJ> ("missiles", "vandal_assembled.obj");

            // add drones
            attackerDrone = new SSObjectMesh (droneMesh);
            attackerDrone.Pos = new OpenTK.Vector3(-20f, 0f, 0f);
            attackerDrone.Orient(Vector3.UnitX, Vector3.UnitY);
            attackerDrone.AmbientMatColor = new Color4(0.1f,0.1f,0.1f,0.1f);
            attackerDrone.DiffuseMatColor = new Color4(0.3f,0.3f,0.3f,0.3f);
            attackerDrone.SpecularMatColor = new Color4(0.3f,0.3f,0.3f,0.3f);
            attackerDrone.EmissionMatColor = new Color4(0.3f,0.3f,0.3f,0.3f);
            attackerDrone.Name = "attacker drone";
            main3dScene.AddObject (attackerDrone);

            targetDrone = new SSObjectMesh (droneMesh);
            targetDrone.Pos = new OpenTK.Vector3(200f, 0f, 0f);
            targetDrone.Orient(-Vector3.UnitX, Vector3.UnitY);
            targetDrone.AmbientMatColor = new Color4(0.1f,0.1f,0.1f,0.1f);
            targetDrone.DiffuseMatColor = new Color4(0.3f,0.3f,0.3f,0.3f);
            targetDrone.SpecularMatColor = new Color4(0.3f,0.3f,0.3f,0.3f);
            targetDrone.EmissionMatColor = new Color4(0.3f,0.3f,0.3f,0.3f);
            targetDrone.Name = "target drone";
            targetDrone.MainColor = new Color4(1f, 0f, 0.7f, 1f);
            main3dScene.AddObject (targetDrone);

            vandalShip = new SSObjectMesh (vandalMesh);
            vandalShip.Pos = new OpenTK.Vector3(100f, 0f, 0f);
            vandalShip.Scale = new Vector3 (0.05f);
            vandalShip.AmbientMatColor = new Color4(0.1f,0.1f,0.1f,0.1f);
            vandalShip.DiffuseMatColor = new Color4(0.1f,0.1f,0.1f,0.1f);
            vandalShip.SpecularMatColor = new Color4(0.1f,0.1f,0.1f,0.1f);
            vandalShip.EmissionMatColor = new Color4(0.0f,0.0f,0.0f,0.0f);
            vandalShip.Name = "Vandal ship";
            vandalShip.MainColor = new Color4 (0.6f, 0.6f, 0.6f, 1f);
            //vandalShip.MainColor = new Color4(1f, 0f, 0.7f, 1f);
            //droneObj2.renderState.visible = false;
            vandalShip.Orient((targetDrone.Pos-vandalShip.Pos).Normalized(), Vector3.UnitY);
            main3dScene.AddObject (vandalShip);

            // shows explosions
            explosionManager = new SExplosionRenderManager ();
            explosionManager.particleSystem.doShockwave = false;
            explosionManager.particleSystem.doDebris = false;
            explosionManager.particleSystem.timeScale = 3f;
            //explosionManager.renderState.visible = false;
            alpha3dScene.AddObject(explosionManager);

            // attacker drone missile parameters
            attackerDroneMissileParams = new SSpaceMissileParameters();
            attackerDroneMissileParams.targetHitHandlers += targetHitHandler;

            // vandal missile params
            vandalShipMissileParams = new SSpaceMissileParameters();
            vandalShipMissileParams.spawnGenerator = null;
            vandalShipMissileParams.spawnTxfm = straightMissileSpawnTxfm;
            vandalShipMissileParams.ejectionMaxRotationVel = 0.05f;
            vandalShipMissileParams.ejectionVelocity = 15f;

            vandalShipMissileParams.targetHitHandlers += targetHitHandler;
            vandalShipMissileParams.pursuitActivationTime = 0.1f;
            vandalShipMissileParams.ejectionSmokeDuration = 0.5f;
            vandalShipMissileParams.ejectionSmokeSizeMax = 5f;

            cameraMissileParams = new SSpaceMissileParameters();
            cameraMissileParams.targetHitHandlers += targetHitHandler;
            cameraMissileParams.spawnGenerator = null;
            cameraMissileParams.spawnTxfm = straightMissileSpawnTxfm;
            cameraMissileParams.ejectionMaxRotationVel = 0.05f;
            cameraMissileParams.ejectionVelocity = 10f;

            // missile manager
            missileManager = new SSpaceMissilesRenderManager(main3dScene, alpha3dScene, hud2dScene);

            // additional statistics text
            missileStatsText = new SSObjectGDISurface_Text();
            missileStatsText.alphaBlendingEnabled = true;
            missileStatsText.Label = "stats placeholder...";
            missileStatsText.Pos = new Vector3 (100f, 100f, 0f);
            //missileStatsText.Size = 20f;
            hud2dScene.AddObject(missileStatsText);

            var targetsManager = new SHudTargetsManager (main3dScene, hud2dScene);
            targetHud = targetsManager.addTarget(
                Color4.Red,
                _showDistanceFunc,
                (o) => o != null ? o.Name : "none",
                getTargetObject()
            );
        }