示例#1
0
 private static void ObjCameraGetTargetUpTargetCamera(
     AppMain.OBS_CAMERA obj_camera,
     AppMain.NNS_CAMERA_TARGET_UPTARGET tupt_camera)
 {
     tupt_camera.User       = 0U;
     tupt_camera.Fovy       = obj_camera.fovy;
     tupt_camera.Aspect     = obj_camera.aspect;
     tupt_camera.ZNear      = obj_camera.znear;
     tupt_camera.ZFar       = obj_camera.zfar;
     tupt_camera.Position.x = obj_camera.disp_pos.x;
     tupt_camera.Position.y = obj_camera.disp_pos.y;
     tupt_camera.Position.z = obj_camera.disp_pos.z;
     if (obj_camera.camup_obj != null)
     {
         tupt_camera.Target.x = AppMain.FXM_FX32_TO_FLOAT(obj_camera.camup_obj.pos.x);
         tupt_camera.Target.y = AppMain.FXM_FX32_TO_FLOAT(obj_camera.camup_obj.pos.y);
         tupt_camera.Target.z = AppMain.FXM_FX32_TO_FLOAT(obj_camera.camup_obj.pos.z);
     }
     else
     {
         tupt_camera.Target.x = obj_camera.camup_pos.x;
         tupt_camera.Target.y = obj_camera.camup_pos.y;
         tupt_camera.Target.z = obj_camera.camup_pos.z;
     }
 }
