当前位置: 首页>>代码示例>>C#>>正文


C# float3.FromVector3方法代码示例

本文整理汇总了C#中float3.FromVector3方法的典型用法代码示例。如果您正苦于以下问题:C# float3.FromVector3方法的具体用法?C# float3.FromVector3怎么用?C# float3.FromVector3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在float3的用法示例。


在下文中一共展示了float3.FromVector3方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Primitive

                public Primitive( Mesh _Owner, FBX.Scene.Nodes.Mesh.Primitive _Primitive )
                {
                    m_Owner = _Owner;

                    m_MaterialID = (ushort) _Primitive.MaterialParms.ID;

                    m_Faces = new Face[_Primitive.FacesCount];
                    m_Vertices = new Vertex[_Primitive.VerticesCount];

                    // Retrieve streams
                    FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE[]	Usages = {
                        FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.POSITION,
                        FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.NORMAL,
                        FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.TANGENT,
                        FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.BITANGENT,
                        FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.TEXCOORDS,
                    };
                    FBX.Scene.Nodes.Mesh.Primitive.VertexStream[][]		Streams = new FBX.Scene.Nodes.Mesh.Primitive.VertexStream[Usages.Length][];
                    for ( int UsageIndex=0; UsageIndex < Usages.Length; UsageIndex++ )
                    {
                        Streams[UsageIndex] = _Primitive.FindStreamsByUsage( Usages[UsageIndex] );
                        if ( Streams[UsageIndex].Length == 0 )
                            throw new Exception( "No stream for usage " + Usages[UsageIndex] + "! Can't complete target vertex format!" );
                    }

                    // Build local space bounding box
                    float3	Temp = new float3();
                    WMath.Vector[]	VertexPositions = Streams[0][0].Content as WMath.Vector[];
                    foreach ( WMath.Vector VertexPosition in VertexPositions ) {
                        Temp.FromVector3( VertexPosition );
                        m_BBoxMin.Min( Temp );
                        m_BBoxMax.Max( Temp );
                    }

                    // Build faces
                    int	FaceIndex = 0;
                    foreach ( FBX.Scene.Nodes.Mesh.Primitive.Face F in _Primitive.Faces )
                    {
                        m_Faces[FaceIndex].V0 = F.V0;
                        m_Faces[FaceIndex].V1 = F.V1;
                        m_Faces[FaceIndex].V2 = F.V2;
                        FaceIndex++;
                    }

                    // Build vertices
                    for ( int VertexIndex=0; VertexIndex < m_Vertices.Length; VertexIndex++ )
                    {
                        for ( int UsageIndex=0; UsageIndex < Usages.Length; UsageIndex++ )
                        {
                            FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE	Usage = Usages[UsageIndex];
                            switch ( Usage )
                            {
                                case FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.POSITION:
                                {
                                    float3[]	Stream = Streams[UsageIndex][0].Content as float3[];
                                    m_Vertices[VertexIndex].P = Stream[VertexIndex];
                                    break;
                                }
                                case FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.NORMAL:
                                {
                                    float3[]	Stream = Streams[UsageIndex][0].Content as float3[];
                                    m_Vertices[VertexIndex].N = Stream[VertexIndex];
                                    break;
                                }
                                case FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.TANGENT:
                                {
                                    float3[]	Stream = Streams[UsageIndex][0].Content as float3[];
                                    m_Vertices[VertexIndex].G = Stream[VertexIndex];
                                    break;
                                }
                                case FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.BITANGENT:
                                {
                                    float3[]	Stream = Streams[UsageIndex][0].Content as float3[];
                                    m_Vertices[VertexIndex].B = Stream[VertexIndex];
                                    break;
                                }
                                case FBX.Scene.Nodes.Mesh.Primitive.VertexStream.USAGE.TEXCOORDS:
                                {
                                    float2[]	Stream = Streams[UsageIndex][0].Content as float2[];
                                    m_Vertices[VertexIndex].T = Stream[VertexIndex];
                                    break;
                                }
                            }
                        }
                    }
                }
开发者ID:Patapom,项目名称:GodComplex,代码行数:86,代码来源:GCX.cs

示例2: Material

            public Material( FBX.Scene.Materials.MaterialParameters _SourceMaterial, MaterialMapperDelegate _Mapper )
            {
                float3	Temp = new float3();

                FBX.Scene.Materials.MaterialParameters.Parameter	P = null;

                m_ID = (ushort) _SourceMaterial.ID;

                // Get diffuse color + texture ID
                P = _SourceMaterial.Find( "DiffuseColor" );
                if ( P != null ) {
                    Temp.FromVector3( P.AsFloat3.Value );
                    m_DiffuseColor = Temp;
                }

                P = _SourceMaterial.Find( "DiffuseTexture" );
                m_DiffuseTextureID = _Mapper( P != null ? P.AsTexture2D : null );

                // Get specular color + texture ID + exponent
                P = _SourceMaterial.Find( "SpecularColor" );
                if ( P != null ) {
                    Temp.FromVector3( P.AsFloat3.Value );
                    m_SpecularColor = Temp;
                }

                P = _SourceMaterial.Find( "SpecularTexture" );
                m_SpecularTextureID = _Mapper( P != null ? P.AsTexture2D : null );

                P = _SourceMaterial.Find( "SpecularExponent" );
                if ( P != null ) {
                    Temp.FromVector3( P.AsFloat3.Value );
                    m_SpecularExponent = Temp;
                }

                // Get noral map ID
                P = _SourceMaterial.Find( "NormalTexture" );
                m_NormalTextureID = _Mapper( P != null ? P.AsTexture2D : null );

                // Get emissive
                P = _SourceMaterial.Find( "EmissiveColor" );
                if ( P != null ) {
                    Temp.FromVector3( P.AsFloat3.Value );
                    m_EmissiveColor = Temp;
                }
            }
开发者ID:Patapom,项目名称:GodComplex,代码行数:45,代码来源:GCX.cs


注:本文中的float3.FromVector3方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。