Index: binaries/data/mods/public/gui/pregame/mainmenu.js
===================================================================
--- binaries/data/mods/public/gui/pregame/mainmenu.js	(Revision 13870)
+++ binaries/data/mods/public/gui/pregame/mainmenu.js	(Arbeitskopie)
@@ -162,7 +162,7 @@
 			Engine.PushGuiPage("page_splashscreen.xml", { "page": "splashscreen" } );
 
 		// Warn about removing fixed render path
-		if (renderer.renderpath == "fixed")
+		if (Engine.Renderer_GetRenderPath() == "fixed")
 			messageBox(
 				600,
 				300,
Index: binaries/data/mods/public/gui/session/session.xml
===================================================================
--- binaries/data/mods/public/gui/session/session.xml	(Revision 13870)
+++ binaries/data/mods/public/gui/session/session.xml	(Arbeitskopie)
@@ -64,14 +64,18 @@
 	<!-- Unit silhouettes -->
 	<object hotkey="silhouettes">
 	    <action on="Press">
-		renderer.silhouettes = !renderer.silhouettes;
-		getGUIObjectByName("silhouettesCheckbox").checked = renderer.silhouettes;
+		var newSetting = !Engine.Renderer_GetSILHOUETTESEnabled();
+		Engine.Renderer_SetSILHOUETTESEnabled(newSetting);
+		getGUIObjectByName("silhouettesCheckbox").checked = newSetting;
 	    </action>
 	</object>
 
 	<!-- Sky -->
 	<object hotkey="showsky">
-	    <action on="Press">renderer.showsky = !renderer.showsky;</action>
+	    <action on="Press">
+		var newSetting =  !Engine.Renderer_GetSHOWSKYEnabled();
+		Engine.Renderer_SetSHOWSKYEnabled(newSetting);
+	    </action>
 	</object>
 
 	<!-- Pause -->
@@ -450,78 +454,78 @@
 				<!-- Settings / shadows -->
 				<object size="0 10 100%-80 35" type="text" style="RightLabelText" ghost="true">Enable Shadows</object>
 				<object name="shadowsCheckbox" size="100%-56 15 100%-30 40" type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.shadows) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.shadows = this.checked;</action>
+					<action on="Load">this.checked = Engine.Renderer_GetSHADOWSEnabled();</action>
+					<action on="Press">Engine.Renderer_SetSHADOWSEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Shadow PCF -->
 				<object size="0 35 100%-80 60" type="text" style="RightLabelText" ghost="true">Enable Shadow Filtering</object>
 				<object name="shadowPCFCheckbox" size="100%-56 40 100%-30 65" type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.shadowPCF) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.shadowPCF = this.checked;</action>
+					<action on="Load">this.checked = Engine.Renderer_GetSHADOWPCFEnabled();</action>
+					<action on="Press">Engine.Renderer_SetSHADOWPCFEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Water Normals -->
 				<object size="0 60 100%-80 85" type="text" style="RightLabelText" ghost="true">Water - HQ Waviness</object>
 				<object name="waterNormalCheckox" size="100%-56 65 100%-30 90"  type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.waternormal) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.waternormal = this.checked;</action>
+					<action on="Load">this.checked = Engine.Renderer_GetWATERNORMALEnabled();</action>
+					<action on="Press">Engine.Renderer_SetWATERNORMALEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Real Depth -->
 				<object size="0 85 100%-80 110" type="text" style="RightLabelText" ghost="true">Water - Use Actual Depth</object>
 				<object name="waterRealDepthCheckbox" size="100%-56 90 100%-30 115"  type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.waterrealdepth) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.waterrealdepth = this.checked; </action>
+					<action on="Load">this.checked = Engine.Renderer_GetWATERREALDEPTHEnabled();</action>
+					<action on="Press">Engine.Renderer_SetWATERREALDEPTHEnabled(this.checked);</action>
 				</object>
 
 				<!-- Settings / Reflection -->
 				<object size="0 110 100%-80 135" type="text" style="RightLabelText" ghost="true">Water - Enable Reflections</object>
 				<object name="waterReflectionCheckbox" size="100%-56 115 100%-30 140"  type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.waterreflection) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.waterreflection = this.checked; </action>
