Esempio n. 1
0
    // Token: 0x0600012B RID: 299 RVA: 0x0000D58C File Offset: 0x0000B78C
    public static void GetTargetUpVecCamera(OBS_CAMERA obj_camera,
                                            AppMain.NNS_CAMERA_TARGET_UPVECTOR tupvec_camera)
    {
        tupvec_camera.User       = 0U;
        tupvec_camera.Fovy       = obj_camera.fovy;
        tupvec_camera.Aspect     = obj_camera.aspect;
        tupvec_camera.ZNear      = obj_camera.znear;
        tupvec_camera.ZFar       = obj_camera.zfar;
        tupvec_camera.Position.x = obj_camera.disp_pos.x;
        tupvec_camera.Position.y = obj_camera.disp_pos.y;
        tupvec_camera.Position.z = obj_camera.disp_pos.z;
        if (obj_camera.target_obj != null)
        {
            tupvec_camera.Target.x = AppMain.FXM_FX32_TO_FLOAT(obj_camera.target_obj.pos.x);
            tupvec_camera.Target.y = AppMain.FXM_FX32_TO_FLOAT(obj_camera.target_obj.pos.y);
            tupvec_camera.Target.z = AppMain.FXM_FX32_TO_FLOAT(obj_camera.target_obj.pos.z);
        }
        else
        {
            tupvec_camera.Target.x = obj_camera.target_pos.x;
            tupvec_camera.Target.y = obj_camera.target_pos.y;
            tupvec_camera.Target.z = obj_camera.target_pos.z;
        }

        tupvec_camera.UpVector.Assign(obj_camera.up_vec);
    }
Esempio n. 2
0
    // Token: 0x06000127 RID: 295 RVA: 0x0000D158 File Offset: 0x0000B358
    public static void Init3d(int cam_id)
    {
        if (obj_camera_sys == null)
        {
            return;
        }

        if (obj_camera_sys.obj_camera[cam_id] == null)
        {
            NNS_VECTOR nns_VECTOR = GlobalPool <NNS_VECTOR> .Alloc();

            int num = Init(cam_id, nns_VECTOR, 0, 0, 61438);
            if (num == -1)
            {
                return;
            }

            GlobalPool <NNS_VECTOR> .Release(nns_VECTOR);
        }

        NNS_MATRIX scaleMatrix = GlobalPool <NNS_MATRIX> .Alloc();

        nnMakeScaleMatrix(scaleMatrix, AppMain.AMD_SCREEN_SCALE, AppMain.AMD_SCREEN_SCALE, AppMain.AMD_SCREEN_SCALE);

        OBS_CAMERA obs_CAMERA = 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);
        //nnMultiplyMatrix(obs_CAMERA.prj_pers_mtx, obs_CAMERA.prj_pers_mtx, scaleMatrix);
        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);
        AppMain.nnMultiplyMatrix(obs_CAMERA.prj_ortho_mtx, obs_CAMERA.prj_ortho_mtx, scaleMatrix);
        switch (obs_CAMERA.camera_type)
        {
        case OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_ROLL:
        {
            AppMain.NNS_CAMERA_TARGET_ROLL nns_CAMERA_TARGET_ROLL = new AppMain.NNS_CAMERA_TARGET_ROLL();
            GetTargetRollCamera(obs_CAMERA, nns_CAMERA_TARGET_ROLL);
            AppMain.nnMakeTargetRollCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_ROLL);
            return;
        }

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

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

        default:
            return;
        }
    }
Esempio n. 3
0
    // Token: 0x06000133 RID: 307 RVA: 0x0000D868 File Offset: 0x0000BA68
    private static void objCameraMain(MTS_TASK_TCB tcb)
    {
        if (AppMain.ObjObjectPauseCheck(0U) != 0U)
        {
            return;
        }

        NNS_MATRIX scaleMatrix = GlobalPool <NNS_MATRIX> .Alloc();

        AppMain.nnMakeScaleMatrix(scaleMatrix, AMD_SCREEN_SCALE, AMD_SCREEN_SCALE, AMD_SCREEN_SCALE);
        NNS_VECTOR nns_VECTOR = GlobalPool <NNS_VECTOR> .Alloc();

        for (int i = 0; i < 8; i++)
        {
            OBS_CAMERA obs_CAMERA = 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)
                    {
                        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)
                {
                    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);
                    // nnMultiplyMatrix(obs_CAMERA.prj_pers_mtx, obs_CAMERA.prj_pers_mtx, scaleMatrix);
                    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;
                    nnMakeOrthoMatrix(obs_CAMERA.prj_ortho_mtx, obs_CAMERA.left, obs_CAMERA.right, obs_CAMERA.bottom,
                                      obs_CAMERA.top, obs_CAMERA.znear, obs_CAMERA.zfar);
                    nnMultiplyMatrix(obs_CAMERA.prj_ortho_mtx, obs_CAMERA.prj_ortho_mtx, scaleMatrix);
                    switch (obs_CAMERA.camera_type)
                    {
                    case OBE_CAMERA_TYPE.OBE_CAMERA_TYPE_TARGET_ROLL:
                    {
                        AppMain.NNS_CAMERA_TARGET_ROLL nns_CAMERA_TARGET_ROLL =
                            GlobalPool <AppMain.NNS_CAMERA_TARGET_ROLL> .Alloc();

                        int roll = obs_CAMERA.roll;
                        if ((obs_CAMERA.flag & 1073741824U) != 0U)
                        {
                            obs_CAMERA.roll = 0;
                        }

                        GetTargetRollCamera(obs_CAMERA, nns_CAMERA_TARGET_ROLL);
                        AppMain.nnMakeTargetRollCameraViewMatrix(obs_CAMERA.view_mtx, nns_CAMERA_TARGET_ROLL);
                        obs_CAMERA.roll = roll;
                        GlobalPool <AppMain.NNS_CAMERA_TARGET_ROLL> .Release(nns_CAMERA_TARGET_ROLL);

                        break;
                    }

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

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

        GlobalPool <NNS_VECTOR> .Release(nns_VECTOR);
    }