Ogre Reference Manual (10) 6 external texture source

Source: Internet
Author: User

6 External texture Source

This section only provides a brief introduction to the Extermaltexturesource and Extermaltexturesourcemanager classes and how the plug-in works. More reference Ffmpegvideosystem Plugins

What is an external texture source

Traditional picture files such as Png\bmp\jpeg and other ogre have been dealt with. Other texture format sources, such as mpeg\avi\flash, user-defined formats, and so on, ogre content that is not parsed can be used as external texture sources.

Externaltexturesource class

Writing an external texture source plugin requires inheriting the Externaltexturesource class. This class provides very limited functionality through the Stringinterface interface. The most commonly used parameters can be set through the interface provided by the class or the base class Stringinterface interface. The Stringinterface interface is provided primarily to facilitate the addition of new parameter types when the plugin inherits.

The default parameters are:

filename loaded by the filename plugin

Play_mode playback modes, including Play/loop/pause

set_t_p_s setting the texture's technology, channel, texture (state), default "0 0 0"

Frames_per_second number of frames, can only be integers

The interfaces that the base class must inherit include:

virtual bool Initialise () = 0; Initialization

virtual void ShutDown () = 0; Destroyed

Creating textures (most important interfaces)

virtual void createdefinedtexture (const string& Smaterialname,

Const string& GroupName = Resourcegroupmanager::D efault_resource_group_name) = 0;

Destroying textures

virtual void destroyadvancedtexture (const string& Stexturename,

Externaltexturesourcemanager class

Used to register and manage loaded plug-ins, and to assist in creating texture source textures from scripts. It is also an interface for accessing the texture source plug-in

To create a texture using Externaltexturesourcemanager:

1, registration: Through PLUGINS.CFG loading plug-ins, plug-in loading should call Setexternaltexturesource to register their own

2. Create Textures:

Call Setcurrentplugin () to set the currently used texture plug-in

Call Getcurrentpluin ()->setparameter to set the parameters

Call Getcurrentpluin ()->createdefinedtexure to create a texture

The Destroyadvancedtexture class also provides a method to delete a texture, which broadcasts a texture name to all loaded texture source plug-ins, and the corresponding plug-in should be in Externaltexturesource:: The Destroyadvancedtexture interface does the cleanup action.

Texture source material Script

Material Example/myvideoexample

{technique {pass {

texture_unit{

Texture_source video//Texture Source Type

{

FileName mymovie.mpeg//file name, default parameter

Play_mode Play//play parameters, default parameters

Sound_mode on//plug-in extension parameters

}

}

} } }

Ffmpegvideosystem plug-in configuration example, which specifies the parameters of a texture source using a separate Texture_source

Processing flow

Ffmpegvideosystem plug-in process, other plug-ins similar

Report:

Writing an external texture source plug-in only requires inheriting the Externaltexturesource class and implementing its Createdefinedtexture interface. Typically, ogre calls the plug-in's createdefinedtexture interface to create textures when parsing a material script. Plug-ins are registered via the Externaltexturesourcemanager::setexternaltexturesource interface at load time

Ogre does not provide controls such as refresh, for ffmpegvide plug-ins or other similar dynamic plug-ins, requires the plugin to handle the refresh itself, the typical way is to inherit Framelistener and load into the Ogreroot listening queue, update the texture in the Framestarted method.

Ogre Reference Manual (10) 6 external texture source

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.