void LoadTexture(VirtualTextureLoader.LoadingHandler handler, int2 startIndex, int size) { int texElement; //Could Debug lefted pool //Debug.Log(vt.LeftedTextureElement); if (!vt.LoadNewTexture(startIndex, size, out texElement)) { Debug.LogError("Terrain Virtual Texture Pool Not Enough!"); return; } textureBuffer.SetDataPtr((uint *)handler.allBytes, MASK_RESOLUTION * MASK_RESOLUTION / 4); shader.SetBuffer(2, ShaderIDs._TextureBuffer, textureBuffer); shader.SetTexture(2, ShaderIDs._MainTex, mask); shader.SetInt(ShaderIDs._Count, MASK_RESOLUTION); shader.Dispatch(2, MASK_RESOLUTION / 8, MASK_RESOLUTION / 8, 1); textureShader.SetTexture(0, ShaderIDs._SourceTex, mask); textureShader.SetTexture(0, ShaderIDs._MainTex, albedoTex); textureShader.SetTexture(0, ShaderIDs._BumpMap, normalTex); textureShader.SetTexture(0, ShaderIDs._SMMap, smTex); textureShader.SetVector(ShaderIDs._TextureSize, float4(MASK_RESOLUTION, 1f / COLOR_RESOLUTION, size, 1)); textureShader.SetTexture(0, ShaderIDs._VirtualMainTex, vt.GetTexture(1)); textureShader.SetTexture(0, ShaderIDs._VirtualBumpMap, vt.GetTexture(2)); textureShader.SetTexture(0, ShaderIDs._VirtualSMO, vt.GetTexture(3)); textureShader.SetInt(ShaderIDs._OffsetIndex, texElement); shader.SetInt(ShaderIDs._OffsetIndex, texElement); const int disp = COLOR_RESOLUTION / 8; textureShader.Dispatch(0, disp, disp, 1); textureBuffer.SetDataPtr((uint *)(MASK_RESOLUTION * MASK_RESOLUTION + handler.allBytes), HEIGHT_RESOLUTION * HEIGHT_RESOLUTION / 2); shader.SetBuffer(3, ShaderIDs._TextureBuffer, textureBuffer); shader.SetTexture(3, ShaderIDs._VirtualHeightmap, vt.GetTexture(0)); shader.SetInt(ShaderIDs._Count, HEIGHT_RESOLUTION); shader.Dispatch(3, HEIGHT_RESOLUTION / 8, HEIGHT_RESOLUTION / 8, 1); }
static bool GetComplete(ref VirtualTextureLoader.LoadingHandler handler) { return(*handler.isComplete); }