x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
MaterialControls.h - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\ogre\sample_include\MaterialControls.h
旋转
特效
属性
历史版本
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2006 Torus Knot Software Ltd Also see acknowledgements in Readme.html You may use this sample code for anything you like, it is not covered by the LGPL like the rest of the engine. ----------------------------------------------------------------------------- */ #ifndef __MaterialControls_H__ #define __MaterialControls_H__ #include "CEGUI/CEGUIForwardRefs.h" #include "OgreString.h" enum ShaderValType { GPU_VERTEX, GPU_FRAGMENT, MAT_SPECULAR, MAT_DIFFUSE, MAT_AMBIENT, MAT_SHININESS, MAT_EMISSIVE }; //--------------------------------------------------------------------------- struct ShaderControl { Ogre::String Name; Ogre::String ParamName; ShaderValType ValType; float MinVal; float MaxVal; size_t ElementIndex; mutable size_t PhysicalIndex; float getRange(void) const { return MaxVal - MinVal; } float convertParamToScrollPosition(const float val) const { return val - MinVal; } float convertScrollPositionToParam(const float val) const { return val + MinVal; } }; typedef std::vector
ShaderControlsContainer; typedef ShaderControlsContainer::iterator ShaderControlIterator; // used for materials that have user controls //--------------------------------------------------------------------------- class MaterialControls { public: MaterialControls(const Ogre::String& displayName, const Ogre::String& materialName) : mDisplayName(displayName) , mMaterialName(materialName) { }; ~MaterialControls(void){} const Ogre::String& getDisplayName(void) const { return mDisplayName; } const Ogre::String& getMaterialName(void) const { return mMaterialName; } size_t getShaderControlCount(void) const { return mShaderControlsContainer.size(); } const ShaderControl& getShaderControl(const size_t idx) const { assert( idx < mShaderControlsContainer.size() ); return mShaderControlsContainer[idx]; } /** add a new control by passing a string parameter @param params is a string using the following format: "
,
,
,
,
,
"
is the string displayed for the control name on screen
is the name of the variable in the shader
can be GPU_VERTEX, GPU_FRAGMENT
minimum value that parameter can be
maximum value that parameter can be
index into the the float array of the parameter. All GPU parameters are assumed to be float[4]. */ void addControl(const Ogre::String& params); protected: Ogre::String mDisplayName; Ogre::String mMaterialName; ShaderControlsContainer mShaderControlsContainer; }; typedef std::vector
MaterialControlsContainer; typedef MaterialControlsContainer::iterator MaterialControlsIterator; //--------------------------------------------------------------------------- struct ShaderControlGUIWidget { CEGUI::Window* TextWidget; CEGUI::Window* NumberWidget; CEGUI::Scrollbar* ScrollWidget; ShaderControlGUIWidget() : TextWidget(NULL), NumberWidget(NULL), ScrollWidget(NULL) {} }; //--------------------------------------------------------------------------- /** loads material shader controls from a configuration file A .controls file is made up of the following: [
] material =
control =
,
,
,
,
,
is what is displayed in the material combo box.
is the name of the material in the material script. control is the shader control associated with the material. The order of the contol definions in the .controls file determins their order when displayed in the controls window. you can have multiple .controls files or put them all in one. */ void loadMaterialControlsFile(MaterialControlsContainer& controlsContainer, const Ogre::String& filename); /** load all control files found in resource paths */ void loadAllMaterialControlFiles(MaterialControlsContainer& controlsContainer); #endif // __MaterialControls_H__
MaterialControls.h
网页地址
文件地址
上一页
17/35
下一页
下载
( 4 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.