| 2754 | } |
| 2755 | |
| 2756 | void SceneGraph::ApplyScriptParams(SceneGraph* scenegraph, const ScriptParamMap& spm) { |
| 2757 | scenegraph->level->SetScriptParams(spm); |
| 2758 | { |
| 2759 | ScriptParamMap::const_iterator iter = spm.find("Sky Rotation"); |
| 2760 | if (iter != spm.end()) { |
| 2761 | const ScriptParam& sp = iter->second; |
| 2762 | float new_sky_rotation = sp.GetFloat(); |
| 2763 | Sky* sky = scenegraph->sky; |
| 2764 | if (new_sky_rotation != sky->sky_rotation) { |
| 2765 | sky->sky_rotation = sp.GetFloat(); |
| 2766 | sky->LightingChanged(scenegraph->terrain_object_ != NULL); |
| 2767 | } |
| 2768 | } |
| 2769 | } |
| 2770 | { |
| 2771 | ScriptParamMap::const_iterator iter = spm.find("Saturation"); |
| 2772 | if (iter == spm.end()) { |
| 2773 | scenegraph->level->script_params().ASAddFloat("Saturation", 1.0f); |
| 2774 | } |
| 2775 | } |
| 2776 | { |
| 2777 | ScriptParamMap::const_iterator iter = spm.find("Sky Tint"); |
| 2778 | ScriptParamMap::const_iterator iter2 = spm.find("Sky Brightness"); |
| 2779 | if (iter != spm.end() && iter2 != spm.end()) { |
| 2780 | const ScriptParam& sp = iter->second; |
| 2781 | const std::string& new_sky_tint = sp.GetString(); |
| 2782 | /*if(new_sky_tint.size() == 7 && new_sky_tint[0] == '#'){ |
| 2783 | vec3 color; |
| 2784 | color[0] = (HexToVal(new_sky_tint[1])*16.0f + HexToVal(new_sky_tint[2])) / 255.0f; |
| 2785 | color[1] = (HexToVal(new_sky_tint[3])*16.0f + HexToVal(new_sky_tint[4])) / 255.0f; |
| 2786 | color[2] = (HexToVal(new_sky_tint[5])*16.0f + HexToVal(new_sky_tint[6])) / 255.0f; |
| 2787 | Sky* sky = scenegraph->sky; |
| 2788 | if(color != sky->sky_tint){ |
| 2789 | sky->sky_tint = color; |
| 2790 | sky->LightingChanged(scenegraph->terrain_object_ != NULL); |
| 2791 | } |
| 2792 | }*/ |
| 2793 | vec3 color = ColorFromString(new_sky_tint.c_str()); |
| 2794 | color *= iter2->second.GetFloat(); |
| 2795 | Sky* sky = scenegraph->sky; |
| 2796 | if (color != sky->sky_tint) { |
| 2797 | sky->sky_tint = color; |
| 2798 | sky->sky_base_tint = color; |
| 2799 | sky->LightingChanged(scenegraph->terrain_object_ != NULL); |
| 2800 | } |
| 2801 | } |
| 2802 | } |
| 2803 | { |
| 2804 | ScriptParamMap::const_iterator iter = spm.find("HDR White point"); |
| 2805 | if (iter != spm.end()) { |
| 2806 | const ScriptParam& sp = iter->second; |
| 2807 | Graphics::Instance()->hdr_white_point = sp.GetFloat(); |
| 2808 | } |
| 2809 | } |
| 2810 | { |
| 2811 | ScriptParamMap::const_iterator iter = spm.find("HDR Black point"); |
| 2812 | if (iter != spm.end()) { |
| 2813 | const ScriptParam& sp = iter->second; |
nothing calls this directly
no test coverage detected