public static global::SharpDX.Color4 Normalized(this global::SharpDX.Color4 vector) { var v = vector.ToVector3(); v.Normalize(); return(v.ToColor4()); }
public override void Render(RenderContext context) { if (renderHost.SupportDeferredRender) { var manager = renderHost.RenderTechniquesManager; if (renderHost.RenderTechnique == manager.RenderTechniques[DeferredRenderTechniqueNames.Deferred] || renderHost.RenderTechnique == manager.RenderTechniques[DeferredRenderTechniqueNames.GBuffer]) { return; } } if (this.IsRendering) { /// --- set lighting parameters lightColors[lightIndex] = this.Color; } else { // --- turn-off the light lightColors[lightIndex] = new global::SharpDX.Color4(0, 0, 0, 0); } /// --- set lighting parameters lightDirections[lightIndex] = -this.Direction.ToVector4(); /// --- update lighting variables this.vLightDir.Set(lightDirections); this.vLightColor.Set(lightColors); this.iLightType.Set(lightTypes); /// --- if shadow-map enabled if (this.renderHost.IsShadowMapEnabled) { /// update shader this.mLightView.SetMatrix(lightViewMatrices); this.mLightProj.SetMatrix(lightProjMatrices); } }
public override void Render(RenderContext context) { var manager = renderHost.RenderTechniquesManager; if (renderHost.RenderTechnique == manager.RenderTechniques.Get(DeferredRenderTechniqueNames.Deferred) || renderHost.RenderTechnique == manager.RenderTechniques.Get(DeferredRenderTechniqueNames.GBuffer)) { return; } if (this.IsRendering) { /// --- set lighting parameters lightColors[lightIndex] = this.Color; } else { // --- turn-off the light lightColors[lightIndex] = new global::SharpDX.Color4(0, 0, 0, 0); } /// --- set lighting parameters lightDirections[lightIndex] = -this.Direction.ToVector4(); /// --- update lighting variables this.vLightDir.Set(lightDirections); this.vLightColor.Set(lightColors); this.iLightType.Set(lightTypes); /// --- if shadow-map enabled if (this.renderHost.IsShadowMapEnabled) { /// update shader this.mLightView.SetMatrix(lightViewMatrices); this.mLightProj.SetMatrix(lightProjMatrices); } }
/// <summary> /// To the assimp color4d. /// </summary> /// <param name="v">The v.</param> /// <param name="alpha"></param> /// <returns></returns> public static Color4D ToAssimpColor4D(this global::SharpDX.Color4 v, float alpha = 1f) { return(new Color4D(v.Red, v.Green, v.Blue, 1f)); }