示例#2
0
    private static void ObjCamera3dInit(int cam_id)
    {
        if (AppMain.obj_camera_sys == null)
        {
            return;
        }
        if (AppMain.obj_camera_sys.obj_camera[cam_id] == null)
        {
            AppMain.NNS_VECTOR pos = new AppMain.NNS_VECTOR();
            if (AppMain.ObjCameraInit(cam_id, pos, 0, (ushort)0, 61438) == -1)
            {
                return;
            }
            //AppMain.GlobalPool<AppMain.NNS_VECTOR>.Release(pos);
        }
        AppMain.OBS_CAMERA obj_camera = AppMain.obj_camera_sys.obj_camera[cam_id];
        obj_camera.flag  |= 16U;
        obj_camera.znear  = 1f;
        obj_camera.zfar   = 60000f;
        obj_camera.aspect = AppMain.AMD_SCREEN_ASPECT;
        obj_camera.fovy   = AppMain.NNM_DEGtoA32(45f);
        AppMain.nnMakePerspectiveMatrix(obj_camera.prj_pers_mtx, obj_camera.fovy, obj_camera.aspect, obj_camera.znear, obj_camera.zfar);
        obj_camera.scale = 5f / 64f;
        float num1 = (float)((double)AppMain.g_obj.disp_height * (double)obj_camera.scale * 0.5 * 1.0);
        float num2 = num1 * obj_camera.aspect;

        obj_camera.left   = -num2;
        obj_camera.right  = num2;
        obj_camera.bottom = -num1;
        obj_camera.top    = num1;
        AppMain.nnMakeOrthoMatrix(obj_camera.prj_ortho_mtx, obj_camera.left, obj_camera.right, obj_camera.bottom, obj_camera.top, obj_camera.znear, obj_camera.zfar);
        switch (obj_camera.camera_type)
        {
        case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_ROLL:
            AppMain.NNS_CAMERA_TARGET_ROLL cameraTargetRoll = new AppMain.NNS_CAMERA_TARGET_ROLL();
            AppMain.ObjCameraGetTargetRollCamera(obj_camera, cameraTargetRoll);
            AppMain.nnMakeTargetRollCameraViewMatrix(obj_camera.view_mtx, cameraTargetRoll);
            break;

        case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_TARGET:
            AppMain.NNS_CAMERA_TARGET_UPTARGET cameraTargetUptarget = new AppMain.NNS_CAMERA_TARGET_UPTARGET();
            AppMain.ObjCameraGetTargetUpTargetCamera(obj_camera, cameraTargetUptarget);
            AppMain.nnMakeTargetUpTargetCameraViewMatrix(obj_camera.view_mtx, cameraTargetUptarget);
            break;

        case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_VEC:
            AppMain.NNS_CAMERA_TARGET_UPVECTOR cameraTargetUpvector = new AppMain.NNS_CAMERA_TARGET_UPVECTOR();
            AppMain.ObjCameraGetTargetUpVecCamera(obj_camera, cameraTargetUpvector);
            AppMain.nnMakeTargetUpVectorCameraViewMatrix(obj_camera.view_mtx, cameraTargetUpvector);
            break;
        }
    }
    // Token: 0x06000133 RID: 307 RVA: 0x0000D868 File Offset: 0x0000BA68
    private static void objCameraMain(AppMain.MTS_TASK_TCB tcb)
    {
        if (AppMain.ObjObjectPauseCheck(0U) != 0U)
        {
            return;
        }
        AppMain.NNS_VECTOR nns_VECTOR = AppMain.GlobalPool <AppMain.NNS_VECTOR> .Alloc();

        for (int i = 0; i < 8; i++)
        {
            AppMain.OBS_CAMERA obs_CAMERA = AppMain.obj_camera_sys.obj_camera[i];
            if (obs_CAMERA != null)
            {
                obs_CAMERA.prev_disp_pos.x = obs_CAMERA.disp_pos.x;
                obs_CAMERA.prev_disp_pos.y = obs_CAMERA.disp_pos.y;
                obs_CAMERA.prev_disp_pos.z = obs_CAMERA.disp_pos.z;
                if (obs_CAMERA.user_func != null)
                {
                    obs_CAMERA.user_func(obs_CAMERA);
                }
                else
                {
                    if ((obs_CAMERA.flag & 4U) != 0U)
                    {
                        AppMain.objCameraMove(obs_CAMERA);
                    }
                    nns_VECTOR.x = obs_CAMERA.pos.x;
                    nns_VECTOR.y = obs_CAMERA.pos.y;
                    nns_VECTOR.z = obs_CAMERA.pos.z;
                    if ((obs_CAMERA.flag & 8U) != 0U)
                    {
                        nns_VECTOR.x -= (nns_VECTOR.x - obs_CAMERA.work.x) * 2f;
                        nns_VECTOR.y -= (nns_VECTOR.y - obs_CAMERA.work.y) * 2f;
                        nns_VECTOR.z -= (nns_VECTOR.z - obs_CAMERA.work.z) * 2f;
                    }
                    obs_CAMERA.disp_pos.x = nns_VECTOR.x + obs_CAMERA.ofst.x;
                    obs_CAMERA.disp_pos.y = nns_VECTOR.y + obs_CAMERA.ofst.y;
                    obs_CAMERA.disp_pos.z = nns_VECTOR.z + obs_CAMERA.ofst.z;
                }
                if ((obs_CAMERA.flag & 32U) != 0U)
                {
                    AppMain.objCameraLimitCheck(obs_CAMERA);
                }
                obs_CAMERA.disp_pos.x += obs_CAMERA.disp_ofst.x;
                obs_CAMERA.disp_pos.y += obs_CAMERA.disp_ofst.y;
                obs_CAMERA.disp_pos.z += obs_CAMERA.disp_ofst.z;
                obs_CAMERA.disp_ofst.x = 0f;
                obs_CAMERA.disp_ofst.y = 0f;
                obs_CAMERA.disp_ofst.z = 0f;
                if ((obs_CAMERA.flag & 16U) != 0U)
                {
                    AppMain.nnMakePerspectiveMatrix(obs_CAMERA.prj_pers_mtx, obs_CAMERA.fovy, obs_CAMERA.aspect, obs_CAMERA.znear, obs_CAMERA.zfar);
                    float num  = AppMain.AMD_SCREEN_2D_WIDTH * obs_CAMERA.scale * 0.5f * 1f;
                    float num2 = num * obs_CAMERA.aspect;
                    obs_CAMERA.left   = -num2;
                    obs_CAMERA.right  = num2;
                    obs_CAMERA.bottom = -num;
                    obs_CAMERA.top    = num;
                    AppMain.nnMakeOrthoMatrix(obs_CAMERA.prj_ortho_mtx, obs_CAMERA.left, obs_CAMERA.right, obs_CAMERA.bottom, obs_CAMERA.top, obs_CAMERA.znear, obs_CAMERA.zfar);
                    switch (obs_CAMERA.camera_type)
                    {
                    case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_ROLL:
                    {
                        AppMain.NNS_CAMERA_TARGET_ROLL nns_CAMERA_TARGET_ROLL = AppMain.GlobalPool <AppMain.NNS_CAMERA_TARGET_ROLL> .Alloc();

                        int roll = obs_CAMERA.roll;
                        if ((obs_CAMERA.flag & 1073741824U) != 0U)
                        {
                            obs_CAMERA.roll = 0;
                        }
                        AppMain.ObjCameraGetTargetRollCamera(obs_CAMERA, nns_CAMERA_TARGET_ROLL);
                        AppMain.nnMakeTargetRollCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_ROLL);
                        obs_CAMERA.roll = roll;
                        AppMain.GlobalPool <AppMain.NNS_CAMERA_TARGET_ROLL> .Release(nns_CAMERA_TARGET_ROLL);

                        break;
                    }

                    case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_TARGET:
                    {
                        AppMain.NNS_CAMERA_TARGET_UPTARGET nns_CAMERA_TARGET_UPTARGET = new AppMain.NNS_CAMERA_TARGET_UPTARGET();
                        AppMain.ObjCameraGetTargetUpTargetCamera(obs_CAMERA, nns_CAMERA_TARGET_UPTARGET);
                        AppMain.nnMakeTargetUpTargetCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_UPTARGET);
                        break;
                    }

                    case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_VEC:
                    {
                        AppMain.NNS_CAMERA_TARGET_UPVECTOR nns_CAMERA_TARGET_UPVECTOR = new AppMain.NNS_CAMERA_TARGET_UPVECTOR();
                        AppMain.ObjCameraGetTargetUpVecCamera(obs_CAMERA, nns_CAMERA_TARGET_UPVECTOR);
                        AppMain.nnMakeTargetUpVectorCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_UPVECTOR);
                        break;
                    }
                    }
                }
            }
        }
        AppMain.GlobalPool <AppMain.NNS_VECTOR> .Release(nns_VECTOR);
    }
    // Token: 0x06000127 RID: 295 RVA: 0x0000D158 File Offset: 0x0000B358
    private static void ObjCamera3dInit(int cam_id)
    {
        if (AppMain.obj_camera_sys == null)
        {
            return;
        }
        if (AppMain.obj_camera_sys.obj_camera[cam_id] == null)
        {
            AppMain.NNS_VECTOR nns_VECTOR = AppMain.GlobalPool <AppMain.NNS_VECTOR> .Alloc();

            int num = AppMain.ObjCameraInit(cam_id, nns_VECTOR, 0, 0, 61438);
            if (num == -1)
            {
                return;
            }
            AppMain.GlobalPool <AppMain.NNS_VECTOR> .Release(nns_VECTOR);
        }
        AppMain.OBS_CAMERA obs_CAMERA = AppMain.obj_camera_sys.obj_camera[cam_id];
        obs_CAMERA.flag  |= 16U;
        obs_CAMERA.znear  = 1f;
        obs_CAMERA.zfar   = 60000f;
        obs_CAMERA.aspect = AppMain.AMD_SCREEN_ASPECT;
        obs_CAMERA.fovy   = AppMain.NNM_DEGtoA32(45f);
        AppMain.nnMakePerspectiveMatrix(obs_CAMERA.prj_pers_mtx, obs_CAMERA.fovy, obs_CAMERA.aspect, obs_CAMERA.znear, obs_CAMERA.zfar);
        obs_CAMERA.scale = 0.078125f;
        float num2 = AppMain.g_obj.disp_height * obs_CAMERA.scale * 0.5f * 1f;
        float num3 = num2 * obs_CAMERA.aspect;

        obs_CAMERA.left   = -num3;
        obs_CAMERA.right  = num3;
        obs_CAMERA.bottom = -num2;
        obs_CAMERA.top    = num2;
        AppMain.nnMakeOrthoMatrix(obs_CAMERA.prj_ortho_mtx, obs_CAMERA.left, obs_CAMERA.right, obs_CAMERA.bottom, obs_CAMERA.top, obs_CAMERA.znear, obs_CAMERA.zfar);
        switch (obs_CAMERA.camera_type)
        {
        case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_ROLL:
        {
            AppMain.NNS_CAMERA_TARGET_ROLL nns_CAMERA_TARGET_ROLL = new AppMain.NNS_CAMERA_TARGET_ROLL();
            AppMain.ObjCameraGetTargetRollCamera(obs_CAMERA, nns_CAMERA_TARGET_ROLL);
            AppMain.nnMakeTargetRollCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_ROLL);
            return;
        }

        case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_TARGET:
        {
            AppMain.NNS_CAMERA_TARGET_UPTARGET nns_CAMERA_TARGET_UPTARGET = new AppMain.NNS_CAMERA_TARGET_UPTARGET();
            AppMain.ObjCameraGetTargetUpTargetCamera(obs_CAMERA, nns_CAMERA_TARGET_UPTARGET);
            AppMain.nnMakeTargetUpTargetCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_UPTARGET);
            return;
        }

        case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_VEC:
        {
            AppMain.NNS_CAMERA_TARGET_UPVECTOR nns_CAMERA_TARGET_UPVECTOR = new AppMain.NNS_CAMERA_TARGET_UPVECTOR();
            AppMain.ObjCameraGetTargetUpVecCamera(obs_CAMERA, nns_CAMERA_TARGET_UPVECTOR);
            AppMain.nnMakeTargetUpVectorCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_UPVECTOR);
            return;
        }

        default:
            return;
        }
    }
