惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - 大河马和小魔鱼

[zz]dds [zz]Shader programming tips #1 [zz]如何使用effect [论文摘要]Tips and Tricks for D3DX Effects-Based Renders [zt]矩阵和向量的乘法顺序 [论文简要]Integrating Shaders Into the Vision Rendering Engine Depth Bias Planar Shadow Instancing 渲染简要 球面环境贴图 MaxScript 心得1 - 大河马和小魔鱼 - 博客园 Export利器:IGame MAX Script Export/Import 牛刀小试,Max Script 3DS MAX PlugIn(2) 邂逅Geometry [原创]3DS MAX PlugIn 1 预备役 Novodex2.6.2 布料系统 Novodex,ODE,Tokamak,Bullet,Newton...... 原来我一直在做傻事
3DS MAX PlugIn 材质和纹理
大河马和小魔鱼 · 2007-05-17 · via 博客园 - 大河马和小魔鱼

材质和纹理的信息都位于node 中
材质的信息通过类Mtl获得
纹理的信息位于node中的mesh 中的UVVert

以下是获得材质的代码:

    //////////////////////////////////////////////////////////////////////////
    
//material
    Mtl* nodematerial=node->GetMtl();
    
if(nodematerial)
    {
        fprintf(m_fileStream, 
"%s mtl -- name:<%s>\n", GetIndent(indent),nodematerial->GetName());
    }
    
else
    {
        DWORD vcolor
=node->GetWireColor();
        fprintf(m_fileStream,
"%s color -- rgb:<%d,%d,%d>\n", GetIndent(indent),GetRValue(vcolor), GetGValue(vcolor), GetBValue(vcolor));
    }
    
//////////////////////////////////////////////////////////////////////////

以下是获取UV的代码,需要注意的是,需要对是否有多重贴图处理:

void OnlyGeometry::ExportUVInfo(Mesh* mesh,int indent)
{
    
int numTVerts = mesh->getNumTVerts();
    
if(numTVerts>0)
    
{
        fprintf(m_fileStream, 
"%s texture channel 1 -- numverts:<%d>\n", GetIndent(indent),numTVerts);
        
for (int i = 0; i < numTVerts; i++
        
{
            UVVert tvert 
= mesh->tVerts[i];
            fprintf(m_fileStream, 
"%s UVW tvert %d:<%f,%f,%f>\n", GetIndent(indent),i, tvert.x, tvert.y, tvert.z);
        }

        
// print tvert indices used by tvfaces
        for (int i = 0; i < mesh->getNumFaces(); i++
        
{
            TVFace tface 
= mesh->tvFace[i];
            fprintf(m_fileStream, 
"%s TVFace %d -- tvertind:<%d,%d,%d>\n"
                GetIndent(indent),i, tface.t[
0], tface.t[1], tface.t[2]);
        }
                    
    }

    
//多重贴图 
    for (int chanloop = 2; chanloop < MAX_MESHMAPS - 1; chanloop++)
    
{
        
if (mesh->mapSupport(chanloop)) 
        
{
            numTVerts 
= mesh->getNumMapVerts(chanloop);
            fprintf(m_fileStream, 
"%s texture channel %d -- numverts:<%d>\n", GetIndent(indent),chanloop, numTVerts);
            
for (int i = 0; i < numTVerts; i++
            
{
                UVVert tvert 
= mesh->mapVerts(chanloop)[i];
                fprintf(m_fileStream, 
"%s UVW tvert %d:<%f,%f,%f>\n", GetIndent(indent),i, tvert.x, tvert.y, tvert.z);
            }

            
// now, print tvert indices used by tvfaces
            for (int i = 0; i < mesh->getNumFaces(); i++
            
{
                TVFace tface 
= mesh->mapFaces(chanloop)[i];
                fprintf(m_fileStream, 
"%s TVFace %d -- tvertind:<%d,%d,%d>\n", GetIndent(indent),
                    i, tface.t[
0], tface.t[1], tface.t[2]);
            }
                      
        }

    }

}