Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
共5页: 1 2 3 4 5 
re: Loki技法5-TypeMap ccsdu2009 2010-04-19 11:59
@空明流转
我现在已经不大使用boost了
这个东西大的出奇
(当然我只在底层使用若干子库)
re: Loki技法5-TypeMap ccsdu2009 2010-04-19 11:58
@luoweisong
我不太懂如何配置颜色
有空你可以教教我如何设置
re: Loki技法3-Typelist(2) ccsdu2009 2010-04-17 19:51
@tiny
boost是个庞然大物
loki比较小

@陈梓瀚(vczh)
这是随便写的
不错
从纯技术的观点说也许使用ffmpeg感觉没多大挑战性
但是从商业角度考虑 能复用别人的东西则更好
从非流媒体工程师而言 基于这些第三方库是最好的选择
我使用过vlc,ffmpeg
re: loki技法(2).CheckReturn ccsdu2009 2010-04-13 19:19
@欲三更
不一定
@蚂蚁终结者
boost里面有这个东西
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工厂等其他几个模块的基础
虽然这里还没有看出其实际的用途
re: loki技法(1).静态断言 ccsdu2009 2010-04-09 08:24
@欲三更
恩 这个很有可能
@expter
从理论上讲多线程打包似乎不可行
因为这是个写操作
re: loki技法(2).CheckReturn ccsdu2009 2010-04-07 14:16
@~
似乎不大可能使用模板编译时提供代码测试吧
@expter
no
当前只处理资源"解包"
这个以后会加入的
re: 对 C++ 历史的个人观点 ccsdu2009 2010-04-07 08:40
搞不明白的是很多国人做ppt总喜欢搞英文的 纳闷
和libxml相比如何?
re: loki技法(2).CheckReturn ccsdu2009 2010-04-06 14:28
@欣萌
据我个人看法 这个应该于代码测试有关
如果测试的时候检查了函数返回值则不会有问题
如果没有检测函数返回值则根据定制规则做处理
re: loki技法(2).CheckReturn ccsdu2009 2010-04-06 11:14
不过我觉得这种方法实际意义似乎很小
先简后难啊
re: loki技法(1).静态断言 ccsdu2009 2010-04-01 21:53
说实话 我感觉这个设计的很巧妙
联合使用模板特化和前向声明来
@清风
这是当然
不过当前使用多线程计算粒子数据 可以弥补一点损失
线程实现和平台有关
@ahfu
呵呵 你观察的很仔细 是的
@陈梓瀚(vczh)
hehe
@陈梓瀚(vczh)
那对象的动态生成呢?
@陈梓瀚(vczh)
那你觉得应该如何书写之?
@陈昱(CY)
你看过irr引擎吗?
map的erase有三个版本
 1 关于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~
@cui
谢谢
完成功能是第一要务
效率是其次的
////////////////////////////////////////////////////////////
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 }
贴图次序反了
@陈梓瀚(vczh)
其存在的必要是为物理引擎Demo做准备的
函数和这个例子一样都是暂时的
@陈梓瀚(vczh)
xiexie
你弄得这个脚本引擎最大优点是什么?
好的话我可以拿去作为引擎备用脚本引擎
re: 洗牌的学问 ccsdu2009 2010-02-25 20:59
呵呵 看到问题我首先想到的就是std::random_shuffle
不过文章结尾很有意思
re: sigslot简介 ccsdu2009 2010-02-25 17:24
呵呵 你也关注过这个库啊
其实不考虑线程安全的话
gui库glooey总改造了的sigslot是很简单的
@sanit
没问题的
boost中就有array!
@陈梓瀚(vczh)
StrToInt? 有这个函数?
re: Vczh Library++3.0 开源啦! ccsdu2009 2010-02-22 14:53
这是做什么的啊?
引擎只在底层使用boost并没有在头文件中使用之
一个重要的原因就是为了提高代码的可读性
引擎是给别人使用的
保持良好的可读性是十分重要的
re: 人工智能——弈心1.0.1.4 ccsdu2009 2010-02-09 18:40
棋力不错
 1 ////////////////////////////////////////////////////////////
 2 /// 坐标轴枚举
 3 //////////////////////////////////////////////////////////// 
 4 enum AXIS_TYPE
 5 {
 6     AXIS_X = 1,
 7     AXIS_Y = 1 << 2,
 8     AXIS_Z = 1 << 4 
 9 };
10 
11 ////////////////////////////////////////////////////////////
12 /// 坐标轴方向枚举
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要钱的 不打算使用之
在涉及渲染的时候会有问题
我修改了下
 1 
 2 ///////////////////////////////////////////////////////
 3 /// 定义引擎场景节点基类
 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     /// 构造,析构场景节点
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     /// 场景渲染虚函数
22     ///////////////////////////////////////////////////////            
23     virtual void BeginRender();
24     virtual void Render();
25     virtual void AfterRender(); 
26     
27     ///////////////////////////////////////////////////////
28     /// 节点操作
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     /// 获取,设置场景矩阵
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     /// 场景平移,缩放,旋转(子场景矩阵也会发生变化)
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     /// 获取,设置场景盒子,球
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来存储场景
当然不存在重复名字的场景是最基本的前体
这个东西写的很有问题!
re: c++单态的一个变种实现 ccsdu2009 2010-02-06 10:57
恩 后面的逗号是多余的 谢谢

双模板好处? 1个是可以避免针对纯虚的单态构造对象
我不太喜欢写字丷丷
re: c++单态的一个变种实现 ccsdu2009 2010-02-05 20:32
比如:
Singleton<Audio,OpenALAudio>;
Singleton<Window,LinuxWindow>;
re: 盖莫引擎的矩阵模板实现 ccsdu2009 2010-02-05 19:55
@陈梓瀚(vczh)
呵呵? 是先获取行列式值的然后求逆矩阵的
这个是我先在mat上面弄得之后复制到
不过求逆矩的确比较烦
这还没考虑病态矩阵
谢谢你的提醒
只是我对opengl不是太熟悉
不这样做的话画面会抖动
还没来得及找原因
共5页: 1 2 3 4 5