Beispiel #1
0
        public void Decode_1()
        {
            PerVertexDefinition expected = new PerVertexDefinition
            {
            };

            var result = PerVertexDefinitionEncoder.Encode(expected);
            var actual = PerVertexDefinitionEncoder.Decode(result);

            TestResults(expected, actual);
        }
Beispiel #2
0
        public void Decode_Position_3()
        {
            var expected = new PerVertexDefinition
            {
                Position = PerVertexPositionType.Float2,
            };

            var result = PerVertexDefinitionEncoder.Encode(expected);
            var actual = PerVertexDefinitionEncoder.Decode(result);

            TestResults(expected, actual);
        }
Beispiel #3
0
        public void Decode_Color1_6()
        {
            var expected = new PerVertexDefinition
            {
                Color1 = PerVertexColorType.FloatRGBA,
            };

            var result = PerVertexDefinitionEncoder.Encode(expected);
            var actual = PerVertexDefinitionEncoder.Decode(result);

            TestResults(expected, actual);
        }
Beispiel #4
0
        public void Decode_Color0_4()
        {
            var expected = new PerVertexDefinition
            {
                Color0 = PerVertexColorType.UshortUnormRGBA,
            };

            var result = PerVertexDefinitionEncoder.Encode(expected);
            var actual = PerVertexDefinitionEncoder.Decode(result);

            TestResults(expected, actual);
        }
Beispiel #5
0
        public void Decode_Tangents_2()
        {
            var expected = new PerVertexDefinition
            {
                Tangent = PerVertexTangentType.Float4,
            };

            var result = PerVertexDefinitionEncoder.Encode(expected);
            var actual = PerVertexDefinitionEncoder.Decode(result);

            TestResults(expected, actual);
        }
Beispiel #6
0
        public void Decode_Normal_2()
        {
            var expected = new PerVertexDefinition
            {
                Normal = PerVertexNormalType.Float3,
            };

            var result = PerVertexDefinitionEncoder.Encode(expected);
            var actual = PerVertexDefinitionEncoder.Decode(result);

            TestResults(expected, actual);
        }
Beispiel #7
0
        private void CmdDrawIndexed(IMgCommandBuffer cmdBuf, MeshPrimitive meshPrimitive, RenderInstanceChunk drawCall, int sliceIndex)
        {
            var allocation = mStaticStorage.Map.Allocations[meshPrimitive.Indices[sliceIndex]];
            var indexBlock = mStaticStorage.Storage.Blocks[allocation.BlockIndex];

            var vertexDef = PerVertexDefinitionEncoder.Decode(meshPrimitive.PerVertexDefinition);

            var indexType = vertexDef.IndexType == PerVertexIndexType.Uint16
                ? MgIndexType.UINT16
                : MgIndexType.UINT32;

            cmdBuf.CmdBindIndexBuffer(indexBlock.Buffer, allocation.Offset, indexType);
            cmdBuf.CmdDrawIndexed(meshPrimitive.IndexCount,
                                  drawCall.InstanceCount,
                                  drawCall.FirstIndex,
                                  drawCall.VertexOffset,
                                  drawCall.FirstInstance);
        }
Beispiel #8
0
        public void Decode_0()
        {
            PerVertexDefinition expected = new PerVertexDefinition
            {
                Position  = PerVertexPositionType.Float3,
                Normal    = PerVertexNormalType.Float3,
                Color0    = PerVertexColorType.ByteUnormRGBA,
                Color1    = PerVertexColorType.ByteUnormRGB,
                Tangent   = PerVertexTangentType.Float4,
                Weights0  = PerVertexWeightsType.UshortUnorm4,
                Weights1  = PerVertexWeightsType.Float4,
                Joints0   = PerVertexJointType.Ushort4,
                Joints1   = PerVertexJointType.Byte4,
                IndexType = PerVertexIndexType.Uint32,
            };

            var result = PerVertexDefinitionEncoder.Encode(expected);
            var actual = PerVertexDefinitionEncoder.Decode(result);

            TestResults(expected, actual);
        }