Skip to content

Commit

Permalink
Added descriptions for a few camera DoF natives (#866)
Browse files Browse the repository at this point in the history
* Update SetCamFarDof.md

Reduce redundancy by referencing examples instead.

* Update SetUseHiDof.md

Better to not link to URLs that could get lost in the future.

---------

Co-authored-by: ammonia-cfx <[email protected]>
  • Loading branch information
coalaura and 4mmonium authored Nov 20, 2023
1 parent 462ec33 commit 9bf46ca
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 11 deletions.
30 changes: 28 additions & 2 deletions CAM/SetCamDofStrength.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,34 @@ ns: CAM
void SET_CAM_DOF_STRENGTH(Cam cam, float dofStrength);
```
Specifies how much the DoF effect should be applied (Set using [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), etc.)
## Parameters
* **cam**:
* **dofStrength**:
* **cam**: The camera handle
* **dofStrength**: Depth of Field strength (between 0.0 and 1.0)
## Examples
```lua
CreateThread(function()
local camera = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true)
-- Set the cam coordinates to the player coords
local playerCoords = GetEntityCoords(PlayerPedId())
SetCamCoord(camera, playerCoords)
-- Render the camera we just created
RenderScriptCams(true)
-- Use a shallow depth of field
SetCamUseShallowDofMode(camera, true)
-- Set at what distance your camera should start to focus (Example: 0.7 meters)
SetCamNearDof(camera, 0.7)
-- Set at what distance your camera should stop focusing (Example: 1.3 meters)
SetCamFarDof(camera, 1.3)
-- Apply 100% of the DoF effect (The native you're reading documentation on)
SetCamDofStrength(camera, 1.0)
while DoesCamExist(camera) do
-- Use DoF effect (needs to be called every tick)
SetUseHiDof()
Citizen.Wait(0)
end
end)
```
9 changes: 6 additions & 3 deletions CAM/SetCamFarDof.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ ns: CAM
void SET_CAM_FAR_DOF(Cam cam, float farDOF);
```
Specifies when the camera should stop being in focus. Can be used together with [`SET_USE_HI_DOF`](#_0xA13B0222F3D94A94), [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_USE_SHALLOW_DOF_MODE`](#_0x16A96863A17552BB), [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897) and other DoF related natives.
## Parameters
* **cam**:
* **farDOF**:
### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).
## Parameters
* **cam**: The camera handle
* **farDOF**: Distance in in standard units
10 changes: 7 additions & 3 deletions CAM/SetCamNearDof.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ ns: CAM
void SET_CAM_NEAR_DOF(Cam cam, float nearDOF);
```
Specifies when the camera should start being in focus. Can be used together with [`SET_USE_HI_DOF`](#_0xA13B0222F3D94A94), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), [`SET_CAM_USE_SHALLOW_DOF_MODE`](#_0x16A96863A17552BB), [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897) and other DoF related natives.
## Parameters
* **cam**:
* **nearDOF**:
### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).
## Parameters
* **cam**: The camera handle
* **nearDOF**: Distance in in standard units
10 changes: 7 additions & 3 deletions CAM/SetCamUseShallowDofMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ ns: CAM
void SET_CAM_USE_SHALLOW_DOF_MODE(Cam cam, BOOL toggle);
```
Enables or disables the usage of a shallow DOF. Needs to be set to true to use [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), etc. Doesn't need to be called every tick.
## Parameters
* **cam**:
* **toggle**:
### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).
## Parameters
* **cam**: The camera handle
* **toggle**: Boolean if the camera should use a shallow depth of field or not
4 changes: 4 additions & 0 deletions CAM/SetUseHiDof.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ ns: CAM
void SET_USE_HI_DOF();
```

Needs to be called every tick to make the active camera use a high depth of field.
The DoF can be customized using [`SET_CAM_NEAR_DOF`](#_0x3FA4BF0A7AB7DE2C), [`SET_CAM_FAR_DOF`](#_0xEDD91296CD01AEE0), [`SET_CAM_USE_SHALLOW_DOF_MODE`](#_0x16A96863A17552BB), [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897) and other DoF related natives.

### Usage Example
A usage example for this native can be found in the following native documentation: [`SET_CAM_DOF_STRENGTH`](#_0x5EE29B4D7D5DF897).

0 comments on commit 9bf46ca

Please sign in to comment.