コード例 #1
0
 /// <summary>
 /// Constructor. 
 /// </summary>
 /// <param name="graphics">The GraphicsDeviceManager for the EntityRenderer to use. </param>
 /// <param name="content">The ContentManager for the EntityRenderer to use.</param>
 public EntityRenderer(GraphicsDeviceManager graphics, ContentManager content)
 {
     options = new GraphicOptions(graphics, content);
     sceneList = new List<Scene>();
     sceneIdGenerator = new LowestAvailableID();
     RendererAssetPool.UniversalEffect = UniversalEffect.LoadEffect(content);
     activeScene = new Scene();
     GraphicOptions.Content = content;
     sceneList.Add(activeScene);
 }
コード例 #2
0
ファイル: Scene.cs プロジェクト: summer-of-software/vtank
        /// <summary>
        /// Creates and Initializes a new RendererScene with a camera named "Default" as the active camera.
        /// </summary>
        public Scene()
        {
            entityID = new LowestAvailableID();
            defaultPosition = Vector3.Zero;
            updateToggle = false;

            layers = new List<SceneLayer>();
            SceneLayer layer = new SceneLayer();
            layers.Add(layer);

            entityList = new Dictionary<int, Entity>();
            drawableEntities = new List<SceneLayer>();
            transparentEntities = new List<SceneLayer>();
            deleteQueue = new List<int>();
            TransparentWalls = true;

            cameraDictionary = new Dictionary<string, Camera>();

            CurrentCamera = new Camera();

            cameraDictionary.Add("Default", CurrentCamera);
            currentFrustum = new BoundingFrustum(CurrentCamera.Projection);

            shadowRenderTarget = GfxComponent.CreateRenderTarget(GraphicOptions.graphics.GraphicsDevice,
                1, SurfaceFormat.Single);
            shadowDepthBuffer =
                GfxComponent.CreateDepthStencil(shadowRenderTarget,
                DepthFormat.Depth24Stencil8Single);

            worldLight.Position = new Vector3(7000, 4000, 10000);
            worldLight.TargetPosition = Vector3.Zero;
            worldLight.View = Matrix.Identity;
            worldLight.Projection = Matrix.Identity;

            PercentOfDayComplete = 0.5f;
        }