static ShaderVariables GetShader(IVertexType vertextype, ShaderFeatures caps) { if (vertextype is Utf.Dfm.DfmVertex) { return(Basic_Skinned.Get(caps)); } if (vertextype is VertexPositionNormalTexture || vertextype is VertexPositionNormal) { return(Basic_PositionNormalTexture.Get(caps)); } if (vertextype is VertexPositionNormalTextureTwo) { return(Basic_PositionNormalTextureTwo.Get(caps)); } if (vertextype is VertexPositionNormalDiffuseTexture) { return(Basic_PositionNormalColorTexture.Get(caps)); } if (vertextype is VertexPositionTexture) { return(Basic_PositionTexture.Get(caps)); } if (vertextype is VertexPosition) { return(Basic_PositionTexture.Get(caps)); } if (vertextype is VertexPositionColor) { return(Basic_PositionColor.Get(caps)); } throw new NotImplementedException(vertextype.GetType().Name); }
/// <summary> /// Generate an output for an type with the attributes of the types and all parent types /// </summary> /// <param name="myDBContext">The db context</param> /// <param name="myType">The db type</param> /// <param name="myDepth">If depth == 0 only the type basic attributes will be returned</param> private IVertexView GenerateOutput(IVertexType myType, Int32 myDepth = 0) { var retVal = new Dictionary <String, object>(); List <IVertexView> result = new List <IVertexView>(); var edges = new Dictionary <String, IEdgeView>(); //base output retVal.Add("VertexID", myType.ID); retVal.Add("Type", myType.GetType().Name); retVal.Add("Name", myType.Name); retVal.Add("IsUserDefined", myType.IsUserDefined); //additional output if (myDepth > 0) { retVal.Add("IsAbstract", myType.IsAbstract); edges.Add("Properties", new HyperEdgeView(null, GeneratePropertiesOutput(myType, myType.GetPropertyDefinitions(true), myDepth))); edges.Add("Edges", new HyperEdgeView(null, GenerateEdgesOutput(myType, myType.GetOutgoingEdgeDefinitions(true)))); edges.Add("Incomingedges", new HyperEdgeView(null, GenerateEdgesOutput(myType, myType.GetIncomingEdgeDefinitions(true)))); edges.Add("UniqueAttributes", new HyperEdgeView(null, GenerateUniquePropertiesOutput(myType, myType.GetUniqueDefinitions(true)))); edges.Add("Indices", new HyperEdgeView(null, GenerateIndicesOutput(myType))); if (myType.HasParentType) { edges.Add("Extends", new SingleEdgeView(null, GenerateOutput(myType.ParentVertexType))); } if (myType.HasChildTypes) { List <ISingleEdgeView> list = new List <ISingleEdgeView>(); foreach (var child in myType.ChildrenVertexTypes) { list.Add(new SingleEdgeView(null, GenerateOutput(child))); } edges.Add("ChildrenVertexTypes", new HyperEdgeView(null, list)); } if (!string.IsNullOrWhiteSpace(myType.Comment)) { retVal.Add("Comment", myType.Comment); } } return(new VertexView(retVal, edges)); }
ShaderVariables GetShader(IVertexType vtype) { if (vtype is VertexPositionNormalDiffuseTexture || vtype is VertexPositionNormalDiffuseTextureTwo) { return(Shaders.NebulaMaterial.Get(ShaderFeatures.VERTEX_DIFFUSE)); } if (vtype is VertexPositionNormalTexture || vtype is VertexPositionNormalTextureTwo) { return(Shaders.NebulaMaterial.Get()); } throw new NotImplementedException(vtype.GetType().ToString()); }
ShaderVariables GetShader(IVertexType vtype) { switch (vtype.GetType().Name) { case "VertexPositionNormalColorTexture": return(ShaderCache.Get( "PositionColorTexture.vs", "Nebula_PositionColorTexture.frag" )); case "VertexPositionNormalTexture": return(ShaderCache.Get( "PositionTextureFlip.vs", "Nebula_PositionColorTexture.frag" )); default: throw new NotImplementedException(); } }
static ShaderVariables GetShader(IVertexType vertexType) { if (vertexType is VertexPositionNormalTextureTwo) { if (sh_two == null) { sh_two = ShaderCache.Get("Basic_PositionNormalTextureTwo.vs", "NomadMaterial.frag"); } return(sh_two); } else if (vertexType is VertexPositionNormalTexture) { if (sh_one == null) { sh_one = ShaderCache.Get("Nomad_PositionNormalTexture.vs", "NomadMaterial.frag"); } return(sh_one); } throw new NotImplementedException(vertexType.GetType().Name); }
static ShaderVariables GetShader(IVertexType vertextype, ShaderCaps caps) { var i = caps.GetIndex(); if (vertextype is Utf.Dfm.DfmVertex) { if (sh_dfm[i] == null) { sh_dfm[i] = ShaderCache.Get( "Basic_Skinned.vs", "Basic_Fragment.frag", caps); sh_dfm[i].SetSkinningEnabled(false); } return(sh_dfm[i]); } if (vertextype is VertexPositionNormalTexture || vertextype is VertexPositionNormal) { if (sh_posNormalTexture[i] == null) { sh_posNormalTexture[i] = ShaderCache.Get( "Basic_PositionNormalTexture.vs", "Basic_Fragment.frag", caps ); } return(sh_posNormalTexture[i]); } if (vertextype is VertexPositionNormalTextureTwo) { if (sh_posNormalTextureTwo[i] == null) { sh_posNormalTextureTwo[i] = ShaderCache.Get( "Basic_PositionNormalTextureTwo.vs", "Basic_Fragment.frag", caps ); } return(sh_posNormalTextureTwo[i]); } if (vertextype is VertexPositionNormalDiffuseTexture) { if (sh_posNormalColorTexture[i] == null) { sh_posNormalColorTexture[i] = ShaderCache.Get( "Basic_PositionNormalColorTexture.vs", "Basic_Fragment.frag", caps ); } return(sh_posNormalColorTexture[i]); } if (vertextype is VertexPositionTexture) { if (sh_posTexture[i] == null) { sh_posTexture[i] = ShaderCache.Get( "Basic_PositionTexture.vs", "Basic_Fragment.frag", caps ); } return(sh_posTexture[i]); } if (vertextype is VertexPosition) { if (sh_pos[i] == null) { sh_pos[i] = ShaderCache.Get( "Basic_PositionTexture.vs", "Basic_Fragment.frag", caps ); } return(sh_pos[i]); } if (vertextype is VertexPositionColor) { if (sh_posColor[i] == null) { sh_posColor[i] = ShaderCache.Get( "Basic_PositionColor.vs", "Basic_Fragment.frag", caps ); } return(sh_posColor[i]); } throw new NotImplementedException(vertextype.GetType().Name); }
/// <summary> /// Generate an output for an type with the attributes of the types and all parent types /// </summary> /// <param name="myDBContext">The db context</param> /// <param name="myType">The db type</param> /// <param name="myDepth">If depth == 0 only the type basic attributes will be returned</param> private IVertexView GenerateOutput(IVertexType myType, Int32 myDepth = 0) { var retVal = new Dictionary<String, object>(); List<IVertexView> result = new List<IVertexView>(); var edges = new Dictionary<String, IEdgeView>(); //base output retVal.Add("VertexID", myType.ID); retVal.Add("Type", myType.GetType().Name); retVal.Add("Name", myType.Name); retVal.Add("IsUserDefined", myType.IsUserDefined); //additional output if (myDepth > 0) { retVal.Add("IsAbstract", myType.IsAbstract); edges.Add("Properties", new HyperEdgeView(null, GeneratePropertiesOutput(myType, myType.GetPropertyDefinitions(true), myDepth))); edges.Add("Edges", new HyperEdgeView(null, GenerateEdgesOutput(myType, myType.GetOutgoingEdgeDefinitions(true)))); edges.Add("Incomingedges", new HyperEdgeView(null, GenerateEdgesOutput(myType, myType.GetIncomingEdgeDefinitions(true)))); edges.Add("UniqueAttributes", new HyperEdgeView(null, GenerateUniquePropertiesOutput(myType, myType.GetUniqueDefinitions(true)))); edges.Add("Indices", new HyperEdgeView(null, GenerateIndicesOutput(myType))); if (myType.HasParentType) edges.Add("Extends", new SingleEdgeView(null, GenerateOutput(myType.ParentVertexType))); if (myType.HasChildTypes) { List<ISingleEdgeView> list = new List<ISingleEdgeView>(); foreach (var child in myType.ChildrenVertexTypes) list.Add(new SingleEdgeView(null, GenerateOutput(child))); edges.Add("ChildrenVertexTypes", new HyperEdgeView(null, list)); } if (!string.IsNullOrWhiteSpace(myType.Comment)) retVal.Add("Comment", myType.Comment); } return new VertexView(retVal, edges); }