Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __ShaderProgramLocations::GetMaterialProgramLocations(SimpleProgram &program)
- {
- locations.clear();
- locations["Ka"] = Ka = program.GetUniformLocation("Ka");
- locations["Kd"] = Kd = program.GetUniformLocation("Kd");
- locations["Ks"] = Ks = program.GetUniformLocation("Ks");
- locations["Ke"] = Ke = program.GetUniformLocation("Ke");
- locations["Tr"] = Tr = program.GetUniformLocation("Tr");
- locations["Tf"] = Tf = program.GetUniformLocation("Tf");
- locations["Ns"] = Ns = program.GetUniformLocation("Ns");
- locations["Ni"] = Ni = program.GetUniformLocation("Ni");
- locations["PBk"] = PBk = program.GetUniformLocation("PBk");
- locations["PBm"] = PBm = program.GetUniformLocation("PBm");
- locations["PBKdm"] = PBKdm = program.GetUniformLocation("PBKdm");
- locations["PBKsm"] = PBKsm = program.GetUniformLocation("PBKsm");
- locations["PBior"] = PBior = program.GetUniformLocation("PBior");
- locations["PBGGXgamma"] = PBGGXgamma = program.GetUniformLocation("PBGGXgamma");
- locations["PBmap"] = PBmap = program.GetUniformLocation("PBmap");
- ///
- locations["map_Ka"] = map_Ka = program.GetUniformLocation("map_Ka");
- locations["map_Kd"] = map_Kd = program.GetUniformLocation("map_Kd");
- locations["map_Ks"] = map_Ks = program.GetUniformLocation("map_Ks");
- locations["map_Ke"] = map_Ke = program.GetUniformLocation("map_Ke");
- locations["map_Tr"] = map_Tr = program.GetUniformLocation("map_Tr");
- locations["map_Tf"] = map_Tf = program.GetUniformLocation("map_Tf");
- locations["map_Ni"] = map_Ni = program.GetUniformLocation("map_Ni");
- locations["map_Ns"] = map_Ns = program.GetUniformLocation("map_Ns");
- locations["map_bump"] = map_bump = program.GetUniformLocation("map_bump");
- locations["map_normal"] = map_normal = program.GetUniformLocation("map_normal");
- locations["map_Ka_mix"] = map_Ka_mix = program.GetUniformLocation("map_Ka_mix");
- locations["map_Kd_mix"] = map_Kd_mix = program.GetUniformLocation("map_Kd_mix");
- locations["map_Ks_mix"] = map_Ks_mix = program.GetUniformLocation("map_Ks_mix");
- locations["map_Ke_mix"] = map_Ke_mix = program.GetUniformLocation("map_Ke_mix");
- locations["map_Tf_mix"] = map_Tf_mix = program.GetUniformLocation("map_Tf_mix");
- locations["map_Tr_mix"] = map_Tr_mix = program.GetUniformLocation("map_Tr_mix");
- locations["map_Ni_mix"] = map_Ni_mix = program.GetUniformLocation("map_Ni_mix");
- locations["map_Ns_mix"] = map_Ns_mix = program.GetUniformLocation("map_Ns_mix");
- locations["map_bump_mix"] = map_bump_mix = program.GetUniformLocation("map_bump_mix");
- locations["map_normal_mix"] = map_normal_mix = program.GetUniformLocation("map_normal_mix");
- locations["Spheres"] = sphere_array = program.GetUniformLocation("Spheres[0]");
- locations["SpheresCount"] = sphere_count = program.GetUniformLocation("SpheresCount");
- locations["SpheresKe"] = sphere_Ke = program.GetUniformLocation("SpheresKe[0]");
- for (int i = 0; i < 16; i++)
- {
- char name[64];
- sprintf_s(name, "SphlLights[%d].Enabled", i); locations[name] = sphl_lights_enabled[i] = program.GetUniformLocation(name);
- sprintf_s(name, "SphlLights[%d].E0", i); locations[name] = sphl_lights_E0[i] = program.GetUniformLocation(name);
- sprintf_s(name, "SphlLights[%d].Position", i); locations[name] = sphl_lights_position[i] = program.GetUniformLocation(name);
- sprintf_s(name, "SphlLights[%d].LightProbeCubeMap", i); locations[name] = sphl_lights_lightProbeCubeMap[i] = program.GetUniformLocation(name);
- sprintf_s(name, "SphlLights[%d].EnvironmentCubeMap", i); locations[name] = sphl_lights_environmentCubeMap[i] = program.GetUniformLocation(name);
- sprintf_s(name, "SphlLights[%d].DepthShadowCubeMap", i); locations[name] = sphl_lights_depthShadowCubeMap[i] = program.GetUniformLocation(name);
- sprintf_s(name, "SphlLights[%d].DepthShadowZFar", i); locations[name] = sphl_lights_depthShadowZFar[i] = program.GetUniformLocation(name);
- for (int j = 0; j < 9; j++)
- {
- sphl_lights_sph[i][j] = -1;
- sprintf_s(name, "SphlLights[%d].sph[%d]", i, j); locations[name] = sphl_lights_sph[i][j] = program.GetUniformLocation(name);
- }
- }
- locations["ToneMapScale"] = toneMapScale = program.GetUniformLocation("ToneMapScale");
- locations["ToneMapExposure"] = toneMapExposure = program.GetUniformLocation("ToneMapExposure");
- locations["ToneMapGamma"] = toneMapGamma = program.GetUniformLocation("ToneMapGamma");
- locations["SunDirTo"] = sunDirTo = program.GetUniformLocation("SunDirTo");
- locations["SunColor"] = sunColor = program.GetUniformLocation("SunColor");
- locations["SunSize"] = sunSize = program.GetUniformLocation("SunSize");
- locations["SunShadowMap"] = sunShadowMap = program.GetUniformLocation("SunShadowMap");
- locations["SunColorMap"] = sunColorMap = program.GetUniformLocation("SunColorMap");
- locations["SunShadowMatrix"] = sunShadowMatrix = program.GetUniformLocation("SunShadowMatrix");
- locations["SunE0"] = sunE0 = program.GetUniformLocation("SunE0");
- locations["GroundE0"] = groundE0 = program.GetUniformLocation("GroundE0");
- locations["EnviroCubeMap"] = enviroCubeMap = program.GetUniformLocation("EnviroCubeMap");
- locations["EnviroCubeMapAmount"] = enviroCubeMapAmount = program.GetUniformLocation("EnviroCubeMapAmount");
- locations["PBSkyCubeMap"] = pbskyCubeMap = program.GetUniformLocation("PBSkyCubeMap");
- locations["ShaderDebugChoice"] = shaderDebugChoice = program.GetUniformLocation("ShaderDebugChoice");
- locations["ShaderDebugLight"] = shaderDebugLight = program.GetUniformLocation("ShaderDebugLight");
- locations["ShaderDebugSphl"] = shaderDebugSphl = program.GetUniformLocation("ShaderDebugSphl");
- // Do the new way by finding out what uniforms the program actually has, or is looking for...
- newLocationList.Clear();
- for (auto uniform : program.activeUniforms)
- {
- // uniform.first is the name of the uniform...
- // uniform.second has the details...
- newLocationList[uniform.first] = MakeSharedIntProperty(uniform.second.index);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement