private void AppendShaderParam(JsonStringGenerator jsonStringGenerator, FrameInfoCrawler.ShaderProperties shaderParams) { using (new JsonStringGenerator.ObjectScopeWithName(jsonStringGenerator, "shaderParams")) { AppendShaderParamTextures(jsonStringGenerator, shaderParams); AppendShaderParamFloats(jsonStringGenerator, shaderParams); AppendShaderParamVectors(jsonStringGenerator, shaderParams); AppendShaderParamMatricies(jsonStringGenerator, shaderParams); } }
private void AppendShaderParamBuffers(JsonStringGenerator jsonStringGenerator, FrameInfoCrawler.ShaderProperties shaderParams) { if (shaderParams.convertedBuffers == null) { return; } using (new JsonStringGenerator.ObjectArrayValueScope(jsonStringGenerator, "buffers")) { foreach (var bufferParam in shaderParams.convertedBuffers) { jsonStringGenerator.AddObjectValue(bufferParam.name, "No Implements"); } } }
private void AppendShaderParamMatricies(JsonStringGenerator jsonStringGenerator, FrameInfoCrawler.ShaderProperties shaderParams) { if (shaderParams.convertedMatricies == null) { return; } using (new JsonStringGenerator.ObjectArrayValueScope(jsonStringGenerator, "matricies")) { foreach (var matrixParam in shaderParams.convertedMatricies) { using (new JsonStringGenerator.ObjectScope(jsonStringGenerator)) { var val = (Matrix4x4)matrixParam.value; jsonStringGenerator.AddObjectValue("name", matrixParam.name); jsonStringGenerator.AddObjectMatrix("val", ref val); } } } }
private void AppendShaderParamVectors(JsonStringGenerator jsonStringGenerator, FrameInfoCrawler.ShaderProperties shaderParams) { if (shaderParams.convertedVectors == null) { return; } using (new JsonStringGenerator.ObjectArrayValueScope(jsonStringGenerator, "vectors")) { foreach (var vectorParam in shaderParams.convertedVectors) { using (new JsonStringGenerator.ObjectScope(jsonStringGenerator)) { var val = (Vector4)vectorParam.value; jsonStringGenerator.AddObjectValue("name", vectorParam.name); jsonStringGenerator.AddObjectVector("val", ref val); } } } }
private void AppendShaderParamFloats(JsonStringGenerator jsonStringGenerator, FrameInfoCrawler.ShaderProperties shaderParams) { if (shaderParams.convertedFloats == null) { return; } using (new JsonStringGenerator.ObjectArrayValueScope(jsonStringGenerator, "floats")) { foreach (var floatParam in shaderParams.convertedFloats) { using (new JsonStringGenerator.ObjectScope(jsonStringGenerator)) { jsonStringGenerator.AddObjectValue("name", floatParam.name); jsonStringGenerator.AddObjectValue("val", (float)floatParam.value); } } } }
private void AppendShaderParamTextures(JsonStringGenerator jsonStringGenerator, FrameInfoCrawler.ShaderProperties shaderParams) { if (shaderParams.convertedTextures == null) { return; } using (new JsonStringGenerator.ObjectArrayValueScope(jsonStringGenerator, "textures")) { foreach (var textureParam in shaderParams.convertedTextures) { using (new JsonStringGenerator.ObjectScope(jsonStringGenerator)) { var val = textureParam.value as Texture; jsonStringGenerator.AddObjectValue("name", textureParam.name); jsonStringGenerator.AddObjectValue("textureName", textureParam.textureName); if (val != null) { #if UNITY_2019_1_OR_NEWER || UNITY_2019_OR_NEWER jsonStringGenerator.AddObjectValue("originFormat", val.graphicsFormat.ToString()); #endif jsonStringGenerator.AddObjectValue("originWidth", val.width); jsonStringGenerator.AddObjectValue("originHeight", val.height); jsonStringGenerator.AddObjectValue("originMipCount", TextureUtility.GetMipMapCount(val)); } var saveInfo = textureParam.saveTextureInfo; AppendSavedTextureInfo(jsonStringGenerator, "saved", saveInfo); } } } }