public bool SetVertices(MLOD mlod, MLOD.Mesh mesh, VRTF vrtf, Vertex[] vertices, float[] uvscales) { bool okay = SetVertices(mlod, mesh.VertexBufferIndex, mesh.StreamOffset, mesh.VertexCount, vrtf, vertices, uvscales); mesh.VertexCount = vertices.Length; return(okay); }
public bool SetVertices(MLOD mlod, MLOD.Mesh mesh, MLOD.GeometryState geo, VRTF vrtf, Vertex[] vertices, float[] uvscales) { long beforeLength = mesh.StreamOffset + (geo.MinVertexIndex * vrtf.Stride); bool okay = SetVertices(mlod, mesh.VertexBufferIndex, beforeLength, geo.VertexCount, vrtf, vertices, uvscales); geo.VertexCount = vertices.Length; return(okay); }
public static SegmentInfo FromMesh(MLOD.Mesh mesh, VRTF vrtf) { SegmentInfo segment = new SegmentInfo(null); segment.VertexSize = vrtf.Stride; segment.VertexCount = mesh.VertexCount; segment.ByteOffset = mesh.StreamOffset; foreach (VRTF.ElementLayout layout in vrtf.Layouts) { switch (layout.Format) { case VRTF.ElementFormat.Float1: case VRTF.ElementFormat.UByte4: case VRTF.ElementFormat.UByte4N: case VRTF.ElementFormat.ColorUByte4: case VRTF.ElementFormat.Dec3N: case VRTF.ElementFormat.UDec3N: segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); break; case VRTF.ElementFormat.Float2: segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); break; case VRTF.ElementFormat.Float3: segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); break; case VRTF.ElementFormat.Float4: segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle32)); break; case VRTF.ElementFormat.Short2: case VRTF.ElementFormat.Short2N: case VRTF.ElementFormat.UShort2N: case VRTF.ElementFormat.Float16_2: segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle16x2)); break; case VRTF.ElementFormat.Short4: case VRTF.ElementFormat.Short4N: case VRTF.ElementFormat.UShort4N: case VRTF.ElementFormat.Float16_4: segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle16x2)); segment.Swizzles.Add(new SwizzleEntry(null, SwizzleCmd.Swizzle16x2)); break; } } return(segment); }
public BoundingBox GetBoundingBox(MLOD.Mesh mesh, VRTF vrtf) { BoundingBox bbox = null; GetBoundingBox(GetVertices(mesh, vrtf, null), ref bbox); foreach (MLOD.GeometryState geos in mesh.GeometryStates) { GetBoundingBox(GetVertices(mesh, vrtf, geos, null), ref bbox); } return(bbox ?? new BoundingBox(null)); }
public static VRTF CreateDefaultForMesh(MLOD.Mesh mesh) { return(mesh.IsShadowCaster ? CreateDefaultForSunShadow() : CreateDefaultForDropShadow()); }
public void SetIndices(MLOD mlod, MLOD.Mesh mesh, int geoStateIndex, Int32[] indices) { MLOD.GeometryState geometryState = mesh.GeometryStates[geoStateIndex]; SetIndices(mlod, mesh, geometryState, indices); }
public void SetIndices(MLOD mlod, MLOD.Mesh mesh, Int32[] indices) { SetIndices(mlod, mesh.IndexBufferIndex, mesh.PrimitiveType, mesh.StartIndex, mesh.PrimitiveCount, indices); mesh.PrimitiveCount = indices.Length / IndexCountFromPrimitiveType(mesh.PrimitiveType); }
public Int32[] GetIndices(MLOD.Mesh mesh, MLOD.GeometryState geometryState) { return(GetIndices(mesh.PrimitiveType, geometryState.StartIndex, geometryState.PrimitiveCount) .Select(x => x - geometryState.MinVertexIndex).ToArray()); }
public Int32[] GetIndices(MLOD.Mesh mesh, int geoStateIndex) { return(GetIndices(mesh, mesh.GeometryStates[geoStateIndex])); }
public Int32[] GetIndices(MLOD.Mesh mesh) { return(GetIndices(mesh.PrimitiveType, mesh.StartIndex, mesh.PrimitiveCount)); }
public void SetIndices(MLOD mlod, MLOD.Mesh mesh, MLOD.GeometryState geometryState, Int32[] indices) { SetIndices(mlod, mesh.IndexBufferIndex, mesh.PrimitiveType, geometryState.StartIndex, geometryState.PrimitiveCount, indices.Select(x => x + geometryState.MinVertexIndex).ToArray()); geometryState.PrimitiveCount = indices.Length / IndexCountFromPrimitiveType(mesh.PrimitiveType); }
public bool SetVertices(MLOD mlod, MLOD.Mesh mesh, int geoIndex, VRTF vrtf, Vertex[] vertices, float[] uvscales) { return(SetVertices(mlod, mesh, mesh.GeometryStates[geoIndex], vrtf, vertices, uvscales)); }
public Vertex[] GetVertices(MLOD.Mesh mesh, VRTF vrtf, MLOD.GeometryState geo, float[] uvscales) { return(GetVertices(vrtf, mesh.StreamOffset + (geo.MinVertexIndex * vrtf.Stride), geo.VertexCount, uvscales)); }
public Vertex[] GetVertices(MLOD.Mesh mesh, VRTF vrtf, float[] uvscales) { return(GetVertices(vrtf, mesh.StreamOffset, mesh.VertexCount, uvscales)); }