+					<action on="Load">this.checked = Engine.Renderer_GetWATERREFLECTIONEnabled();</action>
+					<action on="Press">Engine.Renderer_SetWATERREFLECTIONEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Refraction -->
 				<object size="0 135 100%-80 160" type="text" style="RightLabelText" ghost="true">Water - Enable Refraction</object>
 				<object name="waterRefractionCheckbox" size="100%-56 140 100%-30 165"  type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.waterrefraction) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.waterrefraction = this.checked; </action>
+					<action on="Load">this.checked = Engine.Renderer_GetWATERREFRACTIONEnabled();</action>
+					<action on="Press">Engine.Renderer_SetWATERREFRACTIONEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Foam -->
 				<object size="0 160 100%-80 185" type="text" style="RightLabelText" ghost="true">Water - Enable Shore Foam</object>
 				<object name="waterFoamCheckbox" size="100%-56 165 100%-30 190"  type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.waterfoam) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.waterfoam = this.checked; </action>
+					<action on="Load">this.checked = Engine.Renderer_GetWATERFOAMEnabled();</action>
+					<action on="Press">Engine.Renderer_SetWATERFOAMEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Waves -->
 				<object size="0 185 100%-80 210" type="text" style="RightLabelText" ghost="true">Water - Enable Shore Waves</object>
 				<object name="waterCoastalWavesCheckbox" size="100%-56 190 100%-30 215"  type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.watercoastalwaves) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.watercoastalwaves = this.checked; </action>
+					<action on="Load">this.checked = Engine.Renderer_GetWATERCOASTALWAVESEnabled();</action>
+					<action on="Press">Engine.Renderer_SetWATERCOASTALWAVESEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Shadows -->
 				<object size="0 210 100%-80 235" type="text" style="RightLabelText" ghost="true">Water - Use Surface Shadows</object>
 				<object name="waterShadowsCheckbox" size="100%-56 215 100%-30 240"  type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.watershadow) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.watershadow = this.checked; </action>
+					<action on="Load">if (Engine.Renderer_GetWATERSHADOWEnabled()) this.checked = true; else this.checked = false;</action>
+					<action on="Press">Engine.Renderer_SetWATERSHADOWEnabled(this.checked);</action>
 				</object>
 
 				<!-- Settings / Particles -->
 				<object size="0 235 100%-80 260" type="text" style="RightLabelText" ghost="true">Enable Particles</object>
 				<object name="particlesCheckbox" size="100%-56 240 100%-30 265" type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.particles) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.particles = this.checked;</action>
+					<action on="Load">this.checked = Engine.Renderer_GetPARTICLESEnabled();</action>
+					<action on="Press">Engine.Renderer_SetPARTICLESEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Unit Silhouettes -->
 				<object size="0 260 100%-80 285" type="text" style="RightLabelText" ghost="true">Enable Unit Silhouettes</object>
 				<object name="silhouettesCheckbox" size="100%-56 265 100%-30 290" type="checkbox" style="StoneCrossBox" checked="true">
-					<action on="Load">if (renderer.silhouettes) this.checked = true; else this.checked = false;</action>
-					<action on="Press">renderer.silhouettes = this.checked;</action>
+					<action on="Load">this.checked = Engine.Renderer_GetSILHOUETTESEnabled();</action>
+					<action on="Press">Engine.Renderer_SetSILHOUETTESEnabled(this.checked);</action>
 				</object>
 				
 				<!-- Settings / Music-->
Index: binaries/data/mods/public/gui/options/options.xml
===================================================================
--- binaries/data/mods/public/gui/options/options.xml	(Revision 13870)
+++ binaries/data/mods/public/gui/options/options.xml	(Arbeitskopie)
@@ -28,22 +28,22 @@
                         <!-- Settings / shadows -->
                         <object size="0 10 100%-80 35" type="text" style="RightLabelText" ghost="true">Enable Shadows</object>
                         <object name="shadowsCheckbox" size="100%-56 15 100%-30 40" type="checkbox" style="StoneCrossBox" checked="true">
