diff options
author | unknown | 2009-12-09 01:34:26 +0100 |
---|---|---|
committer | unknown | 2009-12-09 01:34:26 +0100 |
commit | e3f229225c5a1506090bfcffcce6d423a566f1fe (patch) | |
tree | 8890b3404d3ca2045e6bb6ceb433069b60d77de0 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |
parent | Merge branch 'careminster' into windlight (diff) | |
download | opensim-SC-e3f229225c5a1506090bfcffcce6d423a566f1fe.zip opensim-SC-e3f229225c5a1506090bfcffcce6d423a566f1fe.tar.gz opensim-SC-e3f229225c5a1506090bfcffcce6d423a566f1fe.tar.bz2 opensim-SC-e3f229225c5a1506090bfcffcce6d423a566f1fe.tar.xz |
Enable scripting interface for windlight
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 333 |
1 files changed, 333 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7f739b1..33c67d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Region.CoreModules.Avatar.NPC; | |||
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | using OpenSim.Region.Framework.Scenes.Hypergrid; | 44 | using OpenSim.Region.Framework.Scenes.Hypergrid; |
45 | using OpenSim.Region.CoreModules.World.Meta7Windlight; | ||
45 | using OpenSim.Region.ScriptEngine.Shared; | 46 | using OpenSim.Region.ScriptEngine.Shared; |
46 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 47 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
47 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 48 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
@@ -1974,5 +1975,337 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1974 | return ret; | 1975 | return ret; |
1975 | } | 1976 | } |
1976 | 1977 | ||
1978 | /// <summary> | ||
1979 | /// Get the current Windlight scene | ||
1980 | /// </summary> | ||
1981 | /// <returns>List of windlight parameters</returns> | ||
1982 | public LSL_List osGetWindlightScene(LSL_List rules) | ||
1983 | { | ||
1984 | CheckThreatLevel(ThreatLevel.Low, "osGetWindlightScene"); | ||
1985 | m_host.AddScriptLPS(1); | ||
1986 | RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; | ||
1987 | |||
1988 | LSL_List values = new LSL_List(); | ||
1989 | int idx = 0; | ||
1990 | while (idx < rules.Length) | ||
1991 | { | ||
1992 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | ||
1993 | LSL_List toadd = new LSL_List(); | ||
1994 | |||
1995 | switch (rule) | ||
1996 | { | ||
1997 | case (int)ScriptBaseClass.WL_AMBIENT: | ||
1998 | toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); | ||
1999 | break; | ||
2000 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | ||
2001 | toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); | ||
2002 | break; | ||
2003 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | ||
2004 | toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); | ||
2005 | break; | ||
2006 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | ||
2007 | toadd.Add(new LSL_Float(wl.blurMultiplier)); | ||
2008 | break; | ||
2009 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | ||
2010 | toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); | ||
2011 | break; | ||
2012 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | ||
2013 | toadd.Add(new LSL_Float(wl.cloudCoverage)); | ||
2014 | break; | ||
2015 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | ||
2016 | toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); | ||
2017 | break; | ||
2018 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | ||
2019 | toadd.Add(new LSL_Float(wl.cloudScale)); | ||
2020 | break; | ||
2021 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | ||
2022 | toadd.Add(new LSL_Float(wl.cloudScrollX)); | ||
2023 | break; | ||
2024 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | ||
2025 | toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); | ||
2026 | break; | ||
2027 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | ||
2028 | toadd.Add(new LSL_Float(wl.cloudScrollY)); | ||
2029 | break; | ||
2030 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | ||
2031 | toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); | ||
2032 | break; | ||
2033 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | ||
2034 | toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); | ||
2035 | break; | ||
2036 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | ||
2037 | toadd.Add(new LSL_Float(wl.densityMultiplier)); | ||
2038 | break; | ||
2039 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | ||
2040 | toadd.Add(new LSL_Float(wl.distanceMultiplier)); | ||
2041 | break; | ||
2042 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | ||
2043 | toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); | ||
2044 | break; | ||
2045 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | ||
2046 | toadd.Add(new LSL_Float(wl.eastAngle)); | ||
2047 | break; | ||
2048 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | ||
2049 | toadd.Add(new LSL_Float(wl.fresnelOffset)); | ||
2050 | break; | ||
2051 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | ||
2052 | toadd.Add(new LSL_Float(wl.fresnelScale)); | ||
2053 | break; | ||
2054 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | ||
2055 | toadd.Add(new LSL_Float(wl.hazeDensity)); | ||
2056 | break; | ||
2057 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | ||
2058 | toadd.Add(new LSL_Float(wl.hazeHorizon)); | ||
2059 | break; | ||
2060 | case (int)ScriptBaseClass.WL_HORIZON: | ||
2061 | toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); | ||
2062 | break; | ||
2063 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | ||
2064 | toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); | ||
2065 | break; | ||
2066 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | ||
2067 | toadd.Add(new LSL_Integer(wl.maxAltitude)); | ||
2068 | break; | ||
2069 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | ||
2070 | toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); | ||
2071 | break; | ||
2072 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | ||
2073 | toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); | ||
2074 | break; | ||
2075 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | ||
2076 | toadd.Add(new LSL_Float(wl.refractScaleAbove)); | ||
2077 | break; | ||
2078 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | ||
2079 | toadd.Add(new LSL_Float(wl.refractScaleBelow)); | ||
2080 | break; | ||
2081 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | ||
2082 | toadd.Add(new LSL_Float(wl.sceneGamma)); | ||
2083 | break; | ||
2084 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | ||
2085 | toadd.Add(new LSL_Float(wl.starBrightness)); | ||
2086 | break; | ||
2087 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | ||
2088 | toadd.Add(new LSL_Float(wl.sunGlowFocus)); | ||
2089 | break; | ||
2090 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | ||
2091 | toadd.Add(new LSL_Float(wl.sunGlowSize)); | ||
2092 | break; | ||
2093 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | ||
2094 | toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); | ||
2095 | break; | ||
2096 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | ||
2097 | toadd.Add(new LSL_Float(wl.underwaterFogModifier)); | ||
2098 | break; | ||
2099 | case (int)ScriptBaseClass.WL_WATER_COLOR: | ||
2100 | toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); | ||
2101 | break; | ||
2102 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | ||
2103 | toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); | ||
2104 | break; | ||
2105 | } | ||
2106 | |||
2107 | if (toadd.Length > 0) | ||
2108 | { | ||
2109 | values.Add(rule); | ||
2110 | values.Add(toadd.Data[0]); | ||
2111 | } | ||
2112 | idx++; | ||
2113 | } | ||
2114 | |||
2115 | |||
2116 | return values; | ||
2117 | |||
2118 | } | ||
2119 | |||
2120 | /// <summary> | ||
2121 | /// Set the current Windlight scene | ||
2122 | /// </summary> | ||
2123 | /// <param name="rules"></param> | ||
2124 | /// <returns>success: true or false</returns> | ||
2125 | public int osSetWindlightScene(LSL_List rules) | ||
2126 | { | ||
2127 | CheckThreatLevel(ThreatLevel.High, "osSetWindlightScene"); | ||
2128 | int success = 0; | ||
2129 | m_host.AddScriptLPS(1); | ||
2130 | if (Meta7WindlightModule.EnableWindlight) | ||
2131 | { | ||
2132 | RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; | ||
2133 | |||
2134 | LSL_List values = new LSL_List(); | ||
2135 | int idx = 0; | ||
2136 | success = 1; | ||
2137 | while (idx < rules.Length) | ||
2138 | { | ||
2139 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | ||
2140 | LSL_Types.Quaternion iQ; | ||
2141 | LSL_Types.Vector3 iV; | ||
2142 | switch (rule) | ||
2143 | { | ||
2144 | case (int)ScriptBaseClass.WL_AMBIENT: | ||
2145 | idx++; | ||
2146 | iQ = rules.GetQuaternionItem(idx); | ||
2147 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
2148 | break; | ||
2149 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | ||
2150 | idx++; | ||
2151 | iV = rules.GetVector3Item(idx); | ||
2152 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
2153 | break; | ||
2154 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | ||
2155 | idx++; | ||
2156 | iQ = rules.GetQuaternionItem(idx); | ||
2157 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
2158 | break; | ||
2159 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | ||
2160 | idx++; | ||
2161 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
2162 | break; | ||
2163 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | ||
2164 | idx++; | ||
2165 | iQ = rules.GetQuaternionItem(idx); | ||
2166 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
2167 | break; | ||
2168 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | ||
2169 | idx++; | ||
2170 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); | ||
2171 | break; | ||
2172 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | ||
2173 | idx++; | ||
2174 | iV = rules.GetVector3Item(idx); | ||
2175 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
2176 | break; | ||
2177 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | ||
2178 | idx++; | ||
2179 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); | ||
2180 | break; | ||
2181 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | ||
2182 | idx++; | ||
2183 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); | ||
2184 | break; | ||
2185 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | ||
2186 | idx++; | ||
2187 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
2188 | break; | ||
2189 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | ||
2190 | idx++; | ||
2191 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); | ||
2192 | break; | ||
2193 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | ||
2194 | idx++; | ||
2195 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
2196 | break; | ||
2197 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | ||
2198 | idx++; | ||
2199 | iV = rules.GetVector3Item(idx); | ||
2200 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
2201 | break; | ||
2202 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | ||
2203 | idx++; | ||
2204 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
2205 | break; | ||
2206 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | ||
2207 | idx++; | ||
2208 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
2209 | break; | ||
2210 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | ||
2211 | idx++; | ||
2212 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
2213 | break; | ||
2214 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | ||
2215 | idx++; | ||
2216 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); | ||
2217 | break; | ||
2218 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | ||
2219 | idx++; | ||
2220 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); | ||
2221 | break; | ||
2222 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | ||
2223 | idx++; | ||
2224 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); | ||
2225 | break; | ||
2226 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | ||
2227 | idx++; | ||
2228 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); | ||
2229 | break; | ||
2230 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | ||
2231 | idx++; | ||
2232 | wl.hazeHorizon= (float)rules.GetLSLFloatItem(idx); | ||
2233 | break; | ||
2234 | case (int)ScriptBaseClass.WL_HORIZON: | ||
2235 | idx++; | ||
2236 | iQ = rules.GetQuaternionItem(idx); | ||
2237 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
2238 | break; | ||
2239 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | ||
2240 | idx++; | ||
2241 | iV = rules.GetVector3Item(idx); | ||
2242 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
2243 | break; | ||
2244 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | ||
2245 | idx++; | ||
2246 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; | ||
2247 | break; | ||
2248 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | ||
2249 | idx++; | ||
2250 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); | ||
2251 | break; | ||
2252 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | ||
2253 | idx++; | ||
2254 | iV = rules.GetVector3Item(idx); | ||
2255 | wl.reflectionWaveletScale= new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
2256 | break; | ||
2257 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | ||
2258 | idx++; | ||
2259 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); | ||
2260 | break; | ||
2261 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | ||
2262 | idx++; | ||
2263 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); | ||
2264 | break; | ||
2265 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | ||
2266 | idx++; | ||
2267 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); | ||
2268 | break; | ||
2269 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | ||
2270 | idx++; | ||
2271 | wl.starBrightness= (float)rules.GetLSLFloatItem(idx); | ||
2272 | break; | ||
2273 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | ||
2274 | idx++; | ||
2275 | wl.sunGlowFocus= (float)rules.GetLSLFloatItem(idx); | ||
2276 | break; | ||
2277 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | ||
2278 | idx++; | ||
2279 | wl.sunGlowSize= (float)rules.GetLSLFloatItem(idx); | ||
2280 | break; | ||
2281 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | ||
2282 | idx++; | ||
2283 | iQ = rules.GetQuaternionItem(idx); | ||
2284 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
2285 | break; | ||
2286 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | ||
2287 | idx++; | ||
2288 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); | ||
2289 | break; | ||
2290 | case (int)ScriptBaseClass.WL_WATER_COLOR: | ||
2291 | idx++; | ||
2292 | iV = rules.GetVector3Item(idx); | ||
2293 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
2294 | break; | ||
2295 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | ||
2296 | idx++; | ||
2297 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); | ||
2298 | break; | ||
2299 | default: | ||
2300 | success = 0; | ||
2301 | break; | ||
2302 | } | ||
2303 | idx++; | ||
2304 | } | ||
2305 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | ||
2306 | |||
2307 | } | ||
2308 | return success; | ||
2309 | } | ||
1977 | } | 2310 | } |
1978 | } | 2311 | } |