public bool PopulateUniformWithVisitor(LCC3ShaderUniform uniform, LCC3NodeDrawingVisitor visitor)
        {
            LCC3Semantic semantic = uniform.Semantic;
            uint semanticIndex = uniform.SemanticIndex;
            LCC3Material material;
            uint numOfTextures = (uint)visitor.CurrentMaterial.TextureCount();
            bool isInverted;

            switch (semantic)
            {
                #region Attribute Qualifiers

                case LCC3Semantic.SemanticVertexNormal:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexNormals);
                    return true;
                case LCC3Semantic.SemanticShouldNormalizeVertexNormal:
                    uniform.SetValue(visitor.CurrentMeshNode.EffectiveNormalScalingMethod == LCC3NormalScaling.CC3NormalScalingNormalize);
                    return true;
                case LCC3Semantic.SemanticShouldRescaleVertexNormal:
                    uniform.SetValue(visitor.CurrentMeshNode.EffectiveNormalScalingMethod == LCC3NormalScaling.CC3NormalScalingRescale);
                    return true;
                case LCC3Semantic.SemanticHasVertexTangent:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexTangents);
                    return true;
                case LCC3Semantic.SemanticHasVertexBitangent:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexBitangents);
                    return true;
                case LCC3Semantic.SemanticHasVertexColor:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexColors);
                    return true;
                case LCC3Semantic.SemanticHasVertexWeight:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexWeights);
                    return true;
                case LCC3Semantic.SemanticHasVertexMatrixIndex:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexMatrixIndices);
                    return true;
                case LCC3Semantic.SemanticHasVertexTextureCoordinate:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexTextureCoordinates);
                    return true;
                case LCC3Semantic.SemanticHasVertexPointSize:
                    uniform.SetValue(visitor.CurrentMesh.HasVertexPointSizes);
                    return true;
                case LCC3Semantic.SemanticIsDrawingPoints:
                    uniform.SetValue(false); // XNA doesn't support drawing mode by points
                    return true;

                #endregion Attribute Qualifiers

                #region Environment semantics

                case LCC3Semantic.SemanticEyePosition:
                    uniform.SetValue(visitor.ViewMatrix.Inverse().TranslationOfTransformMatrix());
                    return true;
                case LCC3Semantic.SemanticModelMatrix:
                    uniform.SetValue(visitor.ModelMatrix);
                    return true;
                case LCC3Semantic.SemanticModelViewMatrix:
                    uniform.SetValue(visitor.ModelViewMatrix);
                    return true;
                case LCC3Semantic.SemanticModelViewProjMatrix:
                    uniform.SetValue(visitor.ModelViewProjMatrix);
                    return true;
                case LCC3Semantic.SemanticViewMatrix:
                    uniform.SetValue(visitor.ViewMatrix);
                    return true;
                case LCC3Semantic.SemanticProjMatrix:
                    uniform.SetValue(visitor.ProjMatrix);
                    return true;
                case LCC3Semantic.SemanticModelViewMatrixInvTran:
                    uniform.SetValue(visitor.ModelViewMatrix.InverseAdjointTranspose());
                    return true;
                case LCC3Semantic.SemanticModelMatrixInvTran:
                    uniform.SetValue(visitor.ModelMatrix.Transpose().Inverse());
                    return true;

                #endregion Environment semantics

                #region Setting material semantics

                case LCC3Semantic.SemanticColor:
                    uniform.SetValue(visitor.CurrentColor.ToVector4());
                    return true;
                case LCC3Semantic.SemanticMaterialColorAmbient:
                    uniform.SetValue(visitor.CurrentMaterial.EffectiveAmbientColor.ToVector4());
                    return true;
                case LCC3Semantic.SemanticMaterialColorDiffuse:
                    uniform.SetValue(visitor.CurrentMaterial.EffectiveDiffuseColor.ToVector4());
                    return true;
                case LCC3Semantic.SemanticMaterialColorSpecular:
                    uniform.SetValue(visitor.CurrentMaterial.EffectiveSpecularColor.ToVector4());
                    return true;
                case LCC3Semantic.SemanticMaterialColorEmission:
                    uniform.SetValue(visitor.CurrentMaterial.EffectiveEmissionColor.ToVector4());
                    return true;
                case LCC3Semantic.SemanticMaterialOpacity:
                    uniform.SetValue(visitor.CurrentMaterial.EffectiveDiffuseColor.A);
                    return true;
                case LCC3Semantic.SemanticMaterialShininess:
                    uniform.SetValue(visitor.CurrentMaterial.Shininess);
                    return true;
                case LCC3Semantic.SemanticMaterialReflectivity:
                    uniform.SetValue(visitor.CurrentMaterial.Reflectivity);
                    return true;
                case LCC3Semantic.SemanticMinimumDrawnAlpha:
                    material = visitor.CurrentMaterial;
                    uniform.SetValue(material.ShouldDrawLowAlpha ? 0.0f : material.AlphaTestReference);
                    return true;

                #endregion Setting material semantics

                #region Textures

                case LCC3Semantic.SemanticTextureCount:
                    uniform.SetValue(visitor.CurrentMaterial.TextureCount());
                    return true;
                case LCC3Semantic.SemanticTexUnitMode:
                    if(semanticIndex < numOfTextures)
                    {
                        LCC3TextureUnitMode texUnitMode = visitor.CurrentMaterial.TextureForTextureUnit(semanticIndex).TextureUnitMode;
                        uniform.SetValue((int)texUnitMode);
                    }
                    else
                    {
                        uniform.SetValue(0);
                    }
                    return true;
                case LCC3Semantic.SemanticVertexTexture:
                    if(semanticIndex < numOfTextures)
                    {
                        LCC3Texture texture = visitor.CurrentMaterial.TextureForTextureUnit(semanticIndex);
                        LCC3GraphicsTexture2D tex2D = texture.GraphicsTexture as LCC3GraphicsTexture2D;
                        uniform.SetValue(tex2D);
                    }
                    else
                    {
                        uniform.SetValue(null);
                    }
                    return true;
                case LCC3Semantic.SemanticTexUnitConstantColor:
                    if(semanticIndex < numOfTextures)
                    {
                        LCC3Texture texture = visitor.CurrentMaterial.TextureForTextureUnit(semanticIndex);
                        uniform.SetValue(texture.TextureUnitConstantColor.ToVector4());
                    }
                    else
                    {
                        uniform.SetValue(LCC3Vector4.CC3Vector4One);
                    }
                    return true;

                #endregion Textures

                #region Light semantics

                case LCC3Semantic.SemanticIsUsingLighting:
                    uniform.SetValue(visitor.CurrentNode.ShouldUseLighting);
                    return true;
                case LCC3Semantic.SemanticSceneLightColorAmbient:
                    uniform.SetValue(visitor.Scene.AmbientLight.ToVector4());
                    return true;
                case LCC3Semantic.SemanticLightIsEnabled:
                    for (uint i = 0; i < uniform.Size; i++)
                    {
                        LCC3Light light = visitor.LightAtIndex(uniform.SemanticIndex + i);
                        uniform.SetValueAtIndex(light.Visible, i);
                    }
                    return true;
                case LCC3Semantic.SemanticLightInvertedPositionEyeSpace:
                    isInverted = true;
                    goto case LCC3Semantic.SemanticLightPositionEyeSpace;
                case LCC3Semantic.SemanticLightPositionEyeSpace:
                    for (uint i = 0; i < uniform.Size; i++)
                    {
                        LCC3Light light = visitor.LightAtIndex(uniform.SemanticIndex + i);
                        LCC3Vector4 ltPos = light.GlobalHomogeneousPosition;
                        if (isInverted == true)
                        {
                            ltPos = ltPos.HomogeneousNegate();
                        }

                        // Transform global position/direction to eye space and normalize if direction
                        ltPos = visitor.ViewMatrix.TransformCC3Vector4(ltPos);
                        if (light.IsDirectionalOnly == true)
                        {
                            ltPos = ltPos.NormalizedVector();
                        }

                        uniform.SetValueAtIndex(ltPos, i);
                    }
                    return true;
                case LCC3Semantic.SemanticLightDirection:
                    for (uint i = 0; i < uniform.Size; i++)
                    {
                        LCC3Light light = visitor.LightAtIndex(uniform.SemanticIndex + i);
                        uniform.SetValueAtIndex(light.Location, i);
                    }
                    return true;

                case LCC3Semantic.SemanticLightColorDiffuse:
                    for (uint i = 0; i < uniform.Size; i++)
                    {
                        LCC3Light light = visitor.LightAtIndex(uniform.SemanticIndex + i);
                        CCColor4F ltColor = light.Visible ? light.DiffuseColor : LCC3ColorUtil.CCC4FBlackTransparent;
                        uniform.SetValueAtIndex(ltColor.ToVector4(), i);
                    }
                    return true;
                case LCC3Semantic.SemanticLightColorAmbient:
                    for (uint i = 0; i < uniform.Size; i++)
                    {
                        LCC3Light light = visitor.LightAtIndex(uniform.SemanticIndex + i);
                        CCColor4F ltColor = light.Visible ? light.AmbientColor : LCC3ColorUtil.CCC4FBlackTransparent;
                        uniform.SetValueAtIndex(ltColor.ToVector4(), i);
                    }
                    return true;
                case LCC3Semantic.SemanticLightColorSpecular:
                    for (uint i = 0; i < uniform.Size; i++)
                    {
                        LCC3Light light = visitor.LightAtIndex(uniform.SemanticIndex + i);
                        CCColor4F ltColor = light.Visible ? light.SpecularColor : LCC3ColorUtil.CCC4FBlackTransparent;
                        uniform.SetValueAtIndex(ltColor.ToVector4(), i);
                    }
                    return true;

                #endregion Light semantics

            }

            return false;
        }