Exemplo n.º 1
0
    public static Matrix4x4 PsxProj2UnityProj(Single zNear, Single zFar)
    {
        Single bottom = FieldMap.PsxScreenHeightNative / 2.2f;
        Single top    = FieldMap.PsxScreenHeightNative - bottom;

        return(PsxCamera.PerspectiveOffCenter(-FieldMap.HalfScreenWidth, FieldMap.HalfScreenWidth, -bottom, top, zNear, zFar));
    }
Exemplo n.º 2
0
    public override void Render(Int32 index)
    {
        GL.Viewport(new Rect(0f, 0f, (Single)PSXTextureMgr.GEN_TEXTURE_W, (Single)PSXTextureMgr.GEN_TEXTURE_H));
        GL.LoadIdentity();
        Matrix4x4 mat = Matrix4x4.Ortho(0f, (Single)PSXTextureMgr.GEN_TEXTURE_W, 0f, (Single)PSXTextureMgr.GEN_TEXTURE_H, SFX.fxNearZ, SFX.fxFarZ);

        PsxCamera.SetOrthoZ(ref mat, SFX.fxNearZ, SFX.fxFarZ);
        GL.LoadProjectionMatrix(mat);
        SFXMeshBase.curRenderTexture = RenderTexture.active;
        RenderTexture.active         = PSXTextureMgr.genTexture;
        if (!PSXTextureMgr.isCreateGenTexture)
        {
            GL.Clear(false, true, new Color(0f, 0f, 0f));
        }
        SFXMeshBase.isRenderTexture = true;
    }
Exemplo n.º 3
0
 public static void CaptureBG()
 {
     if (PSXTextureMgr.isBgCapture)
     {
         PSXTextureMgr.isBgCapture = false;
         GameObject     btlBGPtr             = FF9StateSystem.Battle.FF9Battle.map.btlBGPtr;
         MeshRenderer[] componentsInChildren = btlBGPtr.GetComponentsInChildren <MeshRenderer>();
         for (Int32 i = 0; i < (Int32)componentsInChildren.Length; i++)
         {
             if (componentsInChildren[i].name == "Group_2")
             {
                 PSXTextureMgr.bgKey = (UInt32)(PSXTextureMgr.bgParam[1] >> 8 << 20 | PSXTextureMgr.bgParam[0] >> 6 << 16);
                 RenderTexture active = RenderTexture.active;
                 RenderTexture.active = PSXTextureMgr.bgTexture;
                 GL.Viewport(new Rect(0f, 0f, 256f, 256f));
                 GL.LoadIdentity();
                 GL.Clear(false, true, new Color(0.02734375f, 0.02734375f, 0.02734375f, 0f));
                 Single num    = (Single)(PSXTextureMgr.bgParam[0] % 64);
                 Single num2   = (Single)(PSXTextureMgr.bgParam[1] % 256);
                 Single num3   = (Single)(PSXTextureMgr.bgParam[2] >> 1);
                 Single num4   = (Single)(PSXTextureMgr.bgParam[3] >> 1);
                 Single num5   = 256f / (Single)PSXTextureMgr.bgParam[2];
                 Single num6   = 256f / (Single)PSXTextureMgr.bgParam[3];
                 Camera camera = Camera.main ? Camera.main : GameObject.Find("Battle Camera").GetComponent <BattleMapCameraController>().GetComponent <Camera>();
                 camera.worldToCameraMatrix = Matrix4x4.TRS(new Vector3((Single)(-(Single)PSXTextureMgr.bgParam[4]), (Single)PSXTextureMgr.bgParam[5], (Single)(-(Single)(10496 + PSXTextureMgr.bgParam[6]))), Quaternion.Euler(-90f, 0f, 0f), new Vector3(1f, 1f, 1f));
                 Matrix4x4 mat = PsxCamera.PerspectiveOffCenter(0f - num3 - num, 256f - num3 - num, -256f + num4 + num2, 0f + num4 + num2, 512f, 65536f);
                 GL.LoadProjectionMatrix(mat);
                 Mesh mesh = componentsInChildren[i].GetComponent <MeshFilter>().mesh;
                 componentsInChildren[i].material.SetPass(0);
                 Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
                 SFX.ResetViewPort();
                 RenderTexture.active = active;
                 return;
             }
         }
     }
 }