コード例 #1
0
ファイル: Vector3DExtensions.cs プロジェクト: alir14/3DModel
        public static global::SharpDX.Color4 Normalized(this global::SharpDX.Color4 vector)
        {
            var v = vector.ToVector3();

            v.Normalize();
            return(v.ToColor4());
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 /// <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));
 }