public void RenderWaterReflection(WaterPlane water, BaseCamera camera, ref Matrix4 ProjectionMatrix, Vector4 clipPlane, bool bApplyLensFlareScale = false) { if (m_postConstructor) { return; } Matrix4 modelMatrix = Matrix4.Identity; if (bApplyLensFlareScale) { modelMatrix *= Matrix4.CreateScale(LENS_FLARE_SIZE_TO_SUN_SIZE, -LENS_FLARE_SIZE_TO_SUN_SIZE, LENS_FLARE_SIZE_TO_SUN_SIZE); } float translationPositionY = (2 * water.GetTranslation().Y) - m_lightSource.Position.Y; modelMatrix *= Matrix4.CreateTranslation(m_lightSource.Position.X, translationPositionY, m_lightSource.Position.Z); GL.Enable(EnableCap.ClipDistance0); m_shader.startProgram(); m_texture1.BindTexture(TextureUnit.Texture0); m_texture2.BindTexture(TextureUnit.Texture1); m_shader.setUniformValues(ref modelMatrix, camera.GetViewMatrix(), ref ProjectionMatrix, m_lightSource, 0, 1); m_shader.SetClipPlane(ref clipPlane); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); m_buffer.RenderVAO(PrimitiveType.Triangles); GL.Disable(EnableCap.Blend); m_shader.stopProgram(); GL.Disable(EnableCap.ClipDistance0); }
private void Start() { waves = GameObject.Find("Waves").GetComponent <WaterPlane>(); waterShader = waves.material; micObject = GameObject.Find("Microphone"); gyroObject = GameObject.Find("Gyroscope"); windController = GameObject.Find("Wind").GetComponent <WindController>(); lightSensor = GameObject.Find("LightSensor").GetComponent <LightSensorInput>(); deployClouds = GameObject.Find("CloudManager").GetComponent <Deploy_Clouds>(); perl = transform.FindChild("black_perl"); boat = GetComponent <Rigidbody>(); direction = new Vector3(); development = false; transform.rotation = Quaternion.identity; //for some reason the boat spawns sideways... boatCamera = Camera.main.GetComponent <SmoothFollow>(); cameraDistanceInit = boatCamera.distance; cloudTransform = transform.FindChild("Cloud"); cloudSystem = cloudTransform.GetComponent <ParticleSystem>(); cloudSystem.enableEmission = false; //windZone = transform.FindChild("WindZone").GetComponent<WindZone>(); cylinder = transform.GetChild(7); }
public void RenderWaterReflection(WaterPlane water, BaseCamera camera, Vector3 sunDirection, Matrix4 projectionMatrix, Vector4 clipPlane) { if (m_bPostConstructor) { return; } GL.Enable(EnableCap.ClipDistance0); Matrix4 mirrorMatrix; mirrorMatrix = GetMirrorMatrix(water); m_shader.startProgram(); m_skyboxDayTexture.BindTexture(TextureUnit.Texture0); m_skyboxNightTexture.BindTexture(TextureUnit.Texture1); m_shader.SetTransformationMatrices(ref projectionMatrix, camera.GetViewMatrix(), ref mirrorMatrix); m_shader.SetDayCubeTexture(0); m_shader.SetNightCubeTexture(1); m_shader.SetDayCycleValue(sunDirection.Normalized().Y); m_shader.SetMist(m_mist); m_shader.SetClipPlane(ref clipPlane); m_buffer.RenderVAO(PrimitiveType.Triangles); m_shader.stopProgram(); GL.Disable(EnableCap.ClipDistance0); }
private Matrix4 GetMirrorMatrix(WaterPlane water) { Matrix4 mirrorMatrix = Matrix4.Identity; mirrorMatrix *= Matrix4.CreateRotationY(MathHelper.DegreesToRadians(m_moveFactor)); mirrorMatrix *= Matrix4.CreateScale(1, -1, 1); return(mirrorMatrix); }
public void RenderWaterReflection(WaterPlane water, DirectionalLight directionalLight, BaseCamera camera, ref Matrix4 ProjectionMatrix, Vector4 clipPlane = new Vector4()) { if (bPostConstructor) { return; } Matrix4 modelMatrix, mirrorMatrix; mirrorMatrix = GetMirrorMatrix(water); modelMatrix = GetWorldMatrix(); /*If clip plane is setted - enable clipping plane*/ if (clipPlane.X == 0 && clipPlane.Y == 0 && clipPlane.Z == 0 && clipPlane.W == 0) { GL.Disable(EnableCap.ClipDistance0); } else { GL.Enable(EnableCap.ClipDistance0); } m_liteReflectionShader.startProgram(); m_texture.BindTexture(TextureUnit.Texture0); // diffusemap texture bool bEnableNM = m_normalMap != null; bool bEnableSM = m_specularMap != null; if (bEnableNM) { m_normalMap.BindTexture(TextureUnit.Texture1); // normalmap } if (bEnableSM) { m_specularMap.BindTexture(TextureUnit.Texture2); //Bind specular map } m_liteReflectionShader.SetTexture(0); if (bEnableNM) { m_liteReflectionShader.SetNormalMap(1); } if (bEnableSM) { m_liteReflectionShader.SetSpecularMap(2); } m_liteReflectionShader.SetMaterial(m_material); m_liteReflectionShader.SetTransformationMatrices(ref mirrorMatrix, ref modelMatrix, camera.GetViewMatrix(), ref ProjectionMatrix); m_liteReflectionShader.SetDirectionalLight(directionalLight); m_liteReflectionShader.SetClipPlane(ref clipPlane); m_skin.Buffer.RenderVAO(PrimitiveType.Triangles); m_liteReflectionShader.stopProgram(); }
public Matrix4 GetMirrorMatrix(WaterPlane water) { Vector3 currentPosition = ComponentTranslation; float translationPositionY = (2 * water.GetTranslation().Y) - currentPosition.Y; Matrix4 mirrorMatrix = Matrix4.Identity; mirrorMatrix *= Matrix4.CreateRotationX(MathHelper.DegreesToRadians(ComponentRotation.X)); mirrorMatrix *= Matrix4.CreateRotationY(MathHelper.DegreesToRadians(ComponentRotation.Y)); mirrorMatrix *= Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(ComponentRotation.Z)); mirrorMatrix *= Matrix4.CreateScale(ComponentScale.X, -ComponentScale.Y, ComponentScale.Z); mirrorMatrix *= Matrix4.CreateTranslation(currentPosition.X, translationPositionY, currentPosition.Z); return(mirrorMatrix); }
// Start is called before the first frame update void Start() { score = -nObjectives; waves = GameObject.Find("Waves").GetComponent <WaterPlane>(); for (int i = 0; i < nObjectives; i++) { if (isServer) { SpawnObjective(new Vector3(Random.Range(50, 950), 0, Random.Range(50, 950))); } } }
private void InitializeWater() { //1-Generate water's mesh MeshFilter meshFilter = gameObject.GetComponent <MeshFilter>(); if (meshFilter.sharedMesh == null) { meshFilter.sharedMesh = new Mesh(); } waterPlane = new WaterPlane(meshFilter.sharedMesh, waterResolution, waterSurfaceSide); waterPlane.GenerateWaterMesh(); //2-Assign water material gameObject.GetComponent <MeshRenderer>().sharedMaterial = waterMaterial; }
public override void OnInspectorGUI() { WaterPlane waterPlane = target as WaterPlane; // DrawDefaultInspector returns true if any value in the inspector gets changed if (DrawDefaultInspector()) { waterPlane.GenerateMesh(); } if (GUILayout.Button("GenerateMesh")) { waterPlane.GenerateMesh(); EditorUtility.SetDirty(target); // EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } }
private void CreateWaterPlane(float terrainBounds) { if (WaterPlane == null) { WaterPlane = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Resources/Water/WaterPlane.prefab")); WaterPlane.name = "WaterPlane"; WaterPlane.tag = "Water"; } WaterPlane.transform.localPosition = Vector3.zero; WaterPlane.transform.localScale = new Vector3(terrainBounds, 1, terrainBounds) / 10f; WaterPlane.transform.localEulerAngles = Vector3.zero; WaterPlane.transform.position = Vector3.zero; WaterPlane.AddComponent <PositionLock>(); }
public void RenderWaterReflection(WaterPlane water, DirectionalLight Sun, BaseCamera camera, ref Matrix4 ProjectionMatrix, Vector4 clipPlane) { if (m_bPostConstructor) { return; } float translationPositionY = (2 * water.GetTranslation().Y); Matrix4 mirrorMatrix, modelMatrix = Matrix4.Identity; mirrorMatrix = Matrix4.CreateScale(1, -1, 1); mirrorMatrix *= Matrix4.CreateTranslation(0, translationPositionY, 0); GL.Enable(EnableCap.ClipDistance0); liteReflectionShader.startProgram(); _textureBlack.BindTexture(TextureUnit.Texture0); _textureR.BindTexture(TextureUnit.Texture1); _textureG.BindTexture(TextureUnit.Texture2); _textureB.BindTexture(TextureUnit.Texture3); _blendMap.BindTexture(TextureUnit.Texture4); liteReflectionShader.SetTextureR(1); liteReflectionShader.SetTextureG(2); liteReflectionShader.SetTextureB(3); liteReflectionShader.SetTextureBlack(0); liteReflectionShader.SetBlendMap(4); liteReflectionShader.SetMaterial(_terrainMaterial); liteReflectionShader.SetTransformationMatrices(ref mirrorMatrix, ref modelMatrix, camera.GetViewMatrix(), ref ProjectionMatrix); liteReflectionShader.SetDirectionalLight(Sun); liteReflectionShader.SetClippingPlane(ref clipPlane); _buffer.RenderVAO(PrimitiveType.Triangles); liteReflectionShader.stopProgram(); GL.Disable(EnableCap.ClipDistance0); }
// Start is called before the first frame update void Start() { if (transform.childCount < 5) { Debug.LogWarning(this.name + ": Ship assets is not properly set"); } waves = GameObject.Find("Waves").GetComponent <WaterPlane>(); boat = transform.GetChild(0); s1 = transform.GetChild(1); s2 = transform.GetChild(2); s3 = transform.GetChild(3); s4 = transform.GetChild(4); //we don't want the spheres to render Renderer[] spheres = transform.GetComponentsInChildren <Renderer>(); for (int i = 1; i <= 4; i++) { spheres[i].enabled = false; } }
bool GetTurnToPosition(out Vec3 turnToPosition) { if (Instance != this) { Log.Fatal("PlayerIntellect: GetTurnToPosition: Instance != this."); } turnToPosition = Vec3.Zero; if (ControlledObject == null) { return(false); } //CutSceneManager specific if (CutSceneManager.Instance != null && CutSceneManager.Instance.CutSceneEnable) { return(false); } Vec3 from; Vec3 dir; if (!fpsCamera) { from = ControlledObject.Position + new Vec3(0, 0, tpsCameraCenterOffset); dir = lookDirection.GetVector(); } else { from = ControlledObject.Position + ControlledObject.Type.FPSCameraOffset * ControlledObject.Rotation; dir = lookDirection.GetVector(); } //invalid ray if (dir == Vec3.Zero || float.IsNaN(from.X) || float.IsNaN(dir.X)) { return(false); } float distance = 1000.0f; turnToPosition = from + dir * distance; RayCastResult[] piercingResult = PhysicsWorld.Instance.RayCastPiercing( new Ray(from, dir * distance), (int)ContactGroup.CastAll); foreach (RayCastResult result in piercingResult) { WaterPlane waterPlane = WaterPlane.GetWaterPlaneByBody(result.Shape.Body); if (waterPlane == null && result.Shape.ContactGroup == (int)ContactGroup.NoContact) { continue; } MapObject obj = MapSystemWorld.GetMapObjectByBody(result.Shape.Body); if (obj == ControlledObject) { continue; } if (waterPlane != null) { //ignore water from inside if (result.Shape.Body.GetGlobalBounds().IsContainsPoint(from)) { continue; } } Dynamic dynamic = obj as Dynamic; if (dynamic != null) { if (dynamic.GetParentUnitHavingIntellect() == ControlledObject) { continue; } } turnToPosition = result.Position; break; } return(true); }
private void Awake() { waterPlane = (WaterPlane)target; }
private void AddContent(bool drawForest1, bool drawForest2, bool lakes, bool ocean, bool buildings, bool roads) { if (drawForest1 || drawForest2) { treeSceneNode = scene.RootSceneNode.CreateChildSceneNode("Trees"); } bool betaWorldForest = false; if (betaWorldForest) { boundary1 = new Boundary("boundary1"); boundary1.AddPoint(new Vector3(441 * oneMeter, 0, 4269 * oneMeter)); boundary1.AddPoint(new Vector3(105 * oneMeter, 0, 4278 * oneMeter)); boundary1.AddPoint(new Vector3(66 * oneMeter, 0, 4162 * oneMeter)); boundary1.AddPoint(new Vector3(-132 * oneMeter, 0, 4102 * oneMeter)); boundary1.AddPoint(new Vector3(-540 * oneMeter, 0, 3658 * oneMeter)); boundary1.AddPoint(new Vector3(-639 * oneMeter, 0, 3570 * oneMeter)); boundary1.AddPoint(new Vector3(182 * oneMeter, 0, 3510 * oneMeter)); boundary1.AddPoint(new Vector3(236 * oneMeter, 0, 3845 * oneMeter)); boundary1.AddPoint(new Vector3(382 * oneMeter, 0, 3966 * oneMeter)); boundary1.Close(); //boundary1.Hilight = true; mvScene.AddBoundary(boundary1); forest = new Forest(1234, "Forest1", treeSceneNode); boundary1.AddSemantic(forest); forest.WindFilename = "demoWind.ini"; forest.WindDirection = Vector3.UnitX; forest.WindStrength = 0.0f; forest.AddTreeType("CedarOfLebanon_RT.spt", 55 * 300, 0, 4); forest.AddTreeType("WeepingWillow_RT.spt", 50 * 300, 0, 5); forest.AddTreeType("DatePalm_RT.spt", 40 * 300, 0, 16); Boundary boundary4 = new Boundary("boundary4"); boundary4.AddPoint(new Vector3(441 * oneMeter, 0, 4269 * oneMeter)); boundary4.AddPoint(new Vector3(105 * oneMeter, 0, 4278 * oneMeter)); boundary4.AddPoint(new Vector3(66 * oneMeter, 0, 4162 * oneMeter)); boundary4.AddPoint(new Vector3(-132 * oneMeter, 0, 4102 * oneMeter)); boundary4.AddPoint(new Vector3(-540 * oneMeter, 0, 3658 * oneMeter)); boundary4.AddPoint(new Vector3(-639 * oneMeter, 0, 3570 * oneMeter)); boundary4.AddPoint(new Vector3(182 * oneMeter, 0, 3510 * oneMeter)); boundary4.AddPoint(new Vector3(236 * oneMeter, 0, 3845 * oneMeter)); boundary4.AddPoint(new Vector3(382 * oneMeter, 0, 3966 * oneMeter)); boundary4.Close(); //boundary1.Hilight = true; mvScene.AddBoundary(boundary4); Forest forest4 = new Forest(1234, "Forest4", treeSceneNode); boundary4.AddSemantic(forest); forest4.WindFilename = "demoWind.ini"; forest4.WindDirection = Vector3.UnitX; forest4.WindStrength = 1.0f; forest4.AddTreeType("DatePalm_RT.spt", 40 * 300, 0, 14); forest4.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, 23); forest4.AddTreeType("CinnamonFern_RT.spt", 70 * 300, 0, 14); boundary2 = new Boundary("boundary2"); boundary2.AddPoint(new Vector3(285 * oneMeter, 0, 3462 * oneMeter)); boundary2.AddPoint(new Vector3(-679 * oneMeter, 0, 3560 * oneMeter)); boundary2.AddPoint(new Vector3(-647 * oneMeter, 0, 3381 * oneMeter)); boundary2.AddPoint(new Vector3(-512 * oneMeter, 0, 3230 * oneMeter)); boundary2.AddPoint(new Vector3(402 * oneMeter, 0, 3116 * oneMeter)); boundary2.AddPoint(new Vector3(402 * oneMeter, 0, 3339 * oneMeter)); boundary2.AddPoint(new Vector3(305 * oneMeter, 0, 3363 * oneMeter)); boundary2.Close(); mvScene.AddBoundary(boundary2); Forest forest2 = new Forest(1234, "Forest2", treeSceneNode); boundary2.AddSemantic(forest2); forest2.WindFilename = "demoWind.ini"; forest2.WindDirection = Vector3.UnitX; forest2.WindStrength = 1.0f; forest2.AddTreeType("SpiderTree_RT_Dead.spt", 80 * 300, 0, 23); forest2.AddTreeType("CinnamonFern_RT.spt", 70 * 300, 0, 12); forest2.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, 12); Boundary boundary3 = new Boundary("boundary3"); boundary3.AddPoint(new Vector3(285 * oneMeter, 0, 3462 * oneMeter)); boundary3.AddPoint(new Vector3(-679 * oneMeter, 0, 3560 * oneMeter)); boundary3.AddPoint(new Vector3(-647 * oneMeter, 0, 3381 * oneMeter)); boundary3.AddPoint(new Vector3(-512 * oneMeter, 0, 3230 * oneMeter)); boundary3.AddPoint(new Vector3(402 * oneMeter, 0, 3116 * oneMeter)); boundary3.AddPoint(new Vector3(402 * oneMeter, 0, 3339 * oneMeter)); boundary3.AddPoint(new Vector3(305 * oneMeter, 0, 3363 * oneMeter)); boundary3.Close(); mvScene.AddBoundary(boundary3); Forest forest3 = new Forest(1234, "Forest3", treeSceneNode); boundary3.AddSemantic(forest3); forest3.WindFilename = "demoWind.ini"; forest3.WindDirection = Vector3.UnitX; forest3.WindStrength = 1.0f; forest3.AddTreeType("DatePalm_RT.spt", 40 * 300, 0, 14); forest3.AddTreeType("AmericanHolly_RT.spt", 40 * 300, 0, 24); forest3.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, 23); forest3.AddTreeType("SpiderTree_RT_Dead.spt", 80 * 300, 0, 9); } if (drawForest1) { boundary1 = new Boundary("boundary1"); boundary1.AddPoint(new Vector3(441 * oneMeter, 0, 4269 * oneMeter)); boundary1.AddPoint(new Vector3(105 * oneMeter, 0, 4278 * oneMeter)); boundary1.AddPoint(new Vector3(66 * oneMeter, 0, 4162 * oneMeter)); boundary1.AddPoint(new Vector3(-132 * oneMeter, 0, 4102 * oneMeter)); boundary1.AddPoint(new Vector3(-540 * oneMeter, 0, 3658 * oneMeter)); boundary1.AddPoint(new Vector3(-639 * oneMeter, 0, 3570 * oneMeter)); boundary1.AddPoint(new Vector3(182 * oneMeter, 0, 3510 * oneMeter)); boundary1.AddPoint(new Vector3(236 * oneMeter, 0, 3845 * oneMeter)); boundary1.AddPoint(new Vector3(382 * oneMeter, 0, 3966 * oneMeter)); boundary1.Close(); //boundary1.Hilight = true; mvScene.AddBoundary(boundary1); forest = new Forest(1234, "Forest1", treeSceneNode); boundary1.AddSemantic(forest); forest.WindFilename = "demoWind.ini"; forest.WindDirection = Vector3.UnitX; forest.WindStrength = 1.0f; //forest.AddTreeType("EnglishOak_RT.spt", 55 * 300, 0, 100); //forest.AddTreeType("AmericanHolly_RT.spt", 40 * 300, 0, 100); //forest.AddTreeType("ChristmasScotchPine_RT.spt", 70 * 300, 0, 100); //forest.AddTreeType("CedarOfLebanon_RT.spt", 55 * 300, 0, 4); //forest.AddTreeType("WeepingWillow_RT.spt", 50 * 300, 0, 5); //forest.AddTreeType("DatePalm_RT.spt", 40 * 300, 0, 16); //forest.AddTreeType("DatePalm_RT.spt", 40 * 300, 0, 14); //forest.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, 23); //forest.AddTreeType("CinnamonFern_RT.spt", 70 * 300, 0, 14); //forest.AddTreeType("SpiderTree_RT_Dead.spt", 80 * 300, 0, 23); //forest.AddTreeType("CinnamonFern_RT.spt", 70 * 300, 0, 12); //forest.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, 12); //forest.AddTreeType("DatePalm_RT.spt", 40 * 300, 0, 14); //forest.AddTreeType("AmericanHolly_RT.spt", 40 * 300, 0, 24); //forest.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, 23); //forest.AddTreeType("SpiderTree_RT_Dead.spt", 80 * 300, 0, 9); uint numinstances = 50; //forest.AddTreeType("Azalea_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("Azalea_RT_Pink.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("AzaleaPatch_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("AzaleaPatch_RT_Pink.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("CurlyPalm_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("CurlyPalmCluster_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("FraserFir_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("FraserFir_RT_Snow.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("FraserFirCluster_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("FraserFirCluster_RT_Snow.spt", 55 * 300, 0, numinstances); forest.AddTreeType("RDApple_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("RDApple_RT_Apples.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("RDApple_RT_Spring.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("RDApple_RT_Winter.spt", 55 * 300, 0, numinstances); forest.AddTreeType("UmbrellaThorn_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("UmbrellaThorn_RT_Dead.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("UmbrellaThorn_RT_Flowers.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("WeepingWillow_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("WeepingWillow_RT_Fall.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("WeepingWillow_RT_Winter.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("AmericanBoxwood_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("AmericanBoxwoodCluster_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("Beech_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("Beech_RT_Fall.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("Beech_RT_Winter.spt", 55 * 300, 0, numinstances); forest.AddTreeType("SugarPine_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("SugarPine_RT_Winter.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("VenusTree_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("CherryTree_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("CherryTree_RT_Spring.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("CherryTree_RT_Fall.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("CherryTree_RT_Winter.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("SpiderTree_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("SpiderTree_RT_Dead.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("JungleBrush_RT.spt", 55 * 300, 0, numinstances); forest.AddTreeType("QueenPalm_RT.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("QueenPalm_RT_Flowers.spt", 55 * 300, 0, numinstances); //forest.AddTreeType("QueenPalmCluster_RT.spt", 55 * 300, 0, numinstances); if (false) { //uint numinstances = 30; forest.AddTreeType("CurlyPalm_RT.spt", 55 * 300, 0, numinstances); forest.AddTreeType("DatePalm_RT.spt", 40 * 300, 0, numinstances); forest.AddTreeType("JungleBrush_RT.spt", 70 * 300, 0, numinstances); forest.AddTreeType("Cercropia_RT.spt", 55 * 300, 0, numinstances); forest.AddTreeType("CommonOlive_RT_Summer.spt", 40 * 300, 0, numinstances); forest.AddTreeType("ColvilleaRacemosa_RT_Flower.spt", 70 * 300, 0, numinstances); forest.AddTreeType("JapaneseAngelica_RT_Summer.spt", 55 * 300, 0, numinstances); forest.AddTreeType("NorthIslandRata_RT_Spring.spt", 40 * 300, 0, numinstances); forest.AddTreeType("SpiderTree_RT.spt", 70 * 300, 0, numinstances); forest.AddTreeType("Stump_RT.spt", 150 * 300, 0, numinstances); forest.AddTreeType("UmbrellaThorn_RT_Flowers.spt", 70 * 300, 0, numinstances); forest.AddTreeType("AmurCork_RT_LateSummer.spt", 55 * 300, 0, numinstances); forest.AddTreeType("ArizonaBush_RT_Flowers.spt", 40 * 300, 0, numinstances); forest.AddTreeType("BananaTree_RT.spt", 70 * 300, 0, numinstances); forest.AddTreeType("Baobab_RT.spt", 55 * 300, 0, numinstances); forest.AddTreeType("CaliforniaBuckeye_RT_Nuts.spt", 120 * 300, 0, numinstances); forest.AddTreeType("CedarOfLebanon_RT.spt", 55 * 300, 0, numinstances); forest.AddTreeType("CherryTree_RT_Spring.spt", 40 * 300, 0, numinstances); forest.AddTreeType("CinnamonFern_RT.spt", 70 * 300, 0, numinstances); forest.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, numinstances); forest.AddTreeType("Crepe Myrtle_RT_Flowers.spt", 120 * 300, 0, numinstances); } //forest.AddTreeType("CedarOfLebanon_RT.spt", 100 * 300, 0, 30); //forest.AddTreeType("CherryTree_RT_Spring.spt", 40 * 300, 0, 30); //forest.AddTreeType("CinnamonFern_RT.spt", 70 * 300, 0, 30); //forest.AddTreeType("CoconutPalm_RT.spt", 55 * 300, 0, 30); //forest.AddTreeType("Crepe Myrtle_RT_Flowers.spt", 120 * 300, 0, 30); if (false) { forest.AddTreeType("Crepe Myrtle_RT_Winter.spt", 100 * 300, 0, 30); forest.AddTreeType("FanPalm_RT.spt", 40 * 300, 0, 30); forest.AddTreeType("ItalianCypress_RT.spt", 70 * 300, 0, 30); forest.AddTreeType("JapaneseMaple_RT_Summer.spt", 55 * 300, 0, 30); forest.AddTreeType("JoshuaTree_RT.spt", 120 * 300, 0, 30); forest.AddTreeType("KoreanStewartia_RT.spt", 100 * 300, 0, 30); forest.AddTreeType("ManchurianAngelicaTree_RT_Small.spt", 100 * 300, 0, 30); forest.AddTreeType("MimosaTree_RT.spt", 100 * 300, 0, 30); forest.AddTreeType("MimosaTree_RT_Flower.spt", 100 * 300, 0, 30); forest.AddTreeType("Mulga_RT_Flowers.spt", 50 * 300, 0, 30); forest.AddTreeType("OmenTree_RT.spt", 80 * 300, 0, 30); forest.AddTreeType("OrientalSpruce_RT.spt", 50 * 300, 0, 30); forest.AddTreeType("PonytailPalm_RT.spt", 140 * 300, 0, 30); forest.AddTreeType("QueenPalm_RT.spt", 55 * 300, 0, 30); forest.AddTreeType("ColvilleaRacemosa_RT.spt", 50 * 300, 0, 30); forest.AddTreeType("SpiderTree_RT_Dead.spt", 80 * 300, 0, 30); forest.AddTreeType("Tamarind_RT_Spring.spt", 50 * 300, 0, 30); forest.AddTreeType("WeepingWillow_RT.spt", 50 * 300, 0, 30); } } if (drawForest2) { boundary2 = new Boundary("boundary2"); boundary2.AddPoint(new Vector3(285 * oneMeter, 0, 3462 * oneMeter)); boundary2.AddPoint(new Vector3(-679 * oneMeter, 0, 3560 * oneMeter)); boundary2.AddPoint(new Vector3(-647 * oneMeter, 0, 3381 * oneMeter)); boundary2.AddPoint(new Vector3(-512 * oneMeter, 0, 3230 * oneMeter)); boundary2.AddPoint(new Vector3(402 * oneMeter, 0, 3116 * oneMeter)); boundary2.AddPoint(new Vector3(402 * oneMeter, 0, 3339 * oneMeter)); boundary2.AddPoint(new Vector3(305 * oneMeter, 0, 3363 * oneMeter)); boundary2.Close(); mvScene.AddBoundary(boundary2); Forest forest2 = new Forest(1234, "Forest2", treeSceneNode); boundary2.AddSemantic(forest2); forest2.WindFilename = "demoWind.ini"; forest2.AddTreeType("EnglishOak_RT.spt", 55 * 300, 0, 150); forest2.AddTreeType("AmericanHolly_RT.spt", 40 * 300, 0, 150); forest2.AddTreeType("ChristmasScotchPine_RT.spt", 70 * 300, 0, 150); forest2.WindDirection = Vector3.UnitX; forest2.WindStrength = 0f; } if (lakes) { boundary3 = new Boundary("boundary3"); boundary3.AddPoint(new Vector3(-540 * oneMeter, 0, 3151 * oneMeter)); boundary3.AddPoint(new Vector3(-656 * oneMeter, 0, 3058 * oneMeter)); boundary3.AddPoint(new Vector3(-631 * oneMeter, 0, 2878 * oneMeter)); boundary3.AddPoint(new Vector3(-335 * oneMeter, 0, 2882 * oneMeter)); boundary3.AddPoint(new Vector3(-336 * oneMeter, 0, 3098 * oneMeter)); boundary3.AddPoint(new Vector3(-478 * oneMeter, 0, 3166 * oneMeter)); boundary3.Close(); //boundary3.Hilight = true; mvScene.AddBoundary(boundary3); WaterPlane waterSemantic = new WaterPlane(42 * WorldManager.oneMeter, "lake1", treeSceneNode); boundary3.AddSemantic(waterSemantic); } if (buildings) { Entity entity = scene.CreateEntity("tree", "demotree4.mesh"); SceneNode node = scene.RootSceneNode.CreateChildSceneNode(); node.AttachObject(entity); node.Position = new Vector3(332383, 71536, 4247994); entity = scene.CreateEntity("house", "human_house_stilt.mesh"); node = scene.RootSceneNode.CreateChildSceneNode(); node.AttachObject(entity); node.Position = new Vector3(0, 130.0f * oneMeter, 3900 * oneMeter); } if (ocean) { Entity waterEntity = scene.CreateEntity("Water", "WaterPlane"); Debug.Assert(waterEntity != null); waterEntity.MaterialName = "MVSMOcean"; SceneNode waterNode = scene.RootSceneNode.CreateChildSceneNode("WaterNode"); Debug.Assert(waterNode != null); waterNode.AttachObject(waterEntity); waterNode.Translate(new Vector3(0, 0, 0)); } if (roads) { road1 = mvScene.CreateRoad("Via Appia"); road1.HalfWidth = 2; List <Vector3> roadPoints = new List <Vector3>(); roadPoints.Add(new Vector3(97000, 0, 4156000)); roadPoints.Add(new Vector3(205000, 0, 4031000)); roadPoints.Add(new Vector3(254000, 0, 3954000)); roadPoints.Add(new Vector3(234000, 0, 3500000)); roadPoints.Add(new Vector3(256000, 0, 3337000)); roadPoints.Add(new Vector3(98000, 0, 3242000)); road1.AddPoints(roadPoints); } }