Beispiel #1
0
 public BoundingBox3D(D3DEngine d3dEngine, WorldFocusManager worldFocusManager, Vector3 BBDimension, HLSLVertexPositionColor effect, ByteColor color)
 {
     _d3dEngine         = d3dEngine;
     _worldFocusManager = worldFocusManager;
     _wrappedEffect     = effect;
     CreateBBShape(BBDimension, ref color);
 }
Beispiel #2
0
 public CameraManager(InputsManager inputManager, WorldFocusManager worldFocusManager, TCamType camera = null)
 {
     _inputManager      = inputManager;
     _worldFocusManager = worldFocusManager;
     if (camera != null)
     {
         RegisterNewCamera(camera);
     }
 }
Beispiel #3
0
 public FirstPersonCameraWithFocus(D3DEngine d3dEngine,
                                   WorldFocusManager worldFocusManager,
                                   float nearPlane,
                                   float farPlane)
     : base(d3dEngine, nearPlane, farPlane)
 {
     _worldFocusManager = worldFocusManager;
     this.CameraType    = Cameras.CameraType.FirstPerson;
 }
        public ThirdPersonCameraWithFocus(D3DEngine d3dEngine,
                                          WorldFocusManager worldFocusManager,
                                          float nearPlane,
                                          float farPlane,
                                          InputsManager inputManager)
            : base(d3dEngine, nearPlane, farPlane)
        {
            _inputManager      = inputManager;
            _worldFocusManager = worldFocusManager;
            this.CameraType    = Cameras.CameraType.ThirdPerson;

            MaxDistance = 50f;
        }
Beispiel #5
0
        /// <summary>
        /// Regular Skydome loading
        /// </summary>
        public RegularSkyDome(D3DEngine d3dEngine, CameraManager <ICameraFocused> camManager, WorldFocusManager worldFocusManager, IClock clock, IWeather weather, [Named("Stars")] IDrawableComponent skyStars, [Named("Clouds")] IDrawableComponent clouds)
            : base(d3dEngine, clock, weather)
        {
            this.IsDefferedLoadContent = true;

            _camManager        = camManager;
            _worldFocusManager = worldFocusManager;
            _clock             = clock;
            _skyStars          = skyStars;
            _clouds            = clouds;

            this.DrawOrders.UpdateIndex(0, 40);
            cloudDrawIndex = this.DrawOrders.AddIndex(989, "Clouds");
        }
Beispiel #6
0
        public Clouds(D3DEngine engine, [Named("SkyBuffer")] StaggingBackBuffer skyBackBuffer, IClock worldclock, WorldFocusManager worldFocusManager, CameraManager <ICameraFocused> cameraManager, IWeather weather)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }
            _d3DEngine         = engine;
            _skyBackBuffer     = skyBackBuffer;
            _worldclock        = worldclock;
            _worldFocusManager = worldFocusManager;
            _cameraManager     = cameraManager;
            _weather           = weather;

            _skyBackBuffer.OnStaggingBackBufferChanged += _skyBackBuffer_OnStaggingBackBufferChanged;
        }
Beispiel #7
0
        public PickingRenderer(D3DEngine engine,
                               WorldFocusManager focusManager,
                               CameraManager <ICameraFocused> camManager)
        {
            _engine       = engine;
            _focusManager = focusManager;
            _camManager   = camManager;



            //Change default Draw order to 10000
            this.DrawOrders.UpdateIndex(0, 1020);

            this.IsDefferedLoadContent = true;
        }
