Cameras

From CloudModding OoT Wiki
Jump to: navigation, search

VIEW Structure

The "VIEW" is a common structure that appears in all game states that I believe stores the final information on the active camera, which is then converted into a projection matrix. Each Game State defines it's own VIEW struct. Below is both the struct and the initial values, when initialized by the NTSC 1.0 function located at 80091858:

 /* 0x00 */ u32 VIEW;            //0x56494557, or string literal VIEW
 /* 0x04 */ ptr graphicsContext; //stores address to the start of the Graphics Context
 /* 0x08 */ s32 viewportTopY    =   0;    
 /* 0x0C */ s32 viewportBottomY = 240;
 /* 0x10 */ s32 viewportLeftX   =   0;   
 /* 0x14 */ s32 viewportRightX  = 320;
 /* 0x18 */ float fieldOfView   = 60.0f;
 /* 0x1C */ float fogDistance   = 10.0f;
 /* 0x20 */ float zDepth        = 12800.0f;
 /* 0x24 */ float unk1          = 1.0f;
 /* 0x28 */ float unk2          = 0.0f;
 /* ... */
 /* 0x124 */ u32 unk_0x124      = 0;

Camera Structure

The Camera structure is a structure seen in at least in the "main game" game state that is used to represent a pin-hole? camera located within world space. The main game state defines and uses up to 4 camera structs at any one time. At Global Context (Game) + 0x790 is a pointer array to the four cameras used in game. These structs are allocated to the Global Context at the following locations:

Global Context
Offset Usage
0x01E0 Follows the player
0x034C typically used for cutscenes
0x04B8 Used when Pierre dances
0x0624  ?

Camera Behavior

I'm about 85% confident that this following table (located at NTSC 800EEE70, B64DD0) is the start of a reference table to data that determines how the camera behaves when standing on/over certain collision polygons. I believe this behavior is set by the polygon types themselves.

NTSC 1.0, B64DD0
Id Data Ptr
00 00000000 00000000
01 051FFFFF 800ED990
02 051FFFFF 800EDA38
03 051FFFFF 800EDAE0
04 051FFFFF 800EDB88
05 050FF7FF 800EDC30
06 8500018F 800EDCD0
07 051FFFFF 800EDD18
08 051FFFFF 800EDDC0
09 051FFFFF 800EDE68
0A 051FFFFF 800EDF10
0B 051FFFFF 800EDFB8
0C 051FFFFF 800EE060
0D 051FFFFF 800EE108
0E 051FFFFF 800EE1B0
0F 051FFFFF 800EE258
10 051FFFFF 800EE300
11 051FFFFF 800EE3A8
12 851FFFFF 800EE450
13 851FFFFF 800EE4F8
14 8500000D 800EE5A0
15 85000001 800EE5C0
16 85000001 800EE5C8
17 85000001 800EE5D0
18 851E1FFF 800EE5D8
19 8C00000D 800EE680
1A 8C00000D 800EE6A0
1B 8C000001 800EE6C0
1C C5000001 800EE6C8
1D C5000003 800EE6D0
1E C5000001 800EE6E0
1F C5000001 800EE6E8
20 C5000001 800EE6F0
21 05000001 800EE6F8
22 05000001 800EE700
23 85000001 800EE708
24 05000003 800EE710
25 CE000001 800EE720
26 4E000001 800EE728
27 05000009 800EE730
28 45000001 800EE750
29 45000001 800EE758
2A 45000001 800EE760
2B 45000001 800EE768
2C 451FFFFF 800EE770
2D 451FFFFF 800EE818
2E C5000001 800EE8C0
2F 45000001 800EE8C8
30 05000001 800EE8D0
31 45000001 800EE8D8
32 45000001 800EE8E0
33 45000001 800EE8E8
34 451FFFFF 800EE8F0
35 05000033 800EE998
36 05000033 800EE9C8
37 05000033 800EE9F8
38 4A000001 800EEA28
39 05000001 800EEA30
3A 051FFFFF 800EEA38
3B 0501E05F 800EEAE0
3C 45000001 800EEB68
3D 051FFFFF 800EEB70
3E 051FFFFF 800EEC18
3F 051FFFFF 800EECC0
40 C5000ECD 800EED68
41 051FFFFF 800EEDC8