void Start() { planetInfo.x = (chunkSize - 1) * maxScale / 2; planetInfo.y = maxTerrainHeight; instanceMaterial.SetTexture("_Textures", LoadArrayTexture.DoTexture(planetTexture)); instanceMaterial.SetInt("_TexturesArrayLength", planetTextureRange.Length); instanceMaterial.SetFloatArray("_TexturesArray", planetTextureRange); instanceMaterial.SetVector("_PlanetInfo", planetInfo); chunk = new Chunk(maxScale, chunkSize, instanceMaterial, viewer); }
// nastaví přoměné které se pošlou na grafickou kartu void SetMaterialProperties() { materialBlock = new MaterialPropertyBlock(); materialBlock.SetTexture("_SurfaceTexture", LoadArrayTexture.DoTexture(texture)); materialBlock.SetTexture("_PlanetTextures", planetTexture); materialBlock.SetTexture("_PlanetHeightMap", planetHeightMap); materialBlock.SetTexture("_PlanetSpecular", planetSpecular); // materialBlock.SetTexture("_noiseTexture", PerlingNoise.CreateNoise((int)width, noise)); materialBlock.SetVector("_CameraPosition", camera.transform.position); materialBlock.SetVector("_PlanetInfo", planetInfo); materialBlock.SetFloat("_Gamma", gamma); materialBlock.SetFloat("fHdrExposure", hdrExposure); materialBlock.SetInt("_IsLODActive", 0); }