コード例 #1
0
ファイル: VBUF.cs プロジェクト: Onebeld/Regul
        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);
        }
コード例 #2
0
ファイル: VBUF.cs プロジェクト: Onebeld/Regul
        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);
        }
コード例 #3
0
ファイル: VBSI.cs プロジェクト: Onebeld/Regul
            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);
            }
コード例 #4
0
ファイル: VBUF.cs プロジェクト: Onebeld/Regul
        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));
        }
コード例 #5
0
ファイル: VRTF.cs プロジェクト: Onebeld/Regul
 public static VRTF CreateDefaultForMesh(MLOD.Mesh mesh)
 {
     return(mesh.IsShadowCaster ? CreateDefaultForSunShadow() : CreateDefaultForDropShadow());
 }
コード例 #6
0
 public void SetIndices(MLOD mlod, MLOD.Mesh mesh, int geoStateIndex, Int32[] indices)
 {
     MLOD.GeometryState geometryState = mesh.GeometryStates[geoStateIndex];
     SetIndices(mlod, mesh, geometryState, indices);
 }
コード例 #7
0
 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);
 }
コード例 #8
0
 public Int32[] GetIndices(MLOD.Mesh mesh, MLOD.GeometryState geometryState)
 {
     return(GetIndices(mesh.PrimitiveType, geometryState.StartIndex, geometryState.PrimitiveCount)
            .Select(x => x - geometryState.MinVertexIndex).ToArray());
 }
コード例 #9
0
 public Int32[] GetIndices(MLOD.Mesh mesh, int geoStateIndex)
 {
     return(GetIndices(mesh, mesh.GeometryStates[geoStateIndex]));
 }
コード例 #10
0
 public Int32[] GetIndices(MLOD.Mesh mesh)
 {
     return(GetIndices(mesh.PrimitiveType, mesh.StartIndex, mesh.PrimitiveCount));
 }
コード例 #11
0
 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);
 }
コード例 #12
0
ファイル: VBUF.cs プロジェクト: Onebeld/Regul
 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));
 }
コード例 #13
0
ファイル: VBUF.cs プロジェクト: Onebeld/Regul
 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));
 }
コード例 #14
0
ファイル: VBUF.cs プロジェクト: Onebeld/Regul
 public Vertex[] GetVertices(MLOD.Mesh mesh, VRTF vrtf, float[] uvscales)
 {
     return(GetVertices(vrtf, mesh.StreamOffset, mesh.VertexCount, uvscales));
 }