-                                <action on="Load">if (renderer.shadows) this.checked = true; else this.checked = false;</action>
-                                <action on="Press">renderer.shadows = this.checked;</action>
+                                <action on="Load">this.checked = Engine.Renderer_GetSHADOWSEnabled();</action>
+                                <action on="Press">Engine.Renderer_SetSHADOWSEnabled(this.checked);</action>
                         </object>	
 
                         <!-- Settings / Shadow PCF -->
                         <object size="0 35 100%-80 60" type="text" style="RightLabelText" ghost="true">Enable Shadow Filtering</object>
                         <object name="shadowPCFCheckbox" size="100%-56 40 100%-30 65" type="checkbox" style="StoneCrossBox" checked="true">
-                                <action on="Load">if (renderer.shadowPCF) this.checked = true; else this.checked = false;</action>
-                                <action on="Press">renderer.shadowPCF = this.checked;</action>
+                                <action on="Load">this.checked = Engine.Renderer_GetSHADOWPCFEnabled();</action>
+                                <action on="Press">Engine.Renderer_SetSHADOWPCFEnabled(this.checked);</action>
                         </object>
 
                         <!-- Settings / Water -->
 <!--                        <object size="0 60 100%-80 85" type="text" style="RightLabelText" ghost="true">Enable Water Reflections</object>
                         <object name="fancyWaterCheckbox" size="100%-56 65 100%-30 90"  type="checkbox" style="StoneCrossBox" checked="true">
-                                <action on="Load">if (renderer.fancyWater) this.checked = true; else this.checked = false;</action>
-                                <action on="Press">renderer.fancyWater = this.checked;</action>
+                                <action on="Load">this.checked = Engine.Renderer_GetWATERNORMALEnabled();</action>
+                                <action on="Press">Engine.Renderer_SetWATERNORMALEnabled(this.checked);</action>
                         </object>-->
 
                         <!-- Settings / Music-->
Index: build/premake/premake4.lua
===================================================================
--- build/premake/premake4.lua	(Revision 13870)
+++ build/premake/premake4.lua	(Arbeitskopie)
@@ -600,6 +600,7 @@
 		"graphics",
 		"graphics/scripting",
 		"renderer",
