天天看點

Ogre的三種内置的材質

在Ogre裡面有三個material,是被Ogre内置建立的。

他們分别為:DefaultSettings,BaseWhite,BaseWhiteNoLighting。

他們在MaterialManager::initialise()中被建立。

Ogre的三種内置的材質

    void MaterialManager::initialise(void)

Ogre的三種内置的材質

    {

Ogre的三種内置的材質

        // Set up default material - don't use name contructor as we want to avoid applying defaults

Ogre的三種内置的材質

        mDefaultSettings = create("DefaultSettings", ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);

Ogre的三種内置的材質

        // Add a single technique and pass, non-programmable

Ogre的三種内置的材質

        mDefaultSettings->createTechnique()->createPass();

Ogre的三種内置的材質
Ogre的三種内置的材質

        // Set up a lit base white material

Ogre的三種内置的材質

        create("BaseWhite", ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);

Ogre的三種内置的材質

        // Set up an unlit base white material

Ogre的三種内置的材質

        MaterialPtr baseWhiteNoLighting = create("BaseWhiteNoLighting",

Ogre的三種内置的材質

            ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);

Ogre的三種内置的材質

        baseWhiteNoLighting->setLightingEnabled(false);

Ogre的三種内置的材質
Ogre的三種内置的材質

    }

由代碼可知:

DefaultSettings是預設的材質,如果沒有使用材質名就使用的它。

BaseWhite,是基于光照的白色材質,事實上DefaultSettings的材質就是它;

BaseWhiteNoLighting,是基于無光照的白色材質。