??xml version="1.0" encoding="utf-8" standalone="yes"?>国内精品伊人久久久久AV影院,精品国产一区二区三区久久久狼,18岁日韩内射颜射午夜久久成人http://www.shnenglu.com/mybios/archive/2015/11/20/212299.html李锦?mybios)李锦?mybios)Fri, 20 Nov 2015 07:03:00 GMThttp://www.shnenglu.com/mybios/archive/2015/11/20/212299.htmlhttp://www.shnenglu.com/mybios/comments/212299.htmlhttp://www.shnenglu.com/mybios/archive/2015/11/20/212299.html#Feedback2http://www.shnenglu.com/mybios/comments/commentRss/212299.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/212299.html    cocos2d-x支持多种脚本引擎的绑定,例如支持luaQ通过lua或luajitQ、javascriptQ通过SpiderMonkey脚本引擎Q,分别对应libluacocos2d和libjscocos2d两个工程Q每个工E里分别对应大量的自动绑定和手动l定代码。如果需要增加一些引擎功能需要绑定到脚本的话Q两个工E都需要修改代码,非常不便于维护。假如希望用其他脚本引擎的话(例如googleU红火火的V8Q或者ms的chakraQ,那得多开几个工程Q每个工E都需要实现几乎一P但是又不一L代码。现在我提出一U思想Q来解决q类问题?/span>
    现有的脚本引擎多如牛毛,而不同企业间可能有不同的技术积累,希望选择不一L脚本引擎Q有的python蟒蛇z,有的是luaz,有的是rubyz,q有JavaScript、lua{等{等Q所以,JavaScript和Lua不应该成Z选一?/div>
而这些脚本引擎之_有很多的共同点,例如都是q型语aQ都是支持那么几U简单类型,都是使用GC机制来回收等{?/div>
脚本引擎l一化,是把多个脚本引擎Qlua、JavaScriptCore、chakra、v8、spidermonkey{等Q通过同一套抽象接口进行封装,引擎的脚本绑定代码都通过抽象接口来编写。通过选择~译不同的实现层来实现脚本引擎间的切换,而不是每个脚本引擎都要写不一L脚本l定代码Q这栯大大化脚本绑定层的维护成本,q能保证所有脚本引擎的接口的绝对一致性,q让用户L选择使用哪个脚本引擎Q而不限定于必M用官斚w择的引擎?/div>
    脚本引擎抽象层API的定义非常关键,概括h我认Z必须W合以下要求Q?/div>
1?span style="background-color: inherit; line-height: 1.5;">抽象层的接口必须在各个脚本引擎之间都可以实现Q例如:“创徏字符?#8221;q个接口Q是L脚本引擎都能实现?/span>
2?/span>抽象层在l定脚本的过E中是够用的,例如Q我们需要导Z个C++的类Q还需要导出类里的函数Q还有特D的l构体,甚至包含lambda表达式,q些都需要考虑q去抽象层定义的需求里?/span>
3、抽象层q必够的薄,薄到q行时根本感觉不C的存在。需要?#8220;?#8221;或者inline函数的方式来l这个抽象层减肥Q坚决不使用C++cȝ方式来加厚他?/span>
4、抽象层在用的q程中必够简单,单到好像是一个单独的脚本引擎API一Pq些API看上L大统一的,q且是脚本语a无关的?/span>
    在定义抽象层的过E中Q我参考了很多别h的方案,最l,我?nbsp;了这么个ҎQ?/div>
1、用C inline函数来定义API接口函数的声明,各个引擎的实现部分分别实现这些函?/div>
2、定义一些基本类型,基本cd有各个脚本引擎来最l定义,但名字和意义都是l一的,初步定义了这些类型,每个cd在不同脚本引擎中对应的类型分别如下表Q?/div>
l一cd
描述
Lua
JavaScript
JavaScriptCore
V8
chakra
USValue
表示脚本中的Lcd
Lcd

Object
JSValueRef
v8::Local<v8::Value>
JsValueRef
USObject
脚本对象Q对象可以由key、valuel成Q可以拥有承结?/div>
table
Object
JSObjectRef
v8::Local<v8::Object>
JsValueRef
USFunction
脚本函数
function
Function
JSObjectRef
v8::Local<v8::Function>
JsValueRef
USArray
数组cdQ下标从0开?/div>
table
Array
JSObjectRef
v8::Local<v8::Array>
JsValueRef
USMap
?值配对的mapcd
table
Map
JSObjectRef
v8::Local<v8::Object>
JsValueRef
USSet
g为键也作为值得列表Qg能重?/div>
table
Set
JSObjectRef
v8::Local<v8::Object>
JsValueRef
USNumber
数值类?/div>
number
Number
JSValueRef
v8::Local<v8::Number>
JsValueRef
USBoolean
boolcd
boolean
Boolean
JSValueRef
v8::Local<v8::Boolean>
JsValueRef
USString
字符串类?/div>
string
String
JSValueRef
v8::Local<v8::String>
JsValueRef
USBuffer
内存块缓存对?/div>
string
Int8Array
JSValueRef
v8::Local<v8::Int8Array>
JsValueRef
USConstructor
对象实例的构造器Q用来导出C++c?/div>
table
Object
JSValueRef
v8::Local<v8::Object>
JsValueRef
3、定义一批APIQ用以对以上定义的基本类型进行创建、调用、修改等操作Q例如创建的q程API定义成这UŞ式:

 1  // 创徏Null?/span>
 2     inline USValue createUSNull();
 3  // 创徏Undefined?/span>
 4     inline USValue createUSUndefined();
 5  // 创徏普通的对象
 6     inline USObject createUSObject();
 7  // 创徏数组
 8     inline USArray createUSArray(int length = 0);
 9  // 创徏Map
10     inline USMap createUSMap();
11  // 创徏Set
12     inline USSet createUSSet();
13  // 创徏字符?/span>
14     inline USString createUSString(const char *str, int length = -1);
15  // 创徏BufferQ将会拷贝数据到Buffer中,脚本引擎负责销?/span>
16     inline USBuffer createUSBuffer(const char *buffer, size_t size);
17  // 创徏一个脚本函敎ͼ函数调用时会回调到callbackQƈ带上data
18     USFunction createUSFunction(USFunctionCallback callback, void *data = nullptr, const char *name = nullptr);
19  // 创徏数字
20     inline USNumber createUSNumber(double number);
21  // 创徏bool
22     inline USBoolean createUSBoolean(bool value);
23 
24  // 创徏对象构造器
25     USConstructor USClassCreateConstructor(const USClass &cls);
 
抽象层定义好后,需要经q大量的努力Q才能在各个脚本引擎间的最l实现。当最l实现完毕后Q就可以下一步工作:
1、把cocos2d-x对于自动l定代码的templatec进行修改,修改成用统一脚本引擎的API
2、把cocos2d-x对于手动l定的代码如法炮?/div>
3、用不同的引擎实现来编?/div>
l过q样如法炮制之后Q最lcocos2d-x只剩下一套脚本绑定的工程Q而通过选择不同的底层脚本引擎,却可以编译出完全不一L脚本引擎版本?/div>
l过cocos2d-x githubC֌的努力,最l应该会出现不同的forkQ如python、ruby{等各种语言出现各种l定版本Q而这U绑定版本的出现Q只需实现抽象层API的基本API卛_?/div>
xcocos2d-x的脚本引擎统一卛_完成大业?/div>
但,事情q没完,我在下一中Q将会讲到抽象API的详l定义,敬请期待下一?br />

如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p>

不如打赏我一杯咖啡,鼓励我l分享优U的文章?br />






李锦?mybios) 2015-11-20 15:03 发表评论
]]>使用FreeType实现矢量字体的粗体、斜体、描辏V阴影效?/title><link>http://www.shnenglu.com/mybios/archive/2009/08/01/91869.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Sat, 01 Aug 2009 02:42:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2009/08/01/91869.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/91869.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2009/08/01/91869.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/91869.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/91869.html</trackback:ping><description><![CDATA[     摘要: 使用FreeType实现矢量字体的粗体、斜体、描辏V阴影效?  前言Q?Freetype是一个跨q_、开源的字体渲染器,|上很多文章介绍Q本人就不啰嗦了。本文重点在于实现文章标题所属的各种效果Q不是Freetype的基本用方法介l文档,所以对于Freetype不熟悉的同学们请先学习下Freetype的基本用法,才可以用本文中所提及的方法?正文Q?用FreeType实现?..  <a href='http://www.shnenglu.com/mybios/archive/2009/08/01/91869.html'>阅读全文</a><img src ="http://www.shnenglu.com/mybios/aggbug/91869.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2009-08-01 10:42 <a href="http://www.shnenglu.com/mybios/archive/2009/08/01/91869.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于天龙八部frame文g格式http://www.shnenglu.com/mybios/archive/2009/07/26/91270.html李锦?mybios)李锦?mybios)Sun, 26 Jul 2009 12:41:00 GMThttp://www.shnenglu.com/mybios/archive/2009/07/26/91270.htmlhttp://www.shnenglu.com/mybios/comments/91270.htmlhttp://www.shnenglu.com/mybios/archive/2009/07/26/91270.html#Feedback2http://www.shnenglu.com/mybios/comments/commentRss/91270.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/91270.htmlq来人都说技术只是一层纸Q一捅就破。想当天׃很多旉ȝIframe文g的二q制格式I竟是怎么来的Q但始终未果。到头来发现竟然只是一个普通的.skeleton文gQ脑后不冒出好几条黑色竖条?br />现我把这层纸捅破了,望过来h不用再辛辛苦苦研Iframe文g格式走弯路了?br />

如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p>

不如打赏我一杯咖啡,鼓励我l分享优U的文章?br />





李锦?mybios) 2009-07-26 20:41 发表评论
]]>
发布一个前D|间写的天龙八部GridInfod源码http://www.shnenglu.com/mybios/archive/2009/07/26/91267.html李锦?mybios)李锦?mybios)Sun, 26 Jul 2009 12:36:00 GMThttp://www.shnenglu.com/mybios/archive/2009/07/26/91267.htmlhttp://www.shnenglu.com/mybios/comments/91267.htmlhttp://www.shnenglu.com/mybios/archive/2009/07/26/91267.html#Feedback5http://www.shnenglu.com/mybios/comments/commentRss/91267.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/91267.html阅读全文

李锦?mybios) 2009-07-26 20:36 发表评论
]]>
Unreal3游戏引擎UObject源码阅读分析http://www.shnenglu.com/mybios/archive/2009/07/26/91196.html李锦?mybios)李锦?mybios)Sun, 26 Jul 2009 01:50:00 GMThttp://www.shnenglu.com/mybios/archive/2009/07/26/91196.htmlhttp://www.shnenglu.com/mybios/comments/91196.htmlhttp://www.shnenglu.com/mybios/archive/2009/07/26/91196.html#Feedback8http://www.shnenglu.com/mybios/comments/commentRss/91196.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/91196.htmlUnreal3Q以下简UU3Q是一个以脚本Z体的游戏引擎Q所有代码几乎都本服务,意味着所有源码都会提供相应的脚本函数在脚本中使用?br />UObject是U3中很重要的一个基c,所有由UObjectz的类都可以导出到脚本中(不从UObjectz行不行?不知道呢Q,但我对U3的脚本不熟。暂且从C++角度来分析下UObject是如何实现的?br />UObject֐思义是一?#8220;基本对象”Q材质、mesh、文件、玩家等{都是从q个UObjectl承而来Q这个类做了很多事情Q?/p>

1、属性的l一讉K接口Q脚本中可以通过q个接口来访问属性了Q?br />2、成员函数的l一讉K接口Q脚本中可以通过q些接口来调用UObject或其zcȝ成员函数Q?br />3、串行化的统一接口Q实C一个保存所有对象的UPackage包管理器Q从而做C存到二进制文件、从二进制文件读取,q样做的好处是持久化对象Q比如游戏中的材质列表)的蝲入非常快速,׃是二q制格式Q不需要Q何字W串数据转换Q?br />4、提供对象的垃圾回收功能Q?br />5、提供编辑器的相应功能,如:对象?#8220;属?#8221;有各U编辑器所需的标讎ͼ是否可编辑CPF_Edit{)、对象在~辑器中的渲染DrawThumbnail、对象描qGetThumbnailDesc、对象选择IsSelected、是否更改了包MarkPackageDirty{等Q?br />6、提供一个对象的理器,q个对象理器是通过UObject中的一堆静态函数来实现的,如:从管理器中查找一个对象StaticFindObject、分配一个对象StaticAllocateObject、从包中载入一个对象StaticLoadObject、根据类型来遍历理器中的所有对象FObjectIterator/TObjectIterator、遍历所有选择了的对象TSelectedObjectIteratorQ编辑器使用Q?br />7、提供配|管理器Q通过UObject中的LoadConfig、SaveConfig实现
8、提供类描述信息Q描qCq个cM哪个cL生、有什么属性、每个属性的讉K方式、有什么函敎ͼ从而实C动态类型判断、脚本属性访问、脚本函数访问、属性串行化{等
9、其他。。。?/p>

单分析下UObject中的各个成员变量的意义:
IndexQ用来记录这个UObject在所有UObject列表GObjObjects中的唯一索引
HashNextQ用来记录全局UObject Hash表GObjHash中跟q个UObject 的Hash值相同的下一个UObject的指针,用来配合全局Hash表GObjHash通过StaticFindObject函数快速搜索一个指定名U的UObject
StateFrameQ脚本相关的咚咚Q还没看
_LinkerQ通过在包文g中蝲入时的蝲入器
_LinkerIndexQ通过包文件蝲入时的UPackage包对象在GObjObjects中的唯一索引Q相当于Outer->Index
OuterQ这个对象所属的?br />ObjectFlagsQ这个对象的一些标讎ͼ具体参见EObjectFlags枚DQ不同标记来军_q个对象的一些行为,比如是否可以保存、是否可见等{?br />NameQ对象名Uͼ通过一个FName来实玎ͼq个FName可是个好东西哦,字符串比较变成了一个Hash值比?br />ClassQ用来描q这个类Q就是以上第1??点说到的。这个Class在调用UObject::StaticClass或派生类的StaticClass静态函数时会一ơ性初始化Q意味着即创徏多少个UObjectQ但Class只会有一个实例,我们通过q个c,可以使用TFieldIterator的统一方式来遍历这个类的所有属性、函数?/p>

UObject的静态变量,q些静态变量其实就是UObject对象理器用的变量Q如果用Ogre的设计方法来做,q当于另外一个class UObjectManager : public Singleton<UObjectManager>Q然后在里面把这些静态变量拿到UObjectManager中去。简要分析下静态变量的意义Q?br />GObjInitializedQ对象管理器是否已经初始化,全局对象理器只需要初始化一ơ就够了Q?br />GObjNoRegisterQ调用StaticInit时会讄?Q?br />GObjBeginLoadCountQ有多少个对象被BeginLoad了;
GObjRegisterCountQProcessRegistrants中?br />GImportCountQ还没细看哦
GObjHashQ通过每个UObject的Name的Hash值取?2位作为烦引g存在GObjHash表中QHash值的?2位相同的Q只记录W一个在GObjHash表中Q其他的通过链表方式使用UObject的HashNext来链接v?br />GAutoRegisterQ自动注册的对象列表
GObjRootQ对象树U的层对象
GObjObjectsQ所有对象的列表

先说q么多了Ql学习?/p>

如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p>

不如打赏我一杯咖啡,鼓励我l分享优U的文章?br />





李锦?mybios) 2009-07-26 09:50 发表评论
]]>
在VS2005调试器中昄Unreal3的数?/title><link>http://www.shnenglu.com/mybios/archive/2009/05/24/85618.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Sun, 24 May 2009 09:13:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2009/05/24/85618.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/85618.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2009/05/24/85618.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/85618.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/85618.html</trackback:ping><description><![CDATA[Unreal3引擎中,大量使用了自定义的模版或数据cdQ比如TArray、FName、FString{等Q对于这三种数据cdQ我们无法在VS2005中直接查看他们的|L不能像std::vector/std::string一L观查看)?br>通过msdnQ得知vs2005的autoexp.dat可以可以l自定义的数据类型编写可视化脚本从而实现直观的调试?br>l过一番研IӞ实现了对Unreal3数据cd的直观的可视化调试,Ҏ如下Q?br><br>打开vs2005目录中的autoexp.dat文g<br><br>扑ֈ[AutoExpand]Q在[AutoExpand]的下面添加一?<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">FNameEntry</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><Name</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">su></span></div> <br><br>d文g最后,d以下代码到文件的最后:<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000"><br></span><span style="COLOR: #008000">;</span><span style="COLOR: #008000"> Unreal格式的数l?/span><span style="COLOR: #008000"><br></span><span style="COLOR: #000000">TArray<*>{<br>    children<br>    (<br>        #array<br>        (<br>            expr :    (($T1*)($c.Data))</span><span style="FONT-WEIGHT: bold; COLOR: #800000">[</span><span style="COLOR: #800000">$i</span><span style="FONT-WEIGHT: bold; COLOR: #800000">]</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">  <br>            size :    $c.ArrayNum<br>        )<br>    )<br>    <br>    preview<br>    ( <br>        #( <br>            </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000"> <br>            $c.ArrayNum </span><span style="COLOR: #000000">,</span><span style="COLOR: #000000"><br>            </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">](</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000"> <br>            <br>            #array<br>            (<br>                expr : (($T1*)($c.Data))</span><span style="FONT-WEIGHT: bold; COLOR: #800000">[</span><span style="COLOR: #800000">$i</span><span style="FONT-WEIGHT: bold; COLOR: #800000">]</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">  <br>                size :     $c.ArrayNum<br>            )</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000"> <br>            </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br>        )<br>    )<br>}<br><br></span><span style="COLOR: #008000">;</span><span style="COLOR: #008000"> Unreal格式的FName</span><span style="COLOR: #008000"><br></span><span style="COLOR: #000000">FName{<br>    preview(</span><span style="FONT-WEIGHT: bold; COLOR: #800000">[</span><span style="COLOR: #800000">((FNameEntry**)FName.Names.Data)[$c.Index</span><span style="FONT-WEIGHT: bold; COLOR: #800000">]</span><span style="COLOR: #000000">])<br>        stringview(</span><span style="FONT-WEIGHT: bold; COLOR: #800000">[</span><span style="COLOR: #800000">((FNameEntry**)FName.Names.Data)[$c.Index</span><span style="FONT-WEIGHT: bold; COLOR: #800000">]</span><span style="COLOR: #000000">])<br>}<br></span><span style="COLOR: #008000">;</span><span style="COLOR: #008000"> Unreal格式的字W串</span><span style="COLOR: #008000"><br></span><span style="COLOR: #000000">FString{<br>    preview(</span><span style="FONT-WEIGHT: bold; COLOR: #800000">[</span><span style="COLOR: #800000">$c.Data,su</span><span style="FONT-WEIGHT: bold; COLOR: #800000">]</span><span style="COLOR: #000000">)<br>        stringview(</span><span style="FONT-WEIGHT: bold; COLOR: #800000">[</span><span style="COLOR: #800000">$c.Data,su</span><span style="FONT-WEIGHT: bold; COLOR: #800000">]</span><span style="COLOR: #000000">)<br>}</span></div> <br>然后Q到调试器里情看TArray、FString、FName{等qx不容易看的数据吧。效果图׃贴了?br>此方法可以D一反三Q用来实现对L数据cd的查看?br><br><br> <img src ="http://www.shnenglu.com/mybios/aggbug/85618.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2009-05-24 17:13 <a href="http://www.shnenglu.com/mybios/archive/2009/05/24/85618.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>兽争霸3自动拼接地Ş渲染源码与执行程序下?/title><link>http://www.shnenglu.com/mybios/archive/2008/10/31/65636.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Fri, 31 Oct 2008 11:51:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2008/10/31/65636.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/65636.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2008/10/31/65636.html#Feedback</comments><slash:comments>14</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/65636.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/65636.html</trackback:ping><description><![CDATA[q里发的源码是针对上ơ的文章的源码http://www.shnenglu.com/mybios/archive/2008/10/26/65076.html<br /><a href="http://www.shnenglu.com/Files/mybios/源码与执行程?part01.rar">http://www.shnenglu.com/Files/mybios/源码与执行程?part01.rar</a><br /><a href="http://www.shnenglu.com/Files/mybios/源码与执行程?part02.rar">http://www.shnenglu.com/Files/mybios/源码与执行程?part02.rar</a><br /><a href="http://www.shnenglu.com/Files/mybios/源码与执行程?part03.rar">http://www.shnenglu.com/Files/mybios/源码与执行程?part03.rar</a><br /><a href="http://www.shnenglu.com/Files/mybios/源码与执行程?part04.rar">http://www.shnenglu.com/Files/mybios/源码与执行程?part04.rar</a><br /><a href="http://www.shnenglu.com/Files/mybios/源码与执行程?part05.rar">http://www.shnenglu.com/Files/mybios/源码与执行程?part05.rar</a><br /><br />发现有的行不了程序,是由于没安装vc2008的redistD的。请下蝲安装之:<br /><a >http://www.microsoft.com/downloads/details.aspx?FamilyID=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=zh-cn</a><br /><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">不如打赏我一杯咖啡,鼓励我l分享优U的文章?br /><img src="http://www.shnenglu.com/images/cppblog_com/mybios/222.jpg" border="0" alt="" /><br /><br /><br /><br /></p><img src ="http://www.shnenglu.com/mybios/aggbug/65636.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2008-10-31 19:51 <a href="http://www.shnenglu.com/mybios/archive/2008/10/31/65636.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>兽争霸3的自动拼接地形渲染方?/title><link>http://www.shnenglu.com/mybios/archive/2008/10/26/65076.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Sun, 26 Oct 2008 04:16:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2008/10/26/65076.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/65076.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2008/10/26/65076.html#Feedback</comments><slash:comments>11</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/65076.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/65076.html</trackback:ping><description><![CDATA[<p align="left">源码已发布,h开下蝲<a href="http://www.shnenglu.com/mybios/archive/2008/10/31/65636.html">http://www.shnenglu.com/mybios/archive/2008/10/31/65636.html</a><br />上次发了个这L图,l果被某些h鄙视了,很郁闷啊?br /><br />我们把一个魔?的草地脓图提取出来,q且用下面的分块Ҏ来标C每一块小贴图Q然后通过一U特定的方式来组l这些小贴图QŞ成真正的地表贴图?br />兽争霸~辑器中刷地表时Q刷一格就会媄响四个周围的渲染块,具体如何影响Q请看下图:<br /><br />q是贴图的分块烦引方法:<br /><img height="256" alt="" src="http://www.shnenglu.com/images/cppblog_com/mybios/Lords_Grass.tga.jpg" width="512" border="0" /><br /><br /><br /><br />通过兽争霸地图~辑器点一下刷地表草之后,在地图中׃出现一块l色草地地表Q请注意在图中我用数????来表C四个渲染块对应的脓囄引,而这????是固定的。代表的是相对于W刷位置Q笔刷位|是指周围四个渲染块中间位置Q来_左下角的角落贴图索引?Q右下角的角落脓囄引是2Q左上角的角落脓囄引是4Q右上角的角落脓囄引是8。如下图所C:<br /><img height="465" alt="" src="http://www.shnenglu.com/images/cppblog_com/mybios/1.jpg" width="651" border="0" /><br /><br /><br />如果在已l有草地的地表旁边再点一下刷地表Q会h如下图这个样子:<br />看明?+4=12没有Q这里是两个角落贴图索引相加后的l果Q得?2Q就从文章开头的索引贴图中找?2对应的小贴图贴上厅R?br />2+1=3同理Q用两个角落贴图索引相加后的l果3从烦引脓图中扑ֈ3对应的小贴图贴上厅R?br />q样得到的效果就会变成如下图Q?br /><img height="531" alt="" src="http://www.shnenglu.com/images/cppblog_com/mybios/2.jpg" width="923" border="0" /><br /><br /><br />q里有是更复杂的情况Q有三个角落相加Q?+8+4=13Q不q道理都是一L?br /><img height="768" alt="" src="http://www.shnenglu.com/images/cppblog_com/mybios/3.jpg" width="1034" border="0" /><br /><br />最后说一下四周都有脓囄情况Q看C间笔刷位|没有?W刷左上Ҏ一个脓图,对应的是贴图索引中的0Q这是因Z四个角都填充了,所以就需要从0?6~31中随机选择一个小贴图贴上M完整的填充整个渲染块Q?br /><img height="768" alt="" src="http://www.shnenglu.com/images/cppblog_com/mybios/4.JPG" width="899" border="0" /><br /><br />x贴图选择的方法已l说完了?br />至于渲染的方法,都是大同异Q这里就不多说了?/p><br /><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">不如打赏我一杯咖啡,鼓励我l分享优U的文章?br /><img src="http://www.shnenglu.com/images/cppblog_com/mybios/222.jpg" border="0" alt="" /><br /><br /><br /><br /></p><img src ="http://www.shnenglu.com/mybios/aggbug/65076.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2008-10-26 12:16 <a href="http://www.shnenglu.com/mybios/archive/2008/10/26/65076.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>刚完成了一个基于Ogre渲染的世界编辑器Q发囄?/title><link>http://www.shnenglu.com/mybios/archive/2008/03/09/44046.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Sun, 09 Mar 2008 14:55:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2008/03/09/44046.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/44046.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2008/03/09/44046.html#Feedback</comments><slash:comments>29</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/44046.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/44046.html</trackback:ping><description><![CDATA[<p>q个世界~辑器,从一开始设计的时候就考虑使用卌x得的形式来实玎ͼ地图载入、保存等{操作是独立装在一个叫DisplaySystem的Dll中,而世界编辑器使用插g的Ş式来实现各种功能Q如Q地形编辑插件、网格插件、物件编辑插件、环境编辑插件等{。用插g的Ş式实现的好处很多Q以后要增加新功能的时候世界编辑器本n的代码就不需要修改了。而且对于团队开发也很有利,一个h负责一个插件的开发就可以?br />发几个图Q?br /><br />以下是没有启用插件的模式Q?br /><img src="http://www.shnenglu.com/images/cppblog_com/mybios/WorldEditor.jpg" border="0" alt="" /><br /><br />以下是启用了地Ş~辑器插件的模式Q?br /><img src="http://www.shnenglu.com/images/cppblog_com/mybios/TerrainEditor.jpg" border="0" alt="" /><br /><br />以下是启用了物g~辑器插件的模式Q?br /><img height="768" src="http://www.shnenglu.com/images/cppblog_com/mybios/NoPlugins.jpg" width="1257" border="0" alt="" /></p><br /><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">不如打赏我一杯咖啡,鼓励我l分享优U的文章?br /><img src="http://www.shnenglu.com/images/cppblog_com/mybios/222.jpg" border="0" alt="" /><br /><br /><br /><br /></p><img src ="http://www.shnenglu.com/mybios/aggbug/44046.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2008-03-09 22:55 <a href="http://www.shnenglu.com/mybios/archive/2008/03/09/44046.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ogre 的渲染到U理的关键的3个步?/title><link>http://www.shnenglu.com/mybios/archive/2007/12/27/39764.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Thu, 27 Dec 2007 13:06:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2007/12/27/39764.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/39764.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2007/12/27/39764.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/39764.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/39764.html</trackback:ping><description><![CDATA[<p>好久没写技术的东西了。现在辗转间又回C深圳工作Q还是做我喜Ƣ的游戏开发。奉献点东西l大家?/p> <p><br />1、创建渲染目标纹理,关键要指定TU_RENDERTARGET参数Q在创徏q个渲染目标U理的过E中QOgre会自动调?nbsp; Root::getSingleton().getRenderSystem()->attachRenderTarget把这个纹理添加到Root的渲染目标中Q也是说每帧都会渲染到q个U理?br />TexturePtr texture = TextureManager::getSingleton().createManual( "RttTex", <br /> ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, <br /> 512, 512, 0, PF_R8G8B8, TU_RENDERTARGET );</p> <p>2、获得渲染目标,有了渲染目标Q才能给目标指定视口和摄像机<br />RenderTarget *rttTex = texture->getBuffer()->getRenderTarget();</p> <p>3、给q个渲染目标指定摄像机,做了q步骤之后,每更新时就会把q个摄像机看到的东西渲染到texture?br />Viewport *v = rttTex->addViewport( mReflectCam );</p> <p>4、OKQ?/p><br /><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">不如打赏我一杯咖啡,鼓励我l分享优U的文章?br /><img src="http://www.shnenglu.com/images/cppblog_com/mybios/222.jpg" border="0" alt="" /><br /><br /><br /><br /></p><img src ="http://www.shnenglu.com/mybios/aggbug/39764.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2007-12-27 21:06 <a href="http://www.shnenglu.com/mybios/archive/2007/12/27/39764.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>兽3贴图Ҏhttp://www.shnenglu.com/mybios/archive/2007/08/28/31043.html李锦?mybios)李锦?mybios)Tue, 28 Aug 2007 10:57:00 GMThttp://www.shnenglu.com/mybios/archive/2007/08/28/31043.htmlhttp://www.shnenglu.com/mybios/comments/31043.htmlhttp://www.shnenglu.com/mybios/archive/2007/08/28/31043.html#Feedback18http://www.shnenglu.com/mybios/comments/commentRss/31043.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/31043.html只能说这么多了。公司有保密制度。请见谅Q?br />

如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p>

不如打赏我一杯咖啡,鼓励我l分享优U的文章?br />





李锦?mybios) 2007-08-28 18:57 发表评论
]]>
l于实现了魔?贴图法Q发囄?/title><link>http://www.shnenglu.com/mybios/archive/2007/08/28/31021.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Tue, 28 Aug 2007 07:00:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2007/08/28/31021.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/31021.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2007/08/28/31021.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/31021.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/31021.html</trackback:ping><description><![CDATA[兽3的地形脓囄法非常的巧妙。不q,认真观看他的地图~辑器和用工具导Z的地形脓囄看,q是可以摸出规律来的?br /><br /><img height="627" alt="" src="http://www.shnenglu.com/images/cppblog_com/mybios/WC3.JPG" width="808" border="0" /><br /><div><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">如果本文对你的开发有所帮助Qƈ且你手头恰好有零钱?/p><p style="margin-top: 10px; margin-bottom: 10px; box-sizing: border-box; line-height: 24px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px;">不如打赏我一杯咖啡,鼓励我l分享优U的文章?br /><img src="http://www.shnenglu.com/images/cppblog_com/mybios/222.jpg" border="0" alt="" /><br /><br /><br /><br /></p></div><img src ="http://www.shnenglu.com/mybios/aggbug/31021.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2007-08-28 15:00 <a href="http://www.shnenglu.com/mybios/archive/2007/08/28/31021.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于GOOF的新版本http://www.shnenglu.com/mybios/archive/2007/07/18/28250.html李锦?mybios)李锦?mybios)Wed, 18 Jul 2007 01:21:00 GMThttp://www.shnenglu.com/mybios/archive/2007/07/18/28250.htmlhttp://www.shnenglu.com/mybios/comments/28250.htmlhttp://www.shnenglu.com/mybios/archive/2007/07/18/28250.html#Feedback2http://www.shnenglu.com/mybios/comments/commentRss/28250.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/28250.html
Yeah, I'm currently hard at work on the core engine, as the editor is nearly complete. The major feature I need to add for the editor is the ability to add new object definitions without needing to go through text files, but I'm a bit burned out on the editor part so I'm taking a break and working on one of the biggest engine features that needs some work: handling meshes.

Basically I'm reworking the MeshGameObject class completely so it's more viable for large worlds.

As far as features go before I release alpha, the list is still sorta large.

1. Finish the physics system so that it can be used for character movement.
2. An attachment system to be able to specify attachment locations on an object and attach any other object to it.
3. Mesh animation, animation blending, animation sharing between objects.
4. Character class which plays animations based on current state (movement direction, velocity, jumping, strafing, etc.)
5. Redo the mesh system (in progress). This is a biggy and involves a lot crazy stuff that is too complex to explain in bullet point. Basically, will be using all of Ogre's advanced features for mesh lods, material lods, etc. but also tie into background resource loading, load only the lods that are necessary, track which lods are currently loaded, etc.
6. Ability to add, update and delete meta objects from the editor using property dialog functionality. Once a meta object is updated, call a function on all objects that use that meta data so they can update themselves with newest data.
7. Managed material system
8. Create plugins of all dlls and dynamically load.
9. Create a viewer application that is separate from the editor and can load any world file.
10. Update the lighting system, particle system, to use new fading code based on updated mesh code

Those are my major todos, once finished and tested I release alpha. I will likely update CVS after I get the meta objects finished though. I may also fit in the vegetation system before I release alpha. How long will the above list take? Based on my current speed of development, 3 months.

I have a core list of features that I think are necessary for an engine, and they include:

1. Physics simulation, character movement, vehicles, damage, explosions, breakable objects
2. Lighting - ambient occlusion, realtime lighting and shadows. Lighting manager is required to control ambient, shadows when moving from interior to exterior
3. Trees and vegetation
4. Dynamic environment. Sky transitioning, clouds, fog, global ambient, sun position and direction, sun glare, dynamic shadows
5. Networking using ReplicaNet. Run GOOF engine in server mode where it doesn't initialize any rendering systems. Update all objects to know whether they're being created on standalone server or not.
6. Sound management, 2d sounds, 3d sounds, sound line, background music.
7. Doors, triggers, elevators
8. In-game cutscenes
9. Background loading, resource garbage collection, forced loading
10. AI framework
11. Character inventory, equipping with 3 clothing types: shared skeleton, individual skeleton, attached to bone
12. Terrain with splatting

The above will take me years unless I have help
Smile

Oh yeah, the editor is very nice now, in my opinion.

Not only did I port to wxWidgets, I fixed and added a lot of general features to the GOOF Engine Editor Tool (the tool for creating scenes for the GOOF engine).

1. Multi select objects from the selection dialog
2. Ctrl drag to box select objects in the viewport, or Alt drag to box unselect, with selection lines to show what you're selecting.
3. Option to orient objects to the normal of the collided object when in drag mode. Means you can basically drag things up walls now if you're in a room and the object, such as a painting, will orient to the wall you drag it along.
4. Redid the movement axis manipulator so it now moves to exactly where you want it to move to instead of sliding along crazily.
5. Added a line that shows what you're linking to when you are in link mode.
6. Tree view for the select dialog, with scene hierarchy
7. Ability to click and edit partition properties from the same select dialog, and shows objects under their partition with the active partition listed at the top.
8. Obviously, all the wxWidgets stuff such as window snapping, toolbar, menu, automatic viewport resizing, view menu which lists windows, redid all the open/save functionality to support a standard file dialog, etc.

Fixed tons of bugs. Undo system works now. Linking and unlinking objects fixed. Deleting multiple objects fixed when there are parent/child relationships between objects. The movement axis manipulator fixed. Fixed dragging over other objects - the object used to jump around crazily.

Probably tons more as well, but this is what I remember off the top of my head.




李锦?mybios) 2007-07-18 09:21 发表评论
]]>
关于GOOF的bug问题http://www.shnenglu.com/mybios/archive/2007/07/16/28157.html李锦?mybios)李锦?mybios)Mon, 16 Jul 2007 14:53:00 GMThttp://www.shnenglu.com/mybios/archive/2007/07/16/28157.htmlhttp://www.shnenglu.com/mybios/comments/28157.htmlhttp://www.shnenglu.com/mybios/archive/2007/07/16/28157.html#Feedback10http://www.shnenglu.com/mybios/comments/commentRss/28157.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/28157.html使用了几天GOOFQ发C存在很多bug啊,什么缓存溢出,数组界之类的。。很明显q个框架没有真正用在一个项目上的。我列D几个大问题吧。好让大家别到处壁?br />bool EnvironmentGameSystem::save(DataElementPtr element)q个函数没有实现Q所以无法保存环境信息?br />
q有
 void GridPartition::enumerateConnectedPartitions(vector<CorePartition*>& connected)
 {
  //get surrounding grid cells within a certain radius
  float loadRadius = mGridPartitionMgr->getGridCellLoadRadius();

  //enumerate partitions
  vector<CorePartition*> partitions;
  mGridPartitionMgr->enumeratePartitions(partitions);

  //iterate through and check distance
  for(vector<CorePartition*>::iterator itr = partitions.begin(); itr != partitions.end(); ++itr)
  {
   float distance = Vector3(getWorldPosition() - (*itr)->getWorldPosition()).length();
   // add by 李锦?2007-7-16
   // 不要q回自己作ؓdQ会产生bug
   if(distance < loadRadius && *itr != this)
    connected.push_back(*itr);
  }
 }

再给Z个比较严重的bug
GOOFTranslationManipulator.h中的
  // add by 李锦?2007-7-12
  // 不要用魔术数Q搞到缓存溢?br />  SceneNode* mNode[AT_LAST];
  Entity* mEnt[AT_LAST];
  Entity* mConeEnt[AT_LAST];
  CollisionShapePtr mCol[AT_LAST];
  AxisManipulatorHandle* mHandle[AT_LAST];

另外QCorePartition中的setSkyboxMaterial、setGlobalAmbient之类的代码貌似没用。准备弃之?br />


    // add by 李锦?2007-7-16
    // q个法暂时有问题,先屏蔽,以后再慢慢解?br />    //disable static geometry until it is fixed
    if(false)// getStaticGeometryRule() == SGR_ALWAYS || (getStaticGeometryRule() == SGR_WHEN_NOT_PROX_IMMEDIATE && getPartition()->getProximity() != CorePartition::PROX_IMMEDIATE))
    {
     willConvertToStaticGeometry = true;
     getPartition()->addObjectToConvertToStaticGeometry(this);
    }

李锦?mybios) 2007-07-16 22:53 发表评论
]]>
3D 引擎中的 GUI 渲染优化补完http://www.shnenglu.com/mybios/archive/2006/12/24/16795.html李锦?mybios)李锦?mybios)Sun, 24 Dec 2006 06:14:00 GMThttp://www.shnenglu.com/mybios/archive/2006/12/24/16795.htmlhttp://www.shnenglu.com/mybios/comments/16795.htmlhttp://www.shnenglu.com/mybios/archive/2006/12/24/16795.html#Feedback1http://www.shnenglu.com/mybios/comments/commentRss/16795.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/16795.html阅读全文

李锦?mybios) 2006-12-24 14:14 发表评论
]]>
3D 引擎?GUI 渲染的优?/title><link>http://www.shnenglu.com/mybios/archive/2006/12/23/16778.html</link><dc:creator>李锦?mybios)</dc:creator><author>李锦?mybios)</author><pubDate>Sat, 23 Dec 2006 14:32:00 GMT</pubDate><guid>http://www.shnenglu.com/mybios/archive/2006/12/23/16778.html</guid><wfw:comment>http://www.shnenglu.com/mybios/comments/16778.html</wfw:comment><comments>http://www.shnenglu.com/mybios/archive/2006/12/23/16778.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.shnenglu.com/mybios/comments/commentRss/16778.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/mybios/services/trackbacks/16778.html</trackback:ping><description><![CDATA[前几天的BLOG中说了一些我?D引擎GUI的渲染部分原理,q几天做到ListCtrl控g的时候,当我d很多Itemq去的时候(几乎满屏?2Px汉字Q一个汉字两个三角ŞQ相当于上万个三角Ş了)QFPS降得吓hQDebug版只?8FPSQRelease版也只有60FPS。。优化、优化、还是优化!优化之后QFPSl于辑ֈ了o人满意的500FPS左右了。且听我慢慢说来?br /><br />首先是用我的引擎内部剖析分析了代码的瓉QProfileq东西真的有用啊Q让我很Ҏ找C慢的原因Q参见GPG3 1.17《实时的层次化性能评测》)Q发现处理时间主要被Cache法和渲染两部䆾占了Q于是,我在惻I渲染慢是正常的(当时的想法比较弱智,后文有术Q,所以,我打从Cache法着手。首先是优化了ListCtrl的Cache法Q把那些在屏q外的Item的Visible属性设|成falseQ我的算法中Visible为falseQCache部分法q接蟩q)Q于是速度一下子׃来了QRelease版本辑ֈ?30FPS。但是,q是慢啊。怎么办?剖析之后Q发现大部分的处理时间都集中在渲染部分,我之前的x是渲染慢是正常的Q所以暂时无法解冟뀂。?br /><br />下班的时候,出去遛了一圈,路上H然惛_了我渲染法中另外一个跟渲染速度有关的东西,动态修攚wҎ据!N是这里的原因Q回来后马上试Q把动态修改的代码屏蔽Q直接每帧渲?0000三角形,妈呀Q?000Q的FPSQ完全否定了我之前的xQ渲染慢是正常的Q,唉,x也是Q每U千万、上亿个三角形生成速度的显卡,对于区区一万个三角形怎么会慢?..既然扑ֈ原因Q就要优化啊Q现在找到原因是因ؓ动态修攚w点导_惛_了以前看q一文章说点数据存储的位|(即CreateVertexBuffer的D3DPool参数Q,说到做到Q把原来的D3DPOOL_MANAGEDҎD3DPOOL_SYSMEMORYQ哇Q速度一下子提升?60FPS左右Q想h原因也是单的Q既然要每Lockq么多数据,那么点数据需要从昑֭->CPU处理Q然后CPU提交回显存,ȝ交换也太频繁了,如果ҎSYSMEMORY的话Q就只需要从CPU->昑֭可以了?br /><br />然后我又惻I有没有更好的优化ҎQ答案是有的。。最快的修改内存数据的方法是什么?当然是直接读写内存啊Q那么我惛_了DrawPrimitiveUPQ把点数据直接new出来Q然后DrawPrimitiveUP提交Q改成这样后Q速度再度提升Q达到惊人的500FPSQ?br /><br />最后,我把DrawPrimitiveUPҎDrawIndexedPrimitiveUPQ那么顶Ҏ量也减少了。但是奇怪的是速度~没有更快,反而慢了一点点Q慢??0FPS左右Q,但是Q我用了DrawIndexedPrimitiveUPQ我之后q有更好的优化算法准备实现。通过DrawIndexedPrimitiveUPQ但是还没做好。。所以先卖个兛_了。明天搞好的话再写Blog?br /><br />唉,回头看了下自己写的东西,׃八糟。都不知道有没有人看得懂啊。不了。知之ؓ知之Q不知ؓ不知吧。呵呵,看不懂的误Z下?br /><br />写代码去了~?img src ="http://www.shnenglu.com/mybios/aggbug/16778.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/mybios/" target="_blank">李锦?mybios)</a> 2006-12-23 22:32 <a href="http://www.shnenglu.com/mybios/archive/2006/12/23/16778.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>q段旉开?D引擎啊,正在做GUI部分http://www.shnenglu.com/mybios/archive/2006/12/19/16630.html李锦?mybios)李锦?mybios)Tue, 19 Dec 2006 13:30:00 GMThttp://www.shnenglu.com/mybios/archive/2006/12/19/16630.htmlhttp://www.shnenglu.com/mybios/comments/16630.htmlhttp://www.shnenglu.com/mybios/archive/2006/12/19/16630.html#Feedback10http://www.shnenglu.com/mybios/comments/commentRss/16630.htmlhttp://www.shnenglu.com/mybios/services/trackbacks/16630.html
接下来的一D|子里Q是时候l学3D的东西了Q于是萌生了个做游戏引擎的想法。我是个惛_做的hQ虽然我也知道自己是不自量力Q但是,只要我肯dQ即使做不好Q也L能学C西啊Q把学过的东西拿来用一番,p有感觉了?br />
说说引擎部分的构建,引擎部分的FrameWork主要参考了GPG3?.2那个框架模式Q采用Unicode~译Q感觉上那个模式比较好用Q但是太复杂了点Q于是我化了他,基本上只保留了Q务系l。用^台无关的插g方式把Win32和Direct3D9的模块做了出来(当然只封装了一部分函敎ͼQ把Ogre的基库全部拿来主义(哈哈Q主要就是数学库、工具库{等Q。而声韛_擎也留了接口Q很好扩展了?br />
然后Q现在正在做GUI部分Q主要还是说说GUI的渲染部分吧。GUI其中有两个我认ؓ比较关键的地方,其一是渲染文字部分,其二是渲染窗口部分。下面说说我的做?br />文字渲染部分Q?br />我的做法是用FreeType2dTTF文gQ然后当要渲染文字的时候,看哪个用到的文字load哪个文字Q先获得q个文字的大,然后在脓图中扑ֈ一个空闲的区域Q我的脓囑֤是512×512Q也可以讄Q,然后blt到脓图中Q真正渲染的时候就把这个脓囄理坐标脓C个三角Ş上就完成了一个文字的渲染了?br />在脓图中扄闲区域我有个比较特别的做法,是每个需要渲染的文字l护一个RefCount引用计数Q例如一个屏q里10个“我”字Q那么“我”的引用计数是10Q当“我”字不需要再渲染的时候(引用计数?Q,此文字的贴图区域可以被其他文字所覆盖?br />H口渲染部分Q?br />

class GAMECORE_EXPORT GUIRenderCache
{
protected:
    
// 不允许显式创建,只可以?/span>
    GUIRenderCache(void);
public:
    
virtual ~GUIRenderCache(void);

    
// d到渲染队?/span>
    void AddCache(const GUIRenderQuad& quad)
    
{
        m_vtGUIRenderQuad.insert(GUIRenderQuadPtr(
new GUIRenderQuad(quad)));
    }



    
// 渲染需要Cache队列
    void RenderCache(void)
    
{
        
// 从新Cache队列
        if(m_bDirty)
        
{
            ClearCacheList();
            DoCache();
            m_bDirty 
= false;
        }

        
// d到渲染器
        for(VectorGUIRenderQuad::const_iterator iter = m_vtGUIRenderQuad.begin() ; iter != m_vtGUIRenderQuad.end() ; iter ++)
        
{
            Systems::GetSingleton().GetGUIRendererSystem()
->AddCache(*iter);
        }

    }

    
// 清空cache队列
    void ClearCacheList(void)
    
{
        m_vtGUIRenderQuad.clear();
    }

protected:

    
// Cache需要渲染的目
    virtual void DoCache(){};

    VectorGUIRenderQuad m_vtGUIRenderQuad;    
// 渲染队列
    bool m_bDirty; // 需要重新Cache需要渲染的目
}
;



每个WindowQ一个Window是一个抽象类QStatic/Button/Dialog{等所有窗口都是承于WindowQ都l承于GUIRenderCache对象Q当H口的某个属性(如WindowTextQ改变时Q就会把m_bDirty标记讄成true。每帧渲染的时候调用RenderCache。那么如果窗口的属性没有改变,只需要把m_vtGUIRenderQuad的东西渲染出来;如果属性改变了Q即m_bDirty为trueQ,则调用DoCacheQ由l承c(如Static/Button{)改写q个函数Q计脓囑֝标、三角Ş坐标{等东西都放在这个函数里。ȝ来说QCache之后速度会比Cache之前快v码一半以上?br />
好了Q睡觉去了?img src ="http://www.shnenglu.com/mybios/aggbug/16630.html" width = "1" height = "1" />

李锦?mybios) 2006-12-19 21:30 发表评论
]]>
ƯޱгĻþ| 99þþƷһѿ| þۺĻ| Ʒþþþþһ| ˾þþƷavһ| ĻƷþþþ| ޹˾þһҳ| ˾þ| ٸþĻ| þþþseɫ͵͵޾Ʒav| ݺɫۺվþþþþþø | 97ȾþƵƷ99| 7777þĻ| ƷƵþ| ˾þþƷ| LƷþ| ξþ99Ʒþþþþ| ɫۺϾþ| þþ㽶ۺϼձ| þùƷӰԺ| ھƷþþþþþ| ھƷþ鶹Ħ| ھƷþþӰԺ| vavavaþ| þ91ۺϹ91þþƷ| ഺþ| www.þ.com| ݺɫþۺ_| þþþþþ97| ŷһþþþþþôƬ| þþƷ޾Ʒɫ | 91Ʒ91Ⱦþþþø | ͵þþþƷר| ޹þþþþþ| ƷһþþƷɬ | þþƷAV뽿ɫ| þþƷһ| 77777ҹþö| Ʒݾþþþø99 | ޹þþۺվ| þþþþþòҰ¸߳|