示例#5
0
    private static void objCameraMain(AppMain.MTS_TASK_TCB tcb)
    {
        if (AppMain.ObjObjectPauseCheck(0U) != 0U)
        {
            return;
        }
        AppMain.NNS_VECTOR nnsVector = new AppMain.NNS_VECTOR();
        for (int index = 0; index < 8; ++index)
        {
            AppMain.OBS_CAMERA obsCamera = AppMain.obj_camera_sys.obj_camera[index];
            if (obsCamera != null)
            {
                obsCamera.prev_disp_pos.x = obsCamera.disp_pos.x;
                obsCamera.prev_disp_pos.y = obsCamera.disp_pos.y;
                obsCamera.prev_disp_pos.z = obsCamera.disp_pos.z;
                if (obsCamera.user_func != null)
                {
                    obsCamera.user_func(obsCamera);
                }
                else
                {
                    if (((int)obsCamera.flag & 4) != 0)
                    {
                        AppMain.objCameraMove(obsCamera);
                    }
                    nnsVector.x = obsCamera.pos.x;
                    nnsVector.y = obsCamera.pos.y;
                    nnsVector.z = obsCamera.pos.z;
                    if (((int)obsCamera.flag & 8) != 0)
                    {
                        nnsVector.x -= (float)(((double)nnsVector.x - (double)obsCamera.work.x) * 2.0);
                        nnsVector.y -= (float)(((double)nnsVector.y - (double)obsCamera.work.y) * 2.0);
                        nnsVector.z -= (float)(((double)nnsVector.z - (double)obsCamera.work.z) * 2.0);
                    }
                    obsCamera.disp_pos.x = nnsVector.x + obsCamera.ofst.x;
                    obsCamera.disp_pos.y = nnsVector.y + obsCamera.ofst.y;
                    obsCamera.disp_pos.z = nnsVector.z + obsCamera.ofst.z;
                }
                if (((int)obsCamera.flag & 32) != 0)
                {
                    AppMain.objCameraLimitCheck(obsCamera);
                }
                obsCamera.disp_pos.x += obsCamera.disp_ofst.x;
                obsCamera.disp_pos.y += obsCamera.disp_ofst.y;
                obsCamera.disp_pos.z += obsCamera.disp_ofst.z;
                obsCamera.disp_ofst.x = 0.0f;
                obsCamera.disp_ofst.y = 0.0f;
                obsCamera.disp_ofst.z = 0.0f;
                if (((int)obsCamera.flag & 16) != 0)
                {
                    AppMain.nnMakePerspectiveMatrix(obsCamera.prj_pers_mtx, obsCamera.fovy, obsCamera.aspect, obsCamera.znear, obsCamera.zfar);
                    float num1 = (float)((double)AppMain.AMD_SCREEN_2D_WIDTH * (double)obsCamera.scale * 0.5 * 1.0);
                    float num2 = num1 * obsCamera.aspect;
                    obsCamera.left   = -num2;
                    obsCamera.right  = num2;
                    obsCamera.bottom = -num1;
                    obsCamera.top    = num1;
                    AppMain.nnMakeOrthoMatrix(obsCamera.prj_ortho_mtx, obsCamera.left, obsCamera.right, obsCamera.bottom, obsCamera.top, obsCamera.znear, obsCamera.zfar);
                    switch (obsCamera.camera_type)
                    {
                    case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_ROLL:
                        AppMain.NNS_CAMERA_TARGET_ROLL cameraTargetRoll = AppMain.GlobalPool <AppMain.NNS_CAMERA_TARGET_ROLL> .Alloc();

                        int roll = obsCamera.roll;
                        if (((int)obsCamera.flag & 1073741824) != 0)
                        {
                            obsCamera.roll = 0;
                        }
                        AppMain.ObjCameraGetTargetRollCamera(obsCamera, cameraTargetRoll);
                        AppMain.nnMakeTargetRollCameraViewMatrix(obsCamera.view_mtx, cameraTargetRoll);
                        obsCamera.roll = roll;
                        AppMain.GlobalPool <AppMain.NNS_CAMERA_TARGET_ROLL> .Release(cameraTargetRoll);

                        continue;

                    case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_TARGET:
                        AppMain.NNS_CAMERA_TARGET_UPTARGET cameraTargetUptarget = new AppMain.NNS_CAMERA_TARGET_UPTARGET();
                        AppMain.ObjCameraGetTargetUpTargetCamera(obsCamera, cameraTargetUptarget);
                        AppMain.nnMakeTargetUpTargetCameraViewMatrix(obsCamera.view_mtx, cameraTargetUptarget);
                        continue;

                    case AppMain.OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_UP_VEC:
                        AppMain.NNS_CAMERA_TARGET_UPVECTOR cameraTargetUpvector = new AppMain.NNS_CAMERA_TARGET_UPVECTOR();
                        AppMain.ObjCameraGetTargetUpVecCamera(obsCamera, cameraTargetUpvector);
                        AppMain.nnMakeTargetUpVectorCameraViewMatrix(obsCamera.view_mtx, cameraTargetUpvector);
                        continue;

                    default:
                        continue;
                    }
                }
            }
        }
        //AppMain.GlobalPool<AppMain.NNS_VECTOR>.Release(nnsVector);
    }