【发布时间】:2015-12-06 00:18:23
【问题描述】:
所以我正在为一个 OpenGL 程序创建一个 Camera 类,并且我遇到了一个带有基本 C++ 代码的问题,我不允许使用值对其进行初始化。我的实现如下:
class Camera{
public:
Camera();
Camera(vec3 pos(), vec3 fron(), vec3 up(), GLfloat y, GLfloat p, GLfloat r);
...
};
Camera::Camera(vec3 pos(), vec3 fron(), vec3 up(), GLfloat y, GLfloat p, GLfloat r)
{
cout << "Hello World" << endl;
}
其余的在我的主目录中:
int main(){
GLfloat lastx = width/2.0f;
GLfloat lasty = height/2.0f;
GLfloat yaw = 90.0f; //yaw set to -90 because yaw of 0.0 points to right or something wierd happens in euler angles
GLfloat pitch = 0.0f;
vec3 camerapos = vec3(0.0f, 0.5f, -10.0f);
vec3 camerafront = vec3(0.0f, 0.5f, 1.0f);
vec3 cameraup = vec3(0.0f, 1.0f, 0.0f);
Camera cam(camerapos, camerafront, cameraup, yaw, pitch, GLfloat(0.0f));
}
奇怪的是,我尝试将它初始化为空,然后填充它(请注意,使用相同的函数),但我将其命名为 init()。那时,我被告知该变量必须具有 Classtype。
有什么明显的东西在盯着我看?
【问题讨论】: