Options that must be passed to the water component before Initialization
Esempio n. 1
0
 public void SetOptions(RWaterOptions Options)
 {
     water.Options = Options;
 }
Esempio n. 2
0
        public override void Load()
        {
            int islands_down = textures.LoadTexture("Textures\\islands_down", "islands_down", CONST_RTEXTURE_TYPE.Texture2D);
            int islands_up = textures.LoadTexture("Textures\\islands_up", "islands_up", CONST_RTEXTURE_TYPE.Texture2D);
            int islands_east = textures.LoadTexture("Textures\\islands_east", "islands_east", CONST_RTEXTURE_TYPE.Texture2D);
            int islands_west = textures.LoadTexture("Textures\\islands_west", "islands_west", CONST_RTEXTURE_TYPE.Texture2D);
            int islands_north = textures.LoadTexture("Textures\\islands_north", "islands_north", CONST_RTEXTURE_TYPE.Texture2D);
            int islands_south = textures.LoadTexture("Textures\\islands_south", "islands_south", CONST_RTEXTURE_TYPE.Texture2D);

            //int starstexture = textures.LoadTexture("stars", "starbg", CONST_RTEXTURE_TYPE.Texture2D);
            int skycube = textures.BuildCubeMap(1024, "bgcube", islands_west, islands_up, islands_north, islands_east, islands_down, islands_south, RSURFACEFORMAT.Bgr32);
            int skytexture = textures.LoadTexture("skybox001", "sky", CONST_RTEXTURE_TYPE.TextureCube);

            int pointtexture = textures.LoadTexture("point", "point", CONST_RTEXTURE_TYPE.Texture2D);

            int terraintexture = textures.LoadTexture("gcanyonTerrain", "terrainData", CONST_RTEXTURE_TYPE.Texture2D);
            int terrainheight = textures.LoadTexture("gcanyon", "terrain", CONST_RTEXTURE_TYPE.Texture2D);

            int rock = textures.LoadTexture("Textures\\rock", "rock", CONST_RTEXTURE_TYPE.Texture2D);
            int rocknormal = textures.LoadTexture("Textures\\rockNormal", "rockNormal", CONST_RTEXTURE_TYPE.Texture2D);

            int grass = textures.LoadTexture("Textures\\grass", "grass", CONST_RTEXTURE_TYPE.Texture2D);
            int grassnormal = textures.LoadTexture("Textures\\grassNormal", "grassNormal", CONST_RTEXTURE_TYPE.Texture2D);

            int sand = textures.LoadTexture("Textures\\sand", "sand", CONST_RTEXTURE_TYPE.Texture2D);
            int sandnormal = textures.LoadTexture("Textures\\sandNormal", "sandNormal", CONST_RTEXTURE_TYPE.Texture2D);

            int snow = textures.LoadTexture("Textures\\snow", "snow", CONST_RTEXTURE_TYPE.Texture2D);
            int snownormal = textures.LoadTexture("Textures\\snowNormal", "snowNormal", CONST_RTEXTURE_TYPE.Texture2D);

            //int billboardgrass = textures.LoadTexture("billboardgrass", "billboardgrass", CONST_RTEXTURE_TYPE.Texture2D);

            int tree = textures.LoadTexture("Textures\\Pine", "Pine", CONST_RTEXTURE_TYPE.Texture2D);
            //int grassbillboard = textures.LoadTexture("Textures\\billboardgrass", "GrassBillboard", CONST_RTEXTURE_TYPE.Texture2D);
            int wave0 = textures.LoadTexture("Textures\\wave0", "wave0", CONST_RTEXTURE_TYPE.Texture2D);
            int wave1 = textures.LoadTexture("Textures\\wave1", "wave1", CONST_RTEXTURE_TYPE.Texture2D);
            //mesh.Load("dude");

            //mesh.SetPosition(0, 0, 0);

            //mesh.PlayAnimation("Take 001", 1.0f);
            //mesh.SetScale(0.1f, 0.1f, 0.1f);
            //mesh.SetLookAt(new R3DVECTOR(-1, 0, -1));
            //R3DVECTOR scale = mesh.GetScale();
            //emitter.SetTexture(pointtexture);
            //emitter.BuildEmitter(135000);

            //emitter2.BuildEmitter(500);
            //emitter2.SetTexture(pointtexture);
            //emitter.SetPointSettings(pointtexture, 135000, 10000, -1.0f,1.0f,0.0f,0.0f, R3DVECTOR.Down * 500f, 100.0f, 0.0f, 0.0f, 150, 150, 150,150);
            landscape.SetDetailLevel(RLANDSCAPE_LOD.Ultra);
            landscape.SetElevationStrength(10);
            landscape.SetMinGrassPlotElevation(1f);
            landscape.SetMaxGrassPlotElevation(700f);

            landscape.InitTerrainTextures(snow, grass, sand);
            landscape.InitTerrainNormalsTextures(snownormal, grassnormal, rocknormal);
            landscape.InitTerrainGrass(tree, terraintexture, 1750);
            landscape.SetTerrainGrassSize(18f, 40f);

            landscape.SetPosition(new R3DVECTOR((256f * 100f) - (512f * 100f), -300f, (256f * 100f) - (512f * 100f)));
            landscape.Initialize(terrainheight, terraintexture, 50, 12);
            landscape.SetupLODS();

            // Put camera somewhere on the landscape.  Rule is HeightMap Width x Scale for exact position.  I'm dividing by 3 to place somewhere
            // in the first third area so we have landscape around us.
            //camera.Position = new R3DVECTOR((512 * 40) / 3, landscape.GetTerrainHeight((512*40)/3, (512*40)/3)+5f, (512 * 40) / 3);
            camera.Position = new R3DVECTOR(1.0f, 1.0f, 1.0f);
            camera.SetFieldOfView(45f);
            camera.SetClipPlanes(1f, 180000f);
            camera.LookAt(camera.Position * R3DVECTOR.Backward);
            //input.SetMousePosition(1280 / 2, 800 / 2);
            camera.CurrentBehavior = RCamera.Behavior.Flight;
            //mesh.SetPosition(camera.Position + (camera.ViewDirection*1.0001f));
            //mesh.SetLookAt(new R3DVECTOR(mesh.GetPosition().X-1, mesh.GetPosition().Y, mesh.GetPosition().Z-1));
            atmosphere.SkyBox_Enable(true);
            atmosphere.SkyBox_Initialize();
            atmosphere.SkyBox_SetTextureCube(skycube);
            atmosphere.Fog_Enable(fog);
            atmosphere.Fog_SetDistance(9000f);
            atmosphere.Fog_SetColor(0.7f, 0.7f, 0.7f, 0.5f);
            atmosphere.Sky_SetSunlightColor(new R4DVECTOR(1f, 1f, 1f, 1.0f));
            atmosphere.Sky_SetSunlightDirection(new R3DVECTOR(0.1f, -1.5f, 0.1f));
            atmosphere.Sky_SetGlobalAmbientColor(new R4DVECTOR(0.1f, 0.1f, 0.1f, 1.0f));
            //emitter.SetPosition(v);
            //emitter2.SetPosition(v);
            //emitter2.SetScale(1f);
            //emitter2.SetBillboardSize(5f);
            RWaterOptions options = new RWaterOptions();
            options.WaveMapAsset0ID = wave0;
            options.WaveMapAsset1ID = wave1;
            options.WaveMapScale = 100.0f;
            options.WaterColor = new R4DVECTOR(0.5f, 0.6f, 0.7f, 0.5f);
            options.WaveMapVelocity0 = new R2DVECTOR(0.005f, 0.003f);
            options.WaveMapVelocity1 = new R2DVECTOR(-0.001f, 0.01f);
            options.SunFactor = 1.0f;
            options.SunPower = 350f;
            options.Width = 256;
            options.Height = 256;
            options.CellSpacing = 1.0f;
            options.RenderTargetSize = 256;
            water.SetOptions(options);
            water.SetReflectionRenderDelegate(Reflection);
            water.Init(64, 12f, new R2DVECTOR(0.00003f,-0.00001f));
            water.SetScale(new R3DVECTOR(10000f,5f,10000f));
            water.SetWaveNormalTexture(wave0);
            water.SetPosition(new R3DVECTOR(256*10000, 300f, 256*10000));
            //water.SetWaveParameters(0.008f, 0.0003f, 0.38f, new R4DVECTOR(0.2f, 0.2f, 0.1f, 1f), 0.29f, 0.3f, new R4DVECTOR(0.5f, 0.5f, 0.5f, 0.5f), new R4DVECTOR(0.2f, 0.4f, 0.7f, 1f), false);
            //landscape.ToggleTerrainDraw();
        }