re: Loki技法5-TypeMap ccsdu2009 2010-04-19 11:59
@空明流轉(zhuǎn)
我現(xiàn)在已經(jīng)不大使用boost了
這個(gè)東西大的出奇
(當(dāng)然我只在底層使用若干子庫)
re: Loki技法5-TypeMap ccsdu2009 2010-04-19 11:58
@luoweisong
我不太懂如何配置顏色
有空你可以教教我如何設(shè)置
re: Loki技法3-Typelist(2) ccsdu2009 2010-04-17 19:51
@tiny
boost是個(gè)龐然大物
loki比較小
從純技術(shù)的觀點(diǎn)說也許使用ffmpeg感覺沒多大挑戰(zhàn)性
但是從商業(yè)角度考慮 能復(fù)用別人的東西則更好
從非流媒體工程師而言 基于這些第三方庫是最好的選擇
我使用過vlc,ffmpeg
re: loki技法(2).CheckReturn ccsdu2009 2010-04-13 19:19
@欲三更
不一定
@螞蟻終結(jié)者
boost里面有這個(gè)東西
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
(void) sizeof(type_must_be_complete);
delete x;
re: Loki技法3-Typelist(1) ccsdu2009 2010-04-10 12:36
TypeList是Loki工廠等其他幾個(gè)模塊的基礎(chǔ)
雖然這里還沒有看出其實(shí)際的用途
re: loki技法(1).靜態(tài)斷言 ccsdu2009 2010-04-09 08:24
@欲三更
恩 這個(gè)很有可能
re: 蓋莫游戲引擎2.1.1-多線程資源載入類 ccsdu2009 2010-04-07 18:31
@expter
從理論上講多線程打包似乎不可行
因?yàn)檫@是個(gè)寫操作
re: loki技法(2).CheckReturn ccsdu2009 2010-04-07 14:16
@~
似乎不大可能使用模板編譯時(shí)提供代碼測試吧
re: 蓋莫游戲引擎2.1.1-多線程資源載入類 ccsdu2009 2010-04-07 08:43
@expter
no
當(dāng)前只處理資源"解包"
這個(gè)以后會加入的
re: 對 C++ 歷史的個(gè)人觀點(diǎn) ccsdu2009 2010-04-07 08:40
搞不明白的是很多國人做ppt總喜歡搞英文的 納悶
re: 你不再需要TinyXML,推薦RapidXML ccsdu2009 2010-04-06 19:58
和libxml相比如何?
re: loki技法(2).CheckReturn ccsdu2009 2010-04-06 14:28
@欣萌
據(jù)我個(gè)人看法 這個(gè)應(yīng)該于代碼測試有關(guān)
如果測試的時(shí)候檢查了函數(shù)返回值則不會有問題
如果沒有檢測函數(shù)返回值則根據(jù)定制規(guī)則做處理
re: loki技法(2).CheckReturn ccsdu2009 2010-04-06 11:14
不過我覺得這種方法實(shí)際意義似乎很小
re: loki技法(1).靜態(tài)斷言 ccsdu2009 2010-04-01 21:53
說實(shí)話 我感覺這個(gè)設(shè)計(jì)的很巧妙
聯(lián)合使用模板特化和前向聲明來
@清風(fēng)
這是當(dāng)然
不過當(dāng)前使用多線程計(jì)算粒子數(shù)據(jù) 可以彌補(bǔ)一點(diǎn)損失
線程實(shí)現(xiàn)和平臺有關(guān)
re: 蓋莫游戲引擎的對象基類設(shè)計(jì) ccsdu2009 2010-03-21 17:15
@陳梓瀚(vczh)
那對象的動態(tài)生成呢?
@陳梓瀚(vczh)
那你覺得應(yīng)該如何書寫之?
re: 蓋莫游戲引擎中的范管理器類 ccsdu2009 2010-03-09 15:51
map的erase有三個(gè)版本
1 關(guān)于map的erase
2 void
3 erase(iterator __position)
4 { _M_t.erase(__position); }
5
6 /**
7 * @brief Erases elements according to the provided key.
8 * @param x Key of element to be erased.
9 * @return The number of elements erased.
10 *
11 * This function erases all the elements located by the given key from
12 * a %map.
13 * Note that this function only erases the element, and that if
14 * the element is itself a pointer, the pointed-to memory is not touched
15 * in any way. Managing the pointer is the user's responsibilty.
16 */
17 size_type
18 erase(const key_type& __x)
19 { return _M_t.erase(__x); }
20
21 /**
22 * @brief Erases a [first,last) range of elements from a %map.
23 * @param first Iterator pointing to the start of the range to be
24 * erased.
25 * @param last Iterator pointing to the end of the range to be erased.
26 *
27 * This function erases a sequence of elements from a %map.
28 * Note that this function only erases the element, and that if
29 * the element is itself a pointer, the pointed-to memory is not touched
30 * in any way. Managing the pointer is the user's responsibilty.
31 */
32 void
33 erase(iterator __first, iterator __last)
34 { _M_t.erase(__first, __last); }
我以前只注意到map.erase(itr);
謝謝提醒O(∩_∩)O~
re: 蓋莫游戲引擎中的范管理器類 ccsdu2009 2010-03-09 10:58
@cui
謝謝
完成功能是第一要務(wù)
效率是其次的
re: 蓋莫游戲引擎中的范管理器類 ccsdu2009 2010-03-08 20:53
////////////////////////////////////////////////////////////
49 /// 銷毀指定名字的對象
50 ////////////////////////////////////////////////////////////
51 inline bool KillObject(const Type& name)
52 {
53 std::map<std::string,RefPtr<Model> >::iterator itr = objects.find(name);
54 if(itr == objects.end())
55 return false;
56 objects.erase(name);
57 return true;
58 }
re: 使用蓋莫游戲引擎繪制立方體 ccsdu2009 2010-03-03 15:47
@陳梓瀚(vczh)
其存在的必要是為物理引擎Demo做準(zhǔn)備的
函數(shù)和這個(gè)例子一樣都是暫時(shí)的
re: 使用簡單腳本配置下的天空盒和地形測試[未登錄] ccsdu2009 2010-03-03 14:37
@陳梓瀚(vczh)
xiexie
你弄得這個(gè)腳本引擎最大優(yōu)點(diǎn)是什么?
好的話我可以拿去作為引擎?zhèn)溆媚_本引擎
re: 洗牌的學(xué)問 ccsdu2009 2010-02-25 20:59
呵呵 看到問題我首先想到的就是std::random_shuffle
不過文章結(jié)尾很有意思
re: sigslot簡介 ccsdu2009 2010-02-25 17:24
呵呵 你也關(guān)注過這個(gè)庫啊
其實(shí)不考慮線程安全的話
gui庫glooey總改造了的sigslot是很簡單的
re: 封裝固定長度字符數(shù)組的模板容器類 ccsdu2009 2010-02-23 18:48
boost中就有array!
re: 蓋莫游戲引擎中的便利宏和及幾個(gè)小類 ccsdu2009 2010-02-22 14:56
@陳梓瀚(vczh)
StrToInt? 有這個(gè)函數(shù)?
re: Vczh Library++3.0 開源啦! ccsdu2009 2010-02-22 14:53
這是做什么的啊?
re: 蓋莫游戲引擎中的便利宏和及幾個(gè)小類 ccsdu2009 2010-02-10 15:18
引擎只在底層使用boost并沒有在頭文件中使用之
一個(gè)重要的原因就是為了提高代碼的可讀性
引擎是給別人使用的
保持良好的可讀性是十分重要的
re: 人工智能——弈心1.0.1.4 ccsdu2009 2010-02-09 18:40
棋力不錯(cuò)
1 ////////////////////////////////////////////////////////////
2 /// 坐標(biāo)軸枚舉
3 ////////////////////////////////////////////////////////////
4 enum AXIS_TYPE
5 {
6 AXIS_X = 1,
7 AXIS_Y = 1 << 2,
8 AXIS_Z = 1 << 4
9 };
10
11 ////////////////////////////////////////////////////////////
12 /// 坐標(biāo)軸方向枚舉
13 ////////////////////////////////////////////////////////////
14 enum AXIS_DIRECTION
15 {
16 AXIS_DIRECTION_UP = 1,
17 AXIS_DIRECTION_DOWN = -1
18 };
re: 蓋莫游戲引擎音頻測試 ccsdu2009 2010-02-08 20:00
@陳梓瀚(vczh)
fmod要錢的 不打算使用之
在涉及渲染的時(shí)候會有問題
我修改了下
1
2 ///////////////////////////////////////////////////////
3 /// 定義引擎場景節(jié)點(diǎn)基類
4 ///////////////////////////////////////////////////////
5 class G_DLL_API SceneNode : public Object, public Parent<RefPtr<SceneNode> >, public Renderable
6 {
7 public:
8 typedef std::map<const std::string,RefPtr<SceneNode> > SceneList;
9 typedef std::map<const std::string,RefPtr<SceneNode> >::iterator SceneItr;
10 public:
11 ///////////////////////////////////////////////////////
12 /// 構(gòu)造,析構(gòu)場景節(jié)點(diǎn)
13 ///////////////////////////////////////////////////////
14 inline SceneNode(){}
15 inline SceneNode(RefPtr<SceneNode> parent):Parent<RefPtr<SceneNode> >(parent){}
16 inline SceneNode(const Matrix4f &matrix):world_matrix(matrix){}
17 inline SceneNode(RefPtr<SceneNode> parent,const Matrix4f &matrix):Parent<RefPtr<SceneNode> >(parent),world_matrix(matrix){}
18 virtual ~SceneNode();
19 public:
20 ///////////////////////////////////////////////////////
21 /// 場景渲染虛函數(shù)
22 ///////////////////////////////////////////////////////
23 virtual void BeginRender();
24 virtual void Render();
25 virtual void AfterRender();
26
27 ///////////////////////////////////////////////////////
28 /// 節(jié)點(diǎn)操作
29 ///////////////////////////////////////////////////////
30 void PushScene(RefPtr<SceneNode> child);
31 bool PopScene(RefPtr<SceneNode> child);
32 void ClearAllScene();
33 void ClearAllSceneRecursive();
34 uint GetSceneCount(){return children.size();}
35 RefPtr<SceneNode> GetScene(const std::string &name);
36
37 ///////////////////////////////////////////////////////
38 /// 獲取,設(shè)置場景矩陣
39 ///////////////////////////////////////////////////////
40 inline Matrix4f GetWorldMatrix()const{return world_matrix;}
41 //!inline Matrix4f SetWorldMatrix(const Matrix4f &matrix){this->world_matrix = matrix;}
42 inline Matrix4f GetLocalMatrix()const{return local_matrix;}
43 //!inline Matrix4f SetLocalMatrix(const Matrix4f &matrix){this->local_matrix = matrix;}
44
45 ///////////////////////////////////////////////////////
46 /// 場景平移,縮放,旋轉(zhuǎn)(子場景矩陣也會發(fā)生變化)
47 ///////////////////////////////////////////////////////
48 void Translate(const Vector3f &offset);
49 void Scale(const Vector3f &scale);
50 void Rotate(float angle, float x, float y, float z);
51
52 ///////////////////////////////////////////////////////
53 /// 獲取,設(shè)置場景盒子,球
54 ///////////////////////////////////////////////////////
55 inline Box GetSceneBox()const{return box;}
56 inline void SetSceneBox(const Box &box){this->box = box;}
57 inline Spheref GetSceneSphere()const{return shpere;}
58 inline void SetSceneSphere(const Spheref &sphere){this->shpere = sphere;}
59 protected:
60 SceneList children;
61 Matrix4f world_matrix;
62 Matrix4f local_matrix;
63 Box box;
64 Spheref shpere;
65
66 DECLARE_OBJECT(SceneNode);
67 };
68
如下:
使用std::map來存儲場景
當(dāng)然不存在重復(fù)名字的場景是最基本的前體
恩 后面的逗號是多余的 謝謝
雙模板好處? 1個(gè)是可以避免針對純虛的單態(tài)構(gòu)造對象
我不太喜歡寫字丷丷
比如:
Singleton<Audio,OpenALAudio>;
Singleton<Window,LinuxWindow>;
re: 蓋莫引擎的矩陣模板實(shí)現(xiàn) ccsdu2009 2010-02-05 19:55
@陳梓瀚(vczh)
呵呵? 是先獲取行列式值的然后求逆矩陣的
這個(gè)是我先在mat上面弄得之后復(fù)制到
不過求逆矩的確比較煩
這還沒考慮病態(tài)矩陣
re: 使用蓋莫游戲引擎做的天空面 ccsdu2009 2010-02-05 15:25
謝謝你的提醒
只是我對opengl不是太熟悉
不這樣做的話畫面會抖動
還沒來得及找原因