小编Des*_*air的帖子

gluPerspective参数 - 它们是什么意思?

我想知道gluPerspective参数.

在我看到的所有例子中fovy都设置为大约45-60度,我试图将其设置为不同的值,对象只是消失了对它的解释?

aspect值应始终比例是多少?为什么要改变它?

zNear, zFar - 再次通常的值大约是10和500+它反映的是什么?

opengl perspectivecamera perspective

42
推荐指数
1
解决办法
3万
查看次数

C++ Map <>.find()为不同的类重载

我尝试使用定义为的地图:

    map<Vertex,unsigned int> _addedVertices; 
Run Code Online (Sandbox Code Playgroud)

现在,当我使用find函数检查顶点是否已经在里面时,我得到一个迭代器到一个具有不同信息的错误顶点,所以我尝试了以下内容:

    map<Vertex,unsigned int,cmpByVertexFields> _addedVertices; 
Run Code Online (Sandbox Code Playgroud)

这没有帮助.

我在Vertex类中有以下重载函数.

    bool operator<(const Vertex &otherV)const{
        return(_x<otherV._x && _y<otherV._y && _z<otherV._z);
    }
    bool operator==(const Vertex &otherV)const{
        return _x==otherV._x && _y==otherV._y && _z==otherV._z;
    }
Run Code Online (Sandbox Code Playgroud)

但没有任何作用.示例:我插入了一个包含(0.2,0.1,0.4)的顶点,接下来我使用的是查找函数(0.2,0.15,0.41)我得到的迭代器是第一个顶点而不是map.end().

我忘了定义什么?谢谢

编辑:cmpByVertexFields:

struct cmpByVertexFields {
    bool operator()(const Vertex& a, const Vertex& b) const {
        return a.getX()==b.getX() &&
            a.getY()==b.getY() &&
            a.getZ()==b.getZ();
    }
};
Run Code Online (Sandbox Code Playgroud)

c++ operator-overloading map

3
推荐指数
1
解决办法
1813
查看次数