use newly FirstPersonCameraControl

This commit is contained in:
hyzboy 2022-01-26 11:00:47 +08:00
parent 5d368a689d
commit 850602d74c
5 changed files with 13 additions and 14 deletions

2
CMCore

@ -1 +1 @@
Subproject commit 6280ace5a5a27edb6dab026be2a323a21dca63d8
Subproject commit 14da094013b5a33b95f2b24afdf44fb5ba008d40

@ -1 +1 @@
Subproject commit 569fc6c9ca5fbba277a70044871f2af045f2c6db
Subproject commit 04a2736bac9fe0b8c9c84d4dedd5e455071e4e64

View File

@ -404,8 +404,8 @@ public:
lights.color = Vector4f(15.0f);
lights.radius = 155.0f;
lights.position.x = sin(hgl_rad2deg(timer/100)) * 100.0f;
lights.position.y = cos(hgl_rad2deg(timer/100)) * 100.0f;
lights.position.x = sin(rad2deg(timer/100)) * 100.0f;
lights.position.y = cos(rad2deg(timer/100)) * 100.0f;
ubo_lights->Write(&lights);
}

View File

@ -363,9 +363,9 @@ protected:
return(true);
}
bool OnWheel(int v,int h)
bool OnWheel(int x,int y)
{
//camera->Distance(1+(h/1000.0f));
camera->Distance(y>1.0f?1.1f:0.9f);
return(true);
}
@ -424,11 +424,10 @@ public:
camera->vp_width=w;
camera->vp_height=h;
camera->pos=Vector4f(10,10,10,1);
camera->pos=Vector3f(10,10,10);
camera_control=new FirstPersonCameraControl(camera);
//camera_control->target=Vector4f(0,0,0,1);
camera_control->Refresh(); //更新矩阵计算
ubo_camera_info=db->CreateUBO(sizeof(CameraInfo),&camera->info);

View File

@ -74,8 +74,8 @@ namespace hgl
{
float ang=float(i)/float(rci->round_per-1)*90.0f;
float x=sin(hgl_deg2rad(ang))*radius;
float y=cos(hgl_deg2rad(ang))*radius;
float x=sin(deg2rad(ang))*radius;
float y=cos(deg2rad(ang))*radius;
coord[i].x=x;
coord[i].y=y;
@ -148,8 +148,8 @@ namespace hgl
{
float ang=float(i)/float(cci->field_count)*360.0f;
float x=cci->center.x+sin(hgl_deg2rad(ang))*cci->radius.x;
float y=cci->center.y+cos(hgl_deg2rad(ang))*cci->radius.y;
float x=cci->center.x+sin(deg2rad(ang))*cci->radius.x;
float y=cci->center.y+cos(deg2rad(ang))*cci->radius.y;
vertex->Write(x,y);
@ -373,7 +373,7 @@ namespace hgl
void glusQuaternionRotateRyf(float quaternion[4], const float angle)
{
float halfAngleRadian = hgl_deg2rad(angle) * 0.5f;
float halfAngleRadian = deg2rad(angle) * 0.5f;
quaternion[0] = 0.0f;
quaternion[1] = sin(halfAngleRadian);
@ -383,7 +383,7 @@ namespace hgl
void glusQuaternionRotateRzf(float quaternion[4], const float angle)
{
float halfAngleRadian = hgl_deg2rad(angle) * 0.5f;
float halfAngleRadian = deg2rad(angle) * 0.5f;
quaternion[0] = 0.0f;
quaternion[1] = 0.0f;