Example #1
0
        public SSpaceMissilesRenderManager(SSScene objScene, SSScene particleScene, SSScene screenScene,
                                           int particleCapacity = 10000)
        {
            _simulation = new SSpaceMissilesSimulation();

            _objScene = objScene;
            objScene.preRenderHooks += this._preRenderUpdate;

            objScene.preUpdateHooks += _simulation.updateSimulation;
            objScene.preRenderHooks += simulation.updateSimulation;

            _screenScene = screenScene;

            // particle system
            _particlesData    = new SSParticleSystemData(particleCapacity);
            _particleRenderer = new SSInstancedMeshRenderer(
                _particlesData, SSTexturedQuad.SingleFaceInstance);
            _particleRenderer.renderState.alphaBlendingOn = true;
            _particleRenderer.renderState.castsShadow     = false;
            _particleRenderer.renderState.receivesShadows = false;
            _particleRenderer.renderState.depthTest       = true;
            _particleRenderer.renderState.depthWrite      = false;
            //_particleRenderer.renderMode = SSInstancedMeshRenderer.RenderMode.CpuFallback;
            //_particleRenderer.renderMode = SSInstancedMeshRenderer.RenderMode.GpuInstancing;
            //_particleRenderer.renderState.visible = false;

            _particleRenderer.AmbientMatColor   = new Color4(1f, 1f, 1f, 1f);
            _particleRenderer.DiffuseMatColor   = new Color4(0f, 0f, 0f, 0f);
            _particleRenderer.EmissionMatColor  = new Color4(0f, 0f, 0f, 0f);
            _particleRenderer.SpecularMatColor  = new Color4(0f, 0f, 0f, 0f);
            _particleRenderer.ShininessMatColor = 0f;

            _particleRenderer.Name = "missile smoke renderer";
            particleScene.AddObject(_particleRenderer);
        }
        public SSpaceMissilesRenderManager (SSScene objScene, SSScene particleScene, SSScene screenScene,
                                            int particleCapacity = 10000)
        {
            _simulation = new SSpaceMissilesSimulation ();

            _objScene = objScene;
            objScene.preRenderHooks += this._preRenderUpdate;

            objScene.preUpdateHooks += _simulation.updateSimulation;
            objScene.preRenderHooks += simulation.updateSimulation;

            _screenScene = screenScene;

            // particle system
            _particlesData = new SSParticleSystemData (particleCapacity);
            _particleRenderer = new SSInstancedMeshRenderer (
                _particlesData, SSTexturedQuad.SingleFaceInstance);
            _particleRenderer.renderState.alphaBlendingOn = true;
            _particleRenderer.renderState.castsShadow = false;
            _particleRenderer.renderState.receivesShadows = false;
            _particleRenderer.renderState.depthTest = true;
            _particleRenderer.renderState.depthWrite = false;
            //_particleRenderer.renderMode = SSInstancedMeshRenderer.RenderMode.CpuFallback;
            //_particleRenderer.renderMode = SSInstancedMeshRenderer.RenderMode.GpuInstancing;
            //_particleRenderer.renderState.visible = false;

            _particleRenderer.AmbientMatColor = new Color4 (1f, 1f, 1f, 1f);
            _particleRenderer.DiffuseMatColor = new Color4 (0f, 0f, 0f, 0f);
            _particleRenderer.EmissionMatColor = new Color4(0f, 0f, 0f, 0f);
            _particleRenderer.SpecularMatColor = new Color4 (0f, 0f, 0f, 0f);
            _particleRenderer.ShininessMatColor = 0f;

            _particleRenderer.Name = "missile smoke renderer";
            particleScene.AddObject(_particleRenderer);
        }