Beispiel #8
0
        public WorldShadowMap(
            CameraManager <ICameraFocused> camManager,
            D3DEngine d3dEngine,
            WorldFocusManager worldFocusManager,
            IClock clock
            )
        {
            DrawOrders.UpdateIndex(0, 99, "SM_CREATION");

            _smDrawID = DrawOrders.AddIndex(10000, "SM_DRAW");


            _d3dEngine         = d3dEngine;
            _camManager        = camManager;
            _worldFocusManager = worldFocusManager;
            _clock             = clock;
        }
        public DynamicEntityManager(D3DEngine d3DEngine,
                                    VoxelModelManager voxelModelManager,
                                    CameraManager <ICameraFocused> camManager,
                                    WorldFocusManager worldFocusManager,
                                    VisualWorldParameters visualWorldParameters,
                                    SingleArrayChunkContainer chunkContainer,
                                    IPlayerManager playerEntityManager,
                                    ISkyDome skyDome,
                                    SharedFrameCB sharedFrameCB,
                                    IWorldChunks worldChunks,
                                    ISoundEngine soundEngine,
                                    UtopiaParticuleEngine utopiaParticuleEngine
                                    )
        {
            _d3DEngine             = d3DEngine;
            _voxelModelManager     = voxelModelManager;
            _camManager            = camManager;
            _chunkContainer        = chunkContainer;
            _soundEngine           = soundEngine;
            _worldFocusManager     = worldFocusManager;
            _visualWorldParameters = visualWorldParameters;
            _playerEntityManager   = playerEntityManager;
            _playerEntityManager.UtopiaParticuleEngine = utopiaParticuleEngine;
            _skyDome               = skyDome;
            _sharedFrameCB         = sharedFrameCB;
            _worldChunks           = worldChunks;
            _utopiaParticuleEngine = utopiaParticuleEngine;

            _voxelModelManager.VoxelModelAvailable += VoxelModelManagerVoxelModelReceived;
            _camManager.ActiveCameraChanged        += CamManagerActiveCameraChanged;

            _playerEntityManager.PlayerEntityChanged += _playerEntityManager_PlayerEntityChanged;

            DynamicEntities = new List <VisualVoxelEntity>();

            DrawOrders.UpdateIndex(VOXEL_DRAW, 99, "VOXEL_DRAW");
            SPRITENAME_DRAW = DrawOrders.AddIndex(1060, "NAME_DRAW");

            this.IsDefferedLoadContent = true;
        }
Beispiel #10
0
        public VisualChunkBase(
            D3DEngine d3DEngine,
            WorldFocusManager worldFocusManager,
            VisualWorldParameters visualWorldParameter,
            Range3I cubeRange,
            CameraManager <ICameraFocused> cameraManager,
            WorldChunks worldChunkManager,
            VoxelModelManager voxelModelManager,
            IChunkEntityImpactManager chunkEntityImpactManager,
            ChunkDataProvider provider = null)
            : base(provider)
        {
            _cachedTrees = new Dictionary <TreeBpSeed, VisualVoxelModel>();

            Graphics = new ChunkGraphics(this, d3DEngine);

            _d3DEngine                = d3DEngine;
            _worldFocusManager        = worldFocusManager;
            _worldChunkManager        = worldChunkManager;
            _chunkEntityImpactManager = chunkEntityImpactManager;
#if DEBUG
            _blockpickedUPEffect = new HLSLVertexPositionColor(_d3DEngine.Device);
#endif

            _visualWorldParameters = visualWorldParameter;

            _cameraManager        = cameraManager;
            _voxelModelManager    = voxelModelManager;
            _visualVoxelEntities  = new Dictionary <string, List <VisualVoxelEntity> >();
            EmitterStaticEntities = new List <EntityMetaData>();
            OutOfChunkLightSourceStaticEntities = new List <ILightEmitterEntity>();
            SoundStaticEntities = new List <IItem>();
            CubeRange           = cubeRange;
            State = ChunkState.Empty;
            Entities.EntityAdded       += EntitiesEntityAdded;
            Entities.EntityRemoved     += EntitiesEntityRemoved;
            Entities.CollectionCleared += EntitiesCollectionCleared;
        }
