/// <summary> /// Gets if structure contains data for the specified channel /// </summary> /// <param name="channel">Data channel</param> /// <returns>Returns true if structure contains data for the specified channel</returns> public bool HasChannel(VertexDataChannels channel) { if (channel == VertexDataChannels.Position) { return(true); } else if (channel == VertexDataChannels.Normal) { return(true); } else if (channel == VertexDataChannels.Texture) { return(true); } else if (channel == VertexDataChannels.Tangent) { return(true); } else if (channel == VertexDataChannels.Color) { return(true); } else { return(false); } }
/// <summary> /// Sets the channer value /// </summary> /// <typeparam name="T">Data type</typeparam> /// <param name="channel">Channel</param> /// <param name="value">Value</param> public void SetChannelValue <T>(VertexDataChannels channel, T value) { if (channel == VertexDataChannels.Position) { this.Position = (Vector3)(object)value; } else if (channel == VertexDataChannels.Normal) { this.Normal = (Vector3)(object)value; } else if (channel == VertexDataChannels.Texture) { this.Texture = (Vector2)(object)value; } else if (channel == VertexDataChannels.Tangent) { this.Tangent = (Vector3)(object)value; } else if (channel == VertexDataChannels.Color) { this.Color = (Color4)(object)value; } else { throw new EngineException(string.Format("Channel data not found: {0}", channel)); } }
/// <summary> /// Gets data channel value /// </summary> /// <typeparam name="T">Data type</typeparam> /// <param name="channel">Data channel</param> /// <returns>Returns data for the specified channel</returns> public T GetChannelValue <T>(VertexDataChannels channel) { if (channel == VertexDataChannels.Position) { return((T)(object)this.Position); } else if (channel == VertexDataChannels.Normal) { return((T)(object)this.Normal); } else if (channel == VertexDataChannels.Texture) { return((T)(object)this.Texture); } else if (channel == VertexDataChannels.Tangent) { return((T)(object)this.Tangent); } else if (channel == VertexDataChannels.Color) { return((T)(object)this.Color); } else { throw new EngineException(string.Format("Channel data not found: {0}", channel)); } }
/// <summary> /// Sets the channer value /// </summary> /// <typeparam name="T">Data type</typeparam> /// <param name="channel">Channel</param> /// <param name="value">Value</param> public void SetChannelValue <T>(VertexDataChannels channel, T value) { if (channel == VertexDataChannels.Position) { this.Position = (Vector3)(object)value; } else if (channel == VertexDataChannels.Weights) { float[] weights = (float[])(object)value; this.Weight1 = weights[0]; this.Weight2 = weights[1]; this.Weight3 = weights[2]; } else if (channel == VertexDataChannels.BoneIndices) { byte[] boneIndices = (byte[])(object)value; this.BoneIndex1 = boneIndices[0]; this.BoneIndex2 = boneIndices[1]; this.BoneIndex3 = boneIndices[2]; this.BoneIndex4 = boneIndices[3]; } else { throw new EngineException(string.Format("Channel data not found: {0}", channel)); } }
/// <summary> /// Gets if structure contains data for the specified channel /// </summary> /// <param name="channel">Data channel</param> /// <returns>Returns true if structure contains data for the specified channel</returns> public bool HasChannel(VertexDataChannels channel) { if (channel == VertexDataChannels.Position) { return(true); } else if (channel == VertexDataChannels.Normal) { return(true); } else if (channel == VertexDataChannels.Color) { return(true); } else if (channel == VertexDataChannels.Weights) { return(true); } else if (channel == VertexDataChannels.BoneIndices) { return(true); } else { return(false); } }
/// <summary> /// Gets data channel value /// </summary> /// <typeparam name="T">Data type</typeparam> /// <param name="channel">Data channel</param> /// <returns>Returns data for the specified channel</returns> public T GetChannelValue <T>(VertexDataChannels channel) { if (channel == VertexDataChannels.Position) { return((T)(object)this.Position); } else if (channel == VertexDataChannels.Normal) { return((T)(object)this.Normal); } else if (channel == VertexDataChannels.Color) { return((T)(object)this.Color); } else if (channel == VertexDataChannels.Weights) { return((T)(object)(new[] { this.Weight1, this.Weight2, this.Weight3, (1.0f - this.Weight1 - this.Weight2 - this.Weight3) })); } else if (channel == VertexDataChannels.BoneIndices) { return((T)(object)(new[] { this.BoneIndex1, this.BoneIndex2, this.BoneIndex3, this.BoneIndex4 })); } else { throw new EngineException(string.Format("Channel data not found: {0}", channel)); } }
/// <summary> /// Sets the channer value /// </summary> /// <typeparam name="T">Data type</typeparam> /// <param name="channel">Channel</param> /// <param name="value">Value</param> public void SetChannelValue <T>(VertexDataChannels channel, T value) { if (channel == VertexDataChannels.Position) { this.Position = (Vector3)(object)value; } else { throw new EngineException(string.Format("Channel data not found: {0}", channel)); } }
/// <summary> /// Gets if structure contains data for the specified channel /// </summary> /// <param name="channel">Data channel</param> /// <returns>Returns true if structure contains data for the specified channel</returns> public bool HasChannel(VertexDataChannels channel) { if (channel == VertexDataChannels.Position) { return(true); } else { return(false); } }