public GXVertexLayout(GXAttributes attribute, GXComponentType comptype, GXAttributeType attType, uint offset) { Attribute = attribute; CompType = comptype; AttType = attType; DataOffset = offset; }
private static int GetComponentShift(GXAttributes attribute, GXComponentType type, int compShift) { if (attribute == GXAttributes.Normal || attribute == GXAttributes.NormalBinormalTangent) { if (type == GXComponentType.U8 || type == GXComponentType.S8) { return(6); } else if (type == GXComponentType.U16 || type == GXComponentType.S16) { return(14); } } return(GetComponentShiftRaw(type, compShift)); }
private static int GetComponentShiftRaw(GXComponentType type, int compShift) { switch (type) { case GXComponentType.F32: return(0); case GXComponentType.U8: case GXComponentType.U16: case GXComponentType.S8: case GXComponentType.S16: return(compShift); default: return(0); } }
private static int GetDataStride(GXComponentType compType) { switch (compType) { case GXComponentType.S8: case GXComponentType.U8: return(1); case GXComponentType.U16: case GXComponentType.S16: return(2); case GXComponentType.F32: return(4); } return(0); }
private static int GetColorDataStride(GXComponentType compType) { switch (compType) { case GXComponentType.RGBA4: case GXComponentType.RGB565: return(2); case GXComponentType.RGBA6: return(6); case GXComponentType.RGB8: return(3); case GXComponentType.RGBX8: case GXComponentType.RGBA8: return(4); } return(0); }