+		"renderer/scripting",
 		"third_party/mikktspace"
 	}
 	extern_libs = {
Index: source/ps/GameSetup/GameSetup.cpp
===================================================================
--- source/ps/GameSetup/GameSetup.cpp	(Revision 13870)
+++ source/ps/GameSetup/GameSetup.cpp	(Arbeitskopie)
@@ -321,9 +321,6 @@
 	// maths
 	JSI_Vector3D::init();
 
-	// renderer
-	CRenderer::ScriptingInit();
-
 	// ps
 	JSI_Console::init();
 
@@ -1344,7 +1341,7 @@
 		JSBool ok = JS_GetProperty(cx, g_GUI->GetScriptObject(), "cancelOnError", &fval);
 		ENSURE(ok);
 
-		jsval msgval = ToJSVal(message);
+		jsval msgval = ScriptInterface::ToJSVal(cx, message);
 
 		if (ok && !JSVAL_IS_VOID(fval))
 			JS_CallFunctionValue(cx, g_GUI->GetScriptObject(), fval, 1, &msgval, &rval);
Index: source/gui/scripting/ScriptFunctions.cpp
===================================================================
--- source/gui/scripting/ScriptFunctions.cpp	(Revision 13870)
+++ source/gui/scripting/ScriptFunctions.cpp	(Arbeitskopie)
@@ -45,6 +45,7 @@
 #include "ps/GameSetup/Atlas.h"
 #include "ps/GameSetup/Config.h"
 #include "ps/ConfigDB.h"
+#include "renderer/scripting/JSInterface_Renderer.h"
 #include "tools/atlas/GameInterface/GameLoop.h"
 
 #include "simulation2/Simulation2.h"
@@ -652,6 +653,7 @@
 void GuiScriptingInit(ScriptInterface& scriptInterface)
 {
 	JSI_GameView::RegisterScriptFunctions(scriptInterface);
+	JSI_Renderer::RegisterScriptFunctions(scriptInterface);
 
 	// GUI manager functions:
 	scriptInterface.RegisterFunction<CScriptVal, &GetActiveGui>("GetActiveGui");
Index: source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp
===================================================================
--- source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp	(Revision 13870)
+++ source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp	(Arbeitskopie)
@@ -33,6 +33,7 @@
 #include "ps/GameSetup/Config.h"
 #include "ps/GameSetup/GameSetup.h"
 #include "renderer/Renderer.h"
+#include "scripting/ScriptingHost.h"
 
 extern void (*Atlas_GLSwapBuffers)(void* context);
 
Index: source/scripting/ScriptGlue.cpp
===================================================================
--- source/scripting/ScriptGlue.cpp	(Revision 13870)
+++ source/scripting/ScriptGlue.cpp	(Arbeitskopie)
@@ -408,16 +408,7 @@
 // property accessors
 //-----------------------------------------------------------------------------
 
-JSBool GetRenderer(JSContext* UNUSED(cx), JSObject* UNUSED(obj), jsid UNUSED(id), jsval* vp)
-{
-	if (CRenderer::IsInitialised())
-		*vp = OBJECT_TO_JSVAL(g_Renderer.GetScript());
-	else
-		*vp = JSVAL_NULL;
-	return JS_TRUE;
-}
 
-
 enum ScriptGlobalTinyIDs
 {
 	GLOBAL_SELECTION,
@@ -430,7 +421,6 @@
 JSPropertySpec ScriptGlobalTable[] =
 {
 	{ "console"    , GLOBAL_CONSOLE,     JSPROP_PERMANENT|JSPROP_READONLY, JSI_Console::getConsole, 0 },
-	{ "renderer"   , 0,                  JSPROP_PERMANENT|JSPROP_READONLY, GetRenderer, 0 },
 
 	// end of table marker
 	{ 0, 0, 0, 0, 0 },
Index: source/renderer/Renderer.cpp
===================================================================
--- source/renderer/Renderer.cpp	(Revision 13870)
+++ source/renderer/Renderer.cpp	(Arbeitskopie)
@@ -68,6 +68,7 @@
 #include "renderer/TimeManager.h"
 #include "renderer/VertexBufferManager.h"
 #include "renderer/WaterManager.h"
+#include "renderer/scripting/JSInterface_Renderer.h"
 
 extern bool g_GameRestarted;
 
@@ -472,26 +473,7 @@
 	m_hCompositeAlphaMap = 0;
 
 	m_Stats.Reset();
-	AddLocalProperty(L"particles", &m_Options.m_Particles, false);
 
-	AddLocalProperty(L"waternormal", &m_Options.m_WaterNormal, false);
-	AddLocalProperty(L"waterrealdepth", &m_Options.m_WaterRealDepth, false);
-	AddLocalProperty(L"waterreflection", &m_Options.m_WaterReflection, false);
-	AddLocalProperty(L"waterrefraction", &m_Options.m_WaterRefraction, false);
-	AddLocalProperty(L"waterfoam", &m_Options.m_WaterFoam, false);
-	AddLocalProperty(L"watercoastalwaves", &m_Options.m_WaterCoastalWaves, false);
-	AddLocalProperty(L"watershadow", &m_Options.m_WaterShadow, false);
-
-	AddLocalProperty(L"horizonHeight", &m->skyManager.m_HorizonHeight, false);
-	AddLocalProperty(L"waterMurkiness", &m->waterManager.m_Murkiness, false);
-	AddLocalProperty(L"waterReflTintStrength", &m->waterManager.m_ReflectionTintStrength, false);
-	AddLocalProperty(L"waterRepeatPeriod", &m->waterManager.m_RepeatPeriod, false);
-	AddLocalProperty(L"waterShininess", &m->waterManager.m_Shininess, false);
-	AddLocalProperty(L"waterSpecularStrength", &m->waterManager.m_SpecularStrength, false);
-	AddLocalProperty(L"waterWaviness", &m->waterManager.m_Waviness, false);
-	AddLocalProperty(L"silhouettes", &m_Options.m_Silhouettes, false);
-	AddLocalProperty(L"showsky", &m_Options.m_ShowSky, false);
-
 	RegisterFileReloadFunc(ReloadChangedFileCB, this);
 }
 
@@ -721,6 +703,10 @@
 		case OPT_PARTICLES:
 			m_Options.m_Particles = value;
 			break;
+		case OPT_PREFERGLSL:
+			m_Options.m_PreferGLSL = value;
+			MakeShadersDirty();
+			break;
 		case OPT_SILHOUETTES:
 			m_Options.m_Silhouettes = value;
 			break;
@@ -760,6 +746,8 @@
 			return m_Options.m_ShadowPCF;
 		case OPT_PARTICLES:
 			return m_Options.m_Particles;
+		case OPT_PREFERGLSL:
+			return m_Options.m_PreferGLSL;
 		case OPT_SILHOUETTES:
 			return m_Options.m_Silhouettes;
 		case OPT_SHOWSKY:
@@ -1983,115 +1971,6 @@
 	m->ShadersDirty = true;
 }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Scripting Interface
-
-jsval CRenderer::JSI_GetRenderPath(JSContext*)
-{
-	return ToJSVal(GetRenderPathName(m_Options.m_RenderPath));
-}
-
-void CRenderer::JSI_SetRenderPath(JSContext* ctx, jsval newval)
-{
-	CStr name;
-
-	if (!ToPrimitive(ctx, newval, name))
-		return;
-
-	SetRenderPath(GetRenderPathByName(name));
-}
-
-jsval CRenderer::JSI_GetDepthTextureBits(JSContext*)
-{
-	return ToJSVal(m->shadow.GetDepthTextureBits());
-}
-
-void CRenderer::JSI_SetDepthTextureBits(JSContext* ctx, jsval newval)
-{
-	int depthTextureBits;
-
-	if (!ToPrimitive(ctx, newval, depthTextureBits))
-		return;
-
-	m->shadow.SetDepthTextureBits(depthTextureBits);
-}
-
-jsval CRenderer::JSI_GetShadows(JSContext*)
-{
-	return ToJSVal(m_Options.m_Shadows);
-}
-
-void CRenderer::JSI_SetShadows(JSContext* ctx, jsval newval)
-{
-	ToPrimitive(ctx, newval, m_Options.m_Shadows);
-	ReloadShaders();
-}
-
-jsval CRenderer::JSI_GetShadowAlphaFix(JSContext*)
-{
-	return ToJSVal(m_Options.m_ShadowAlphaFix);
-}
-
-void CRenderer::JSI_SetShadowAlphaFix(JSContext* ctx, jsval newval)
-{
-	if (!ToPrimitive(ctx, newval, m_Options.m_ShadowAlphaFix))
-		return;
-
-	m->shadow.RecreateTexture();
-}
-
-jsval CRenderer::JSI_GetShadowPCF(JSContext*)
-{
-	return ToJSVal(m_Options.m_ShadowPCF);
-}
-
-void CRenderer::JSI_SetShadowPCF(JSContext* ctx, jsval newval)
-{
-	ToPrimitive(ctx, newval, m_Options.m_ShadowPCF);
-	ReloadShaders();
-}
-
-jsval CRenderer::JSI_GetPreferGLSL(JSContext*)
-{
-	return ToJSVal(m_Options.m_PreferGLSL);
-}
-
-void CRenderer::JSI_SetPreferGLSL(JSContext* ctx, jsval newval)
-{
-	ToPrimitive(ctx, newval, m_Options.m_PreferGLSL);
-	ReloadShaders();
-}
-
-jsval CRenderer::JSI_GetSky(JSContext*)
-{
-	return ToJSVal(m->skyManager.GetSkySet());
-}
-
-void CRenderer::JSI_SetSky(JSContext* ctx, jsval newval)
-{
-	CStrW skySet;
-	if (!ToPrimitive<CStrW>(ctx, newval, skySet)) return;
-	m->skyManager.SetSkySet(skySet);
-}
-
-void CRenderer::ScriptingInit()
-{
-	AddProperty(L"renderpath", &CRenderer::JSI_GetRenderPath, &CRenderer::JSI_SetRenderPath);
-	AddProperty(L"displayFrustum", &CRenderer::m_DisplayFrustum);
-	AddProperty(L"shadowZBias", &CRenderer::m_ShadowZBias);
-	AddProperty(L"shadowMapSize", &CRenderer::m_ShadowMapSize);
-	AddProperty(L"shadows", &CRenderer::JSI_GetShadows, &CRenderer::JSI_SetShadows);
-	AddProperty(L"depthTextureBits", &CRenderer::JSI_GetDepthTextureBits, &CRenderer::JSI_SetDepthTextureBits);
-	AddProperty(L"shadowAlphaFix", &CRenderer::JSI_GetShadowAlphaFix, &CRenderer::JSI_SetShadowAlphaFix);
-	AddProperty(L"shadowPCF", &CRenderer::JSI_GetShadowPCF, &CRenderer::JSI_SetShadowPCF);
-	AddProperty(L"preferGLSL", &CRenderer::JSI_GetPreferGLSL, &CRenderer::JSI_SetPreferGLSL);
-	AddProperty(L"skipSubmit", &CRenderer::m_SkipSubmit);
-	AddProperty(L"skySet", &CRenderer::JSI_GetSky, &CRenderer::JSI_SetSky);
-
-	CJSObject<CRenderer>::ScriptingInit("Renderer");
-}
-
-
 CTextureManager& CRenderer::GetTextureManager()
 {
 	return m->textureManager;
Index: source/renderer/Renderer.h
===================================================================
--- source/renderer/Renderer.h	(Revision 13870)
+++ source/renderer/Renderer.h	(Arbeitskopie)
@@ -28,11 +28,11 @@
 #include "graphics/ShaderProgram.h"
 #include "lib/res/handle.h"
 #include "ps/Singleton.h"
-#include "scripting/ScriptableObject.h"
 
 #include "renderer/PostprocManager.h"
 #include "renderer/Scene.h"
 #include "renderer/TimeManager.h"
+#include "scriptinterface/ScriptInterface.h"
 
 // necessary declarations
 class CLightEnv;
@@ -71,7 +71,6 @@
 
 class CRenderer :
 	public Singleton<CRenderer>,
-	public CJSObject<CRenderer>,
 	private SceneCollector
 {
 public:
@@ -89,6 +88,7 @@
 		OPT_WATERSHADOW,
 		OPT_SHADOWPCF,
 		OPT_PARTICLES,
+		OPT_PREFERGLSL,
 		OPT_SILHOUETTES,
 		OPT_SHOWSKY
 	};
@@ -317,7 +317,7 @@
 	 */
 	const Caps& GetCapabilities() const { return m_Caps; }
 
-	static void ScriptingInit();
+	static void RegisterScriptFunctions(ScriptInterface& scriptInterface);
 
 protected:
 	friend struct CRendererInternals;
@@ -335,24 +335,6 @@
 	friend class ShaderInstancingModelRenderer;
 	friend class TerrainRenderer;
 
-	// scripting
-	// TODO: Perhaps we could have a version of AddLocalProperty for function-driven
-	// properties? Then we could hide these function in the private implementation class.
-	jsval JSI_GetRenderPath(JSContext*);
-	void JSI_SetRenderPath(JSContext* ctx, jsval newval);
-	jsval JSI_GetDepthTextureBits(JSContext*);
-	void JSI_SetDepthTextureBits(JSContext* ctx, jsval newval);
-	jsval JSI_GetShadows(JSContext*);
-	void JSI_SetShadows(JSContext* ctx, jsval newval);
-	jsval JSI_GetShadowAlphaFix(JSContext*);
-	void JSI_SetShadowAlphaFix(JSContext* ctx, jsval newval);
-	jsval JSI_GetShadowPCF(JSContext*);
-	void JSI_SetShadowPCF(JSContext* ctx, jsval newval);
-	jsval JSI_GetPreferGLSL(JSContext*);
-	void JSI_SetPreferGLSL(JSContext* ctx, jsval newval);
-	jsval JSI_GetSky(JSContext*);
-	void JSI_SetSky(JSContext* ctx, jsval newval);
-
 	//BEGIN: Implementation of SceneCollector
 	void Submit(CPatch* patch);
 	void Submit(SOverlayLine* overlay);
Index: source/renderer/scripting/JSInterface_Renderer.cpp
===================================================================
--- source/renderer/scripting/JSInterface_Renderer.cpp	(Revision 0)
+++ source/renderer/scripting/JSInterface_Renderer.cpp	(Arbeitskopie)
@@ -0,0 +1,85 @@
+/* Copyright (C) 2013 Wildfire Games.
+ * This file is part of 0 A.D.
+ *
+ * 0 A.D. is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 0 A.D. is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "precompiled.h"
+
+#include "JSInterface_Renderer.h"
+#include "renderer/Renderer.h"
+
+#define IMPLEMENT_BOOLEAN_SCRIPT_SETTING(NAME) \
+bool JSI_Renderer::Get##NAME##Enabled(void* UNUSED(cbdata)) \
+{ \
+	return g_Renderer.GetOptionBool(CRenderer::OPT_##NAME); \
+} \
+\
+void JSI_Renderer::Set##NAME##Enabled(void* UNUSED(cbdata), bool Enabled) \
+{ \
+	g_Renderer.SetOptionBool(CRenderer::OPT_##NAME, Enabled); \
+}
+
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(PARTICLES);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(PREFERGLSL);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERNORMAL);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SHADOWPCF);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SHADOWS);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERREALDEPTH);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERREFLECTION);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERREFRACTION);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERFOAM);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERCOASTALWAVES);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERSHADOW);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SILHOUETTES);
+IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SHOWSKY);
+
+#undef IMPLEMENT_BOOLEAN_SCRIPT_SETTING
+
+std::string JSI_Renderer::GetRenderPath(void* UNUSED(cbdata))
+{
+	return CRenderer::GetRenderPathName(g_Renderer.GetRenderPath());
+}
+
+void JSI_Renderer::SetRenderPath(void* UNUSED(cbdata), std::string name)
+{
+	g_Renderer.SetRenderPath(CRenderer::GetRenderPathByName(name));
+}
+
+
+#define REGISTER_BOOLEAN_SCRIPT_SETTING(NAME) \
+scriptInterface.RegisterFunction<bool, &JSI_Renderer::Get##NAME##Enabled>("Renderer_Get" #NAME "Enabled"); \
+scriptInterface.RegisterFunction<void, bool, &JSI_Renderer::Set##NAME##Enabled>("Renderer_Set" #NAME "Enabled");
+
+void JSI_Renderer::RegisterScriptFunctions(ScriptInterface& scriptInterface)
+{
+	scriptInterface.RegisterFunction<std::string, &JSI_Renderer::GetRenderPath>("Renderer_GetRenderPath");
+	scriptInterface.RegisterFunction<void, std::string, &JSI_Renderer::SetRenderPath>("Renderer_SetRenderPath");
+	REGISTER_BOOLEAN_SCRIPT_SETTING(SHADOWS);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(SHADOWPCF);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(PARTICLES);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(PREFERGLSL);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(WATERNORMAL);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(WATERREALDEPTH);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(WATERREFLECTION);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(WATERREFRACTION);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(WATERFOAM);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(WATERCOASTALWAVES);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(WATERSHADOW);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(SILHOUETTES);
+	REGISTER_BOOLEAN_SCRIPT_SETTING(SHOWSKY);
+}
+
+#undef REGISTER_BOOLEAN_SCRIPT_SETTING
+
Index: source/renderer/scripting/JSInterface_Renderer.h
===================================================================
--- source/renderer/scripting/JSInterface_Renderer.h	(Revision 0)
+++ source/renderer/scripting/JSInterface_Renderer.h	(Arbeitskopie)
@@ -0,0 +1,53 @@
+/* Copyright (C) 2013 Wildfire Games.
+ * This file is part of 0 A.D.
+ *
+ * 0 A.D. is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 0 A.D. is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef INCLUDED_JSINTERFACE_RENDERER
+#define INCLUDED_JSINTERFACE_RENDERER
+
+#include "ps/CStr.h"
+#include "scriptinterface/ScriptInterface.h"
+
+#define DECLARE_BOOLEAN_SCRIPT_SETTING(NAME) \
+	bool Get##NAME##Enabled(void* cbdata); \
+	void Set##NAME##Enabled(void* cbdata, bool Enabled);
+
+namespace JSI_Renderer
+{
+	std::string GetRenderPath(void* cbdata);
+	void SetRenderPath(void* cbdata, std::string name);
+
+	DECLARE_BOOLEAN_SCRIPT_SETTING(SHADOWS);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(SHADOWPCF);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(PARTICLES);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(PREFERGLSL);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(WATERNORMAL);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(WATERREALDEPTH);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(WATERREFLECTION);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(WATERREFRACTION);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(WATERFOAM);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(WATERCOASTALWAVES);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(WATERSHADOW);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(SILHOUETTES);
+	DECLARE_BOOLEAN_SCRIPT_SETTING(SHOWSKY);
+
+	void RegisterScriptFunctions(ScriptInterface& scriptInterface);
+}
+
+#undef DECLARE_BOOLEAN_SCRIPT_SETTING
+
+#endif
