Exemplo n.º 1
0
        public OceanPage(OceanConfig config)
        {
            this.config = config;
            config.ConfigChange += new ConfigChangeHandler(ConfigChanged);

            material = (Material)MaterialManager.Instance.GetByName("MVSMOcean");
            if (material == null) {
                config.ShowOcean = false;
                return;
            }

            material.Load();

            // if the shader technique is supported, then use shaders
            useShaders = material.GetTechnique(0).IsSupported;

            // build the vertex buffer
            BuildVertexBuffer();

            // build the index buffer
            BuildIndexBuffer();

            // force update of shader variables in material
            UpdateMaterial();

            UpdateBounds();

            CastShadows = false;
        }
Exemplo n.º 2
0
        public OceanPage(OceanConfig config)
        {
            this.config          = config;
            config.ConfigChange += new ConfigChangeHandler(ConfigChanged);

            material = (Material)MaterialManager.Instance.GetByName("MVSMOcean");
            if (material == null)
            {
                config.ShowOcean = false;
                return;
            }

            material.Load();

            // if the shader technique is supported, then use shaders
            useShaders = material.GetTechnique(0).IsSupported;

            // build the vertex buffer
            BuildVertexBuffer();

            // build the index buffer
            BuildIndexBuffer();

            // force update of shader variables in material
            UpdateMaterial();

            UpdateBounds();

            CastShadows = false;
        }
Exemplo n.º 3
0
 public TextureScaleZValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }
Exemplo n.º 4
0
 public BumpSpeedZValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }
Exemplo n.º 5
0
 public ShallowColorValue(OceanConfig ocean)
     : base(AnimableType.ColorEx)
 {
     this.ocean = ocean;
     SetAsBaseValue(ColorEx.Black);
 }
Exemplo n.º 6
0
 public WaveHeightValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }
Exemplo n.º 7
0
 public SeaLevelValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }
        /// <summary>
        /// Initialize the world manager
        /// </summary>
        public void Initialize(SceneManager sceneManager, ITerrainGenerator gen, ILODSpec clientLodSpec, SceneNode root)
        {
            Debug.Assert(!initialized, "Attempt to initialize already initialized TerrainManager");
            scene = sceneManager;
            terrainGenerator = gen;
            terrainGenerator.TerrainChanged += TerrainGenerator_OnTerrainChanged;
            lodSpec = clientLodSpec ?? defaultLODSpec;

            pageSize = lodSpec.PageSize;
            visPageRadius = lodSpec.VisiblePageRadius;
            pageArraySize = (visPageRadius * 2) + 1;

            // Compute the size of a "subPage", which is the same as the smalles tile size.
            // We assume that the page containing the camera will have the smallest sized tiles.
            subPageSize = pageSize / TilesPerPage(0);

            minMetersPerSample = lodSpec.MetersPerSample(Vector3.Zero, 0, 0);
            maxMetersPerSample = lodSpec.MetersPerSample(Vector3.Zero, visPageRadius, visPageRadius * pageSize / subPageSize);

            rootSceneNode = root;
            worldRootSceneNode = rootSceneNode.CreateChildSceneNode("TerrainRoot");
            oceanSceneNode = rootSceneNode.CreateChildSceneNode("OceanNode");

            terrainMaterialConfig = new AutoSplatConfig();

            terrainDecalManager = new TerrainDecalManager(pageArraySize);

            shadowConfig = new ShadowConfig(scene);

            oceanConfig = new OceanConfig();
            oceanConfig.ConfigChange += OceanConfigChanged;
            ocean = new OceanPage(oceanConfig);

            oceanSceneNode.AttachObject(ocean);
            //ocean.ShowBoundingBox = true;
            showOcean = true;

            detailVeg = new DetailVeg(65, rootSceneNode);

            // allocate the page array
            pages = new Page[pageArraySize, pageArraySize];

            InitPages();

            heightFieldsCreated = false;

            boundaries = new List<Boundary>();
            roads = new Roads();

            SpeedTreeWrapper.SetDropToBillboard(true);

            // make sure variables based on camera location are up to date
            CameraLocation = cameraLocation;

            // set up material used by water boundaries
            waterMaterial = MaterialManager.Instance.GetByName("MVSMWater");
            if (waterMaterial != null)
                waterMaterial.Load();

            initialized = true;
        }
 public WaveHeightValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }
Exemplo n.º 10
0
 public TextureScaleZValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }
Exemplo n.º 11
0
 public ShallowColorValue(OceanConfig ocean)
     : base(AnimableType.ColorEx)
 {
     this.ocean = ocean;
     SetAsBaseValue(ColorEx.Black);
 }
Exemplo n.º 12
0
 public SeaLevelValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }
Exemplo n.º 13
0
 public BumpSpeedZValue(OceanConfig ocean)
     : base(AnimableType.Float)
 {
     this.ocean = ocean;
     SetAsBaseValue(0.0f);
 }