Beispiel #11
0
 public VisualChunk(D3DEngine d3DEngine,
                    WorldFocusManager worldFocusManager,
                    VisualWorldParameters visualWorldParameter,
                    ref Range3I cubeRange,
                    SingleArrayChunkContainer singleArrayContainer,
                    CameraManager <ICameraFocused> cameraManager,
                    WorldChunks worldChunkManager,
                    VoxelModelManager voxelModelManager,
                    IChunkEntityImpactManager chunkEntityImpactManager,
                    ChunkDataProvider provider = null)  :
     base(d3DEngine,
          worldFocusManager,
          visualWorldParameter,
          cubeRange,
          cameraManager,
          worldChunkManager,
          voxelModelManager,
          chunkEntityImpactManager,
          new SingleArrayDataProvider(singleArrayContainer))
 {
     ((SingleArrayDataProvider)base.BlockData).DataProviderUser = this; //Didn't find a way to pass it inside the constructor
     _singleArrayContainer = singleArrayContainer;
 }
Beispiel #12
0
 public VisualChunk3D(
     D3DEngine d3DEngine,
     WorldFocusManager worldFocusManager,
     VisualWorldParameters visualWorldParameter,
     Range3I cubeRange,
     CameraManager <ICameraFocused> cameraManager,
     WorldChunks worldChunkManager,
     VoxelModelManager voxelModelManager,
     IChunkEntityImpactManager chunkEntityImpactManager,
     ChunkDataProvider provider = null) :
     base(
         d3DEngine,
         worldFocusManager,
         visualWorldParameter,
         cubeRange,
         cameraManager,
         worldChunkManager,
         voxelModelManager,
         chunkEntityImpactManager,
         provider)
 {
     _lights = new ByteColor[BlockData.ChunkSize.Volume];
 }
Beispiel #13
0
        public WorldChunks(D3DEngine d3dEngine,
                           CameraManager <ICameraFocused> camManager,
                           VisualWorldParameters visualWorldParameters,
                           WorldFocusManager worldFocusManager,
                           GameStatesManager gameStates,
                           IClock gameClock,
                           SingleArrayChunkContainer cubesHolder,
                           ILandscapeManager2D landscapeManager,
                           IChunkMeshManager chunkMeshManager,
                           IChunksWrapper chunkWrapper,
                           ILightingManager lightingManager,
                           IChunkStorageManager chunkstorage,
                           ServerComponent server,
                           IWeather weather,
                           [Named("SkyBuffer")] StaggingBackBuffer skyBackBuffer,
                           VoxelModelManager voxelModelManager,
                           IChunkEntityImpactManager chunkEntityImpactManager,
                           InputsManager inputsManager
                           )
        {
            _server                   = server;
            _chunkstorage             = chunkstorage;
            _d3dEngine                = d3dEngine;
            _worldFocusManager        = worldFocusManager;
            _gameStates               = gameStates;
            _camManager               = camManager;
            _gameClock                = gameClock;
            VisualWorldParameters     = visualWorldParameters;
            _cubesHolder              = cubesHolder;
            _chunkWrapper             = chunkWrapper;
            _landscapeManager         = landscapeManager;
            _chunkMeshManager         = chunkMeshManager;
            _lightingManager          = lightingManager;
            _weather                  = weather;
            _skyBackBuffer            = skyBackBuffer;
            _voxelModelManager        = voxelModelManager;
            _chunkEntityImpactManager = chunkEntityImpactManager;
            _inputsManager            = inputsManager;

            _skyBackBuffer.OnStaggingBackBufferChanged += _skyBackBuffer_OnStaggingBackBufferChanged;

            SliceViewChunks = 25;

            DrawStaticInstanced = true;

            if (visualWorldParameters.WorldParameters.Configuration is UtopiaWorldConfiguration)
            {
                _utopiaProcessorParam = ((UtopiaWorldConfiguration)visualWorldParameters.WorldParameters.Configuration).ProcessorParam;
            }

            //Self injecting inside components, to avoid circular dependency
            _chunkWrapper.WorldChunks     = this;
            lightingManager.WorldChunk    = this;
            _chunkMeshManager.WorldChunks = this;
            landscapeManager.WorldChunks  = this;

            DrawOrders.UpdateIndex(SOLID_DRAW, 100, "SOLID_DRAW");
            TRANSPARENT_DRAW = DrawOrders.AddIndex(1050, "TRANSPARENT_DRAW");
            ENTITIES_DRAW    = DrawOrders.AddIndex(101, "ENTITIES_DRAW");

            this.IsDefferedLoadContent = true;
        }