游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1572|回复: 0

怎么手动创建硬代码材质

[复制链接]

6

主题

86

帖子

512

积分

高级会员

Rank: 4

积分
512
发表于 2008-6-25 16:17:00 | 显示全部楼层 |阅读模式
看了网上的文章:

Ogre中的材质一般都是读取*.material尾缀的文件。

1.首先使用Ogre::MaterialManager中的create方法创建一个材质,例如:
        Ogre::MaterialPtr red
            = Ogre::MaterialManager::getSingleton().create("DebugLines/Disabled","DebugLines");第一个参数为 材质名;
第二个参数为 资源组,用来卸载的时候用。

2.设置材质的数据,比如:
red->setReceiveShadows(false);
red->getTechnique(0)->setLightingEnabled(true);
red->getTechnique(0)->getPass(0)->setSelfIllumination(1, 0, 0);
这样一个材质可以说就创建好了。



跟着做了
可是没起作用,
请问要怎么做

我是这么做的


m_pMaterial = Ogre::MaterialManager::getSingleton().create(m_sMatName,m_sMatName+"_group");
Technique* pTechnique = m_pMaterial->createTechnique();
Pass* mPass = pTechnique->createPass();
TextureUnitState* mUnit = mPass->createTextureUnitState();
mUnit->setTextureName(m_sTextureName);
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-22 04:49

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表