static SSLight() { for (LightName l = c_firstNameIdx; l <= c_lastNameIdx; ++l) { s_avaiableLightNames.Enqueue(l); } }
public static void Light(LightName name, LightParameter pname, Color4 @params) { unsafe { GL.Light(name, pname, (float *)&@params); } }
public Light(LightName id) { _id = id; GL.Enable(EnableCap.Lighting); GL.Enable((EnableCap)_id); }
public static EnableCap lightNameCapLookUp(LightName name) { switch (name) { case LightName.Light0: return(EnableCap.Light0); case LightName.Light1: return(EnableCap.Light1); case LightName.Light2: return(EnableCap.Light2); case LightName.Light3: return(EnableCap.Light3); case LightName.Light4: return(EnableCap.Light4); case LightName.Light5: return(EnableCap.Light5); case LightName.Light6: return(EnableCap.Light6); case LightName.Light7: return(EnableCap.Light7); } return(EnableCap.Light0); }
public Light(Vector3 lightPosition, Color4 ambientlightColor, Color4 diffuseLightColor, Color4 specularLightColor, LightName name) { LightPosition = lightPosition; AmbientColor = ambientlightColor; DiffuseColor = diffuseLightColor; SpecularColor = specularLightColor; Name = name; }
public static void Light(LightName light, LightParameter pname, float[] param) { #if USE_OPENGL OpenTK.Graphics.OpenGL.GL.Light((OpenTK.Graphics.OpenGL.LightName)light, (OpenTK.Graphics.OpenGL.LightParameter)pname, param); #else //throw new NotImplementedException(); #endif }
public SourceLight(OpenGL gl, LightName lightNum, HomogeneousCoordinates position, ColorSettingLight colorSet) { this.position = position; this.colorSet = colorSet; this.gl = gl; this.lightNum = lightNum; SetColorSet(colorSet); }
public void Set() { const LightName id = LightName.Light0; GL.Light(id, LightParameter.Ambient, Ambient); GL.Light(id, LightParameter.Diffuse, Diffuse); GL.Light(id, LightParameter.Specular, Specular); GL.Light(id, LightParameter.Position, Position); }
public override void DoLighting(LightManager lights) { FlushDrawBuffer(); if (lights.Enabled == false) { GL.Disable(EnableCap.Lighting); return; } float[] array = new float[4]; GL.Enable(EnableCap.Lighting); SetArray(array, lights.Ambient); GL.LightModelv(LightModelParameter.LightModelAmbient, array); GL.Enable(EnableCap.ColorMaterial); GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse); for (int i = 0; i < lights.Count || i < mMaxLightsUsed; i++) { EnableCap lightID = (EnableCap)((int)EnableCap.Light0 + i); LightName lightName = (LightName)((int)LightName.Light0 + i); if (i >= lights.Count) { GL.Disable(lightID); continue; } if (lights[i].Enabled == false) { GL.Disable(lightID); continue; } GL.Enable(lightID); SetArray(array, lights[i].Diffuse); GL.Lightv(lightName, LightParameter.Diffuse, array); SetArray(array, lights[i].Ambient); GL.Lightv(lightName, LightParameter.Ambient, array); SetArray(array, lights[i].Position); GL.Lightv(lightName, LightParameter.Position, array); GL.Light(lightName, LightParameter.ConstantAttenuation, lights[i].AttenuationConstant); GL.Light(lightName, LightParameter.LinearAttenuation, lights[i].AttenuationLinear); GL.Light(lightName, LightParameter.QuadraticAttenuation, lights[i].AttenuationQuadratic); } mMaxLightsUsed = lights.Count; }
public static void Lightiv(LightName light, LightParameter pname, int[] @params) { unsafe { fixed(int * @params_ptr = @params) { Interop.Calli((int)light, (int)pname, @params_ptr, LightivAddress); } } }
public MovingLight(OpenGL gl, LightName lightNum, HomogeneousCoordinates position, ColorSettingLight colorSet) : base(gl, lightNum, position, colorSet) { this.position = position; this.colorSet = colorSet; this.gl = gl; this.lightNum = lightNum; SetColorSet(colorSet); angleRot = 0; }
public void Lightfv(LightName light, LightParameter pname, float[] param) { if (param == null || param.Length > HeapData.LightfvMaxSize) { throw new ArgumentException("Array has to many elements."); } Marshal.Copy(param, 0, HeapData.ptrLightfv, param.Length); lightfv(light, pname, HeapData.ptrLightfv); }
public void setLight() { LightName lightname = LightName.Light0; EnableCap enablename = EnableCap.Light0; if (playn == 1) { lightname = LightName.Light1; enablename = EnableCap.Light1; } else if (playn == 2) { lightname = LightName.Light2; enablename = EnableCap.Light2; } else if (playn == 3) { lightname = LightName.Light3; enablename = EnableCap.Light3; } else if (playn == 4) { lightname = LightName.Light4; enablename = EnableCap.Light4; } if (!Visible) { GL.Disable(enablename); return; } const float k_amb = 0.6f; const float k_diff = 0.3f; const float k_spec = 1.0f; Color4 Color = theAppearance.Color; Color4 light_ambient = new Color4(Color.R * k_amb, Color.G * k_amb, Color.B * k_amb, 1); Color4 light_diffuse = new Color4(Color.R * k_diff, Color.G * k_diff, Color.B * k_diff, 1); Color4 light_specular = new Color4(k_spec, k_spec, k_spec, 1.0f); Vector4 light_pos = new Vector4(Center.X, Center.Y, Center.Z - 4, 1); Vector4 light_dir = new Vector4(0, 0, 1, 1); GL.Light(lightname, LightParameter.Ambient, light_ambient); GL.Light(lightname, LightParameter.Diffuse, light_diffuse); GL.Light(lightname, LightParameter.Specular, light_specular); GL.Light(lightname, LightParameter.Position, light_pos); GL.Light(lightname, LightParameter.SpotDirection, light_dir); GL.Light(lightname, LightParameter.SpotCutoff, 30.0f); GL.Enable(enablename); }
public Light(LightName name) { sphereSource.LatitudinalSlices = 8; sphereSource.LongitudinalSlices = 8; sphereSource.SetColor(1.0f, 1.0f, 1.0f); sphereSource.SetRenderMode(RenderMode.WIRE); coneSource.SetColor(1.0f, 1.0f, 1.0f); coneSource.SetRenderMode(RenderMode.WIRE); lightName = name; GL.Enable(lightNameCapLookUp(name)); }
public SSLight() : base() { if (s_avaiableLightNames.Count == 0) { string msg = "Cannot support this many lights."; throw new Exception(msg); } this.m_lightName = s_avaiableLightNames.Dequeue(); this._pos = new Vector3(0, 0, 1); this.calcMatFromState(); }
private void PrepareState_Lighting(GpuStateStruct *GpuState) { //Console.WriteLine(GpuState->LightingState.AmbientModelColor); var LightingState = &GpuState->LightingState; // if (!glEnableDisable(GL_LIGHTING, state.lighting.enabled) && (state.texture.mapMode != TextureMapMode.GU_ENVIRONMENT_MAP)) { if (!GlEnableDisable(EnableCap.Lighting, LightingState->Enabled)) { return; } GL.LightModel( LightModelParameter.LightModelColorControl, (int)((LightingState->LightModel == LightModelEnum.SeparateSpecularColor) ? LightModelColorControl.SeparateSpecularColor : LightModelColorControl.SingleColor) ); GL.LightModel(LightModelParameter.LightModelAmbient, &LightingState->AmbientLightColor.Red); for (int n = 0; n < 4; n++) { var LightState = &(&LightingState->Light0)[n]; LightName LightName = (LightName)(LightName.Light0 + n); if (!GlEnableDisable((EnableCap)(EnableCap.Light0 + n), LightState->Enabled)) { continue; } GL.Light(LightName, LightParameter.Specular, &LightState->SpecularColor.Red); GL.Light(LightName, LightParameter.Ambient, &LightState->AmbientColor.Red); GL.Light(LightName, LightParameter.Diffuse, &LightState->DiffuseColor.Red); LightState->Position.W = 1.0f; GL.Light(LightName, LightParameter.Position, &LightState->Position.X); GL.Light(LightName, LightParameter.ConstantAttenuation, &LightState->Attenuation.Constant); GL.Light(LightName, LightParameter.LinearAttenuation, &LightState->Attenuation.Linear); GL.Light(LightName, LightParameter.QuadraticAttenuation, &LightState->Attenuation.Quadratic); if (LightState->Type == LightTypeEnum.SpotLight) { GL.Light(LightName, LightParameter.SpotDirection, &LightState->SpotDirection.X); GL.Light(LightName, LightParameter.SpotExponent, &LightState->SpotExponent); GL.Light(LightName, LightParameter.SpotCutoff, &LightState->SpotCutoff); } else { GL.Light(LightName, LightParameter.SpotExponent, 0); GL.Light(LightName, LightParameter.SpotCutoff, 180); } } }
public static EnableCap lightNameCapLookUp(LightName name) { switch (name) { case LightName.Light0: return EnableCap.Light0; case LightName.Light1: return EnableCap.Light1; case LightName.Light2: return EnableCap.Light2; case LightName.Light3: return EnableCap.Light3; case LightName.Light4: return EnableCap.Light4; case LightName.Light5: return EnableCap.Light5; case LightName.Light6: return EnableCap.Light6; case LightName.Light7: return EnableCap.Light7; } return EnableCap.Light0; }
public static void Light(LightName light, LightParameter pname, Int32[] @params) { unsafe { fixed (Int32* p_params = @params) { Debug.Assert(Delegates.pglLightiv != null, "pglLightiv not implemented"); Delegates.pglLightiv((Int32)light, (Int32)pname, p_params); CallLog("glLightiv({0}, {1}, {2})", light, pname, @params); } } DebugCheckErrors(); }
public static extern void Lightf( LightName light, LightParameter pname, float param );
public SSDirectionalLight(LightName lightName) : base(lightName) { this.Direction = new Vector3 (0f, 0f, 1f); }
public static void Light(LightName light, LightParameter pname, float[] param) { #if USE_OPENGL if (openGlHardwareAvailable) { OpenTK.Graphics.OpenGL.GL.Light((OpenTK.Graphics.OpenGL.LightName)light, (OpenTK.Graphics.OpenGL.LightParameter)pname, param); } #else //throw new NotImplementedException(); #endif }
internal static extern void glLighti(LightName light, LightParameter pname, Int32 param);
public SSLightBase(LightName lightName) { this.m_lightName = lightName; }
public static UInt32 BindLightParameterEXT(LightName light, LightParameter value) { UInt32 retValue; Debug.Assert(Delegates.pglBindLightParameterEXT != null, "pglBindLightParameterEXT not implemented"); retValue = Delegates.pglBindLightParameterEXT((Int32)light, (Int32)value); CallLog("glBindLightParameterEXT({0}, {1}) = {2}", light, value, retValue); DebugCheckErrors(); return (retValue); }
internal static extern void glLightf(LightName light, LightParameter pname, Single param);
public static extern void GetLightiv( LightName light, LightParameter pname, [Out]int[] @params );
public partial uint BindLightParameter([Flow(FlowDirection.In)] LightName light, [Flow(FlowDirection.In)] LightParameter value);
public static void Light(LightName light, LightParameter pname, float[] @params) { unsafe { fixed (float* p_params = @params) { Debug.Assert(Delegates.pglLightfv != null, "pglLightfv not implemented"); Delegates.pglLightfv((Int32)light, (Int32)pname, p_params); LogFunction("glLightfv({0}, {1}, {2})", light, pname, LogValue(@params)); } } DebugCheckErrors(null); }
public static extern void Lightiv( LightName light, LightParameter pname, int[] @params );
public void AddLight(LightSource light) { if (enabledLights == 0) { GL.Enable(EnableCap.Lighting); float[] global_ambient = new float[] { 0.0f, 0.0f, 0.0f, 1.0f }; GL.LightModelv(LightModelParameter.LightModelAmbient, global_ambient); } if (enabledLights < 8) { LoadTransformation(light.Entity.Transformation.GlobalMatrix); GL.Enable((EnableCap)(EnableCap.Light0 + enabledLights)); LightName lightName = (LightName)(LightName.Light0 + enabledLights); GL.Lightv(lightName, LightParameter.Ambient, light.AmbientColor); GL.Lightv(lightName, LightParameter.Diffuse, light.DiffuseColor); if (light.LightType == LightType.SPOT) { GL.Lightv(lightName, LightParameter.Position, new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); GL.Lightv(lightName, LightParameter.SpotDirection, new Vector4(0.0f, 0.0f, -1.0f, 0.0f)); GL.Light(lightName, LightParameter.SpotCutoff, light.SpotCutoff); GL.Light(lightName, LightParameter.SpotExponent, light.SpotExponent); } else { GL.Lightv(lightName, LightParameter.Position, new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); GL.Lightv(lightName, LightParameter.SpotDirection, new Vector4(0.0f, 0.0f, 0.0f, 0.0f)); GL.Light(lightName, LightParameter.SpotCutoff, 180.0f); GL.Light(lightName, LightParameter.SpotExponent, 0); } if (light.Distance > 0.0f) { float dist = 1.0f / light.Distance; if (light.Quadratic) { GL.Light(lightName, LightParameter.ConstantAttenuation, 1.0f); GL.Light(lightName, LightParameter.LinearAttenuation, 0.0f); GL.Light(lightName, LightParameter.QuadraticAttenuation, dist); } else { GL.Light(lightName, LightParameter.ConstantAttenuation, 1.0f); GL.Light(lightName, LightParameter.LinearAttenuation, dist); GL.Light(lightName, LightParameter.QuadraticAttenuation, 0.0f); } } else { GL.Light(lightName, LightParameter.ConstantAttenuation, 1.0f); GL.Light(lightName, LightParameter.LinearAttenuation, 0.0f); GL.Light(lightName, LightParameter.QuadraticAttenuation, 0.0f); } enabledLights++; } }
public static void glLighti(LightName light, LightParameter pname, Int32 param) { i_OpenGL1_0.glLighti(light, pname, param); }
public static void Light(LightName light, LightParameter pname, float param) { Debug.Assert(Delegates.pglLightf != null, "pglLightf not implemented"); Delegates.pglLightf((Int32)light, (Int32)pname, param); LogFunction("glLightf({0}, {1}, {2})", light, pname, param); DebugCheckErrors(null); }
public static void glGetLightiv(LightName light, LightParameter pname, ref Int32[] @params) { i_OpenGL1_0.glGetLightiv(light, pname, ref @params); }
internal static extern void glLightfv(LightName light, LightParameter pname, [OutAttribute] Single * @params);
public static extern void Lighti( LightName light, LightParameter pname, int param );
internal static extern void glLightiv(LightName light, LightParameter pname, [OutAttribute] Int32 * @params);
public static extern void Lightfv( LightName light, LightParameter pname, float[] @params );
public static void glLightf(LightName light, LightParameter pname, Single param) { i_OpenGL1_0.glLightf(light, pname, param); }
public static void Light(LightName name, LightParameter pname, Vector4 @params) { unsafe { Gl.Light(name, pname, (float*)&@params.X); } }
public static void glGetLightfv(LightName light, LightParameter pname, ref Single[] @params) { i_OpenGL1_0.glGetLightfv(light, pname, ref @params); }
public static unsafe void GetLightx(this OesFixedPoint thisApi, [Flow(FlowDirection.In)] LightName light, [Flow(FlowDirection.In)] OES pname, [Count(Computed = "pname"), Flow(FlowDirection.Out)] Span <int> @params) { // SpanOverloader thisApi.GetLightx(light, pname, out @params.GetPinnableReference()); }
public static unsafe void Lightx(this OesFixedPoint thisApi, [Flow(FlowDirection.In)] LightName light, [Flow(FlowDirection.In)] LightParameter pname, [Count(Computed = "pname"), Flow(FlowDirection.In)] ReadOnlySpan <int> @params) { // SpanOverloader thisApi.Lightx(light, pname, in @params.GetPinnableReference()); }
public static void Light(LightName name, LightParameter pname, Color4 @params) { unsafe { GL.Light(name, pname, (float*)&@params); } }
internal static extern void glLightfv(LightName light, LightParameter pname, [OutAttribute] Single* @params);
public static uint BindLightParameterEXT( LightName light, LightParameter value ) { if (_BindLightParameterEXT == null) throw new Exception( "Extension method BindLightParameterEXT not found" ); return _BindLightParameterEXT( light, value ); }
public static void Light(LightName light, LightParameter pname, Int32 param) { Debug.Assert(Delegates.pglLighti != null, "pglLighti not implemented"); Delegates.pglLighti((Int32)light, (Int32)pname, param); CallLog("glLighti({0}, {1}, {2})", light, pname, param); DebugCheckErrors(); }
internal static extern void glLightiv(LightName light, LightParameter pname, [OutAttribute] Int32* @params);
public static void Light(LightName light, LightParameter pname, float[] param) { Instance?.Light(light, pname, param); }
private void setLightColor(LightName lightName, float[] whiteSpecularLight, float[] blackAmbientLight, float[] whiteDiffuseLight) { GL.Light(lightName, LightParameter.Specular, whiteSpecularLight); GL.Light(lightName, LightParameter.Ambient, blackAmbientLight); GL.Light(lightName, LightParameter.Diffuse, whiteDiffuseLight); }