コード例 #1
0
ファイル: MyMesh.cs プロジェクト: warex0/SpaceEngineers
        /// <summary>
        /// c-tor - generic way for collecting resources
        /// </summary>
        /// <param name="meshInfo"></param>
        /// assetName - just for debug output
        public MyMesh(MyMeshPartInfo meshInfo, string assetName)
        {
            MyMaterialDescriptor matDesc = meshInfo.m_MaterialDesc;

            if (matDesc != null)
            {
                string texName;
                matDesc.Textures.TryGetValue("DiffuseTexture", out texName);

                var material = new MyMeshMaterial();
                material.Name              = meshInfo.m_MaterialDesc.MaterialName;
                material.DiffuseTexture    = texName;
                material.Textures          = matDesc.Textures;
                material.SpecularIntensity = meshInfo.m_MaterialDesc.SpecularIntensity;
                material.SpecularPower     = meshInfo.m_MaterialDesc.SpecularPower;
                material.DrawTechnique     = meshInfo.Technique;
                material.GlassCW           = meshInfo.m_MaterialDesc.GlassCW;
                material.GlassCCW          = meshInfo.m_MaterialDesc.GlassCCW;
                material.GlassSmooth       = meshInfo.m_MaterialDesc.GlassSmoothNormals;

                Material = material;
            }
            else
            {
                //It is OK because ie. collision meshes dont have materials
                Material = new MyMeshMaterial();
            }

            AssetName = assetName;
        }
コード例 #2
0
ファイル: MyMesh.cs プロジェクト: fluxit/SpaceEngineers
        /// <summary>
        /// c-tor - generic way for collecting resources
        /// </summary>
        /// <param name="meshInfo"></param>
        /// assetName - just for debug output
        public MyMesh(MyMeshPartInfo meshInfo, string assetName)
        {
            MyMaterialDescriptor matDesc = meshInfo.m_MaterialDesc;
            if (matDesc != null)
            {
                string texName;
                matDesc.Textures.TryGetValue("DiffuseTexture", out texName);

                var material = new MyMeshMaterial();
                material.Name = meshInfo.m_MaterialDesc.MaterialName;
                material.DiffuseTexture = texName;
                material.Textures = matDesc.Textures;
                material.SpecularIntensity = meshInfo.m_MaterialDesc.SpecularIntensity;
                material.SpecularPower = meshInfo.m_MaterialDesc.SpecularPower;
                material.DrawTechnique = meshInfo.Technique;
                material.GlassCW = meshInfo.m_MaterialDesc.GlassCW;
                material.GlassCCW = meshInfo.m_MaterialDesc.GlassCCW;
                material.GlassSmooth = meshInfo.m_MaterialDesc.GlassSmoothNormals;

                Material = material;
            }
            else
            {
                //It is OK because ie. collision meshes dont have materials
                Material = new MyMeshMaterial();
            }

            AssetName = assetName;
        }