Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_PostProcessCameraComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Camera", description: "")]
5
8{
9 [Attribute()]
10 private ref array<ref SCR_CameraPostProcessEffect> m_Effects;
11
13
14 //------------------------------------------------------------------------------------------------
19 {
20 foreach (SCR_CameraPostProcessEffect effect: m_Effects)
21 {
22 if (type == effect.GetType())
23 return effect;
24 }
25 return null;
26 }
27
28 //------------------------------------------------------------------------------------------------
29 protected void OnCameraActivate()
30 {
31 foreach (SCR_CameraPostProcessEffect effect: m_Effects)
32 {
33 effect.CreateEffect(m_Camera.GetCameraIndex());
34 }
35 }
36
37 //------------------------------------------------------------------------------------------------
38 protected void OnCameraDeactivate()
39 {
40 foreach (SCR_CameraPostProcessEffect effect: m_Effects)
41 {
42 effect.DeleteEffect();
43 }
44 }
45
46 //------------------------------------------------------------------------------------------------
47 // constructor
52 {
53 m_Camera = SCR_CameraBase.Cast(ent);
54 if (!m_Camera)
55 return;
56
57 m_Camera.GetOnCameraActivate().Insert(OnCameraActivate);
58 m_Camera.GetOnCameraDeactivate().Insert(OnCameraDeactivate);
59 }
60
61 //------------------------------------------------------------------------------------------------
62 // destructor
64 {
65 if (!m_Camera)
66 return;
67
68 m_Camera.GetOnCameraActivate().Remove(OnCameraActivate);
69 m_Camera.GetOnCameraDeactivate().Remove(OnCameraDeactivate);
70 }
71}
72
75{
76 [Attribute(defvalue: "0", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(PostProcessEffectType))]
77 private PostProcessEffectType m_Type;
78
79 [Attribute(uiwidget: UIWidgets.Slider, params: "0 19 1")]
80 private int m_iPriority;
81
82 [Attribute(params: "emat")]
83 private ResourceName m_MaterialPath;
84
85 private int m_iCameraId;
86 private ref Material m_Material;
87
88 //------------------------------------------------------------------------------------------------
91 {
92 return m_Type;
93 }
94
95 //------------------------------------------------------------------------------------------------
98 void SetParam(string param, float value)
99 {
100 if (m_Material)
101 m_Material.SetParam(param, value);
102 }
103
104 //------------------------------------------------------------------------------------------------
107 void ResetParam(string param)
108 {
109 if (m_Material)
110 m_Material.ResetParam(param);
111 }
112
113 //------------------------------------------------------------------------------------------------
114 void SetMaterial()
115 {
116 SetMaterial(m_MaterialPath);
117 }
118
119 //------------------------------------------------------------------------------------------------
121 void SetMaterial(ResourceName material)
122 {
123 GetGame().GetWorld().SetCameraPostProcessEffect(m_iCameraId, m_iPriority, m_Type, material);
124
125 m_Material = Material.GetMaterial(material);
126 if (!m_Material)
127 {
128 Print(string.Format("Error when loading post-process material '%1'!", material), LogLevel.ERROR);
129 DeleteEffect();
130 return;
131 }
132 }
133
134 //------------------------------------------------------------------------------------------------
137 void CreateEffect(int cameraId)
138 {
140 return;
141
142 m_iCameraId = cameraId;
143 SetMaterial();
144 }
145
146 //------------------------------------------------------------------------------------------------
148 void DeleteEffect()
149 {
151 return;
152
153 GetGame().GetWorld().SetCameraPostProcessEffect(m_iCameraId, m_iPriority, PostProcessEffectType.None, "");
154
155 m_iCameraId = 0;
156 m_Material = null;
157 }
158
159 //------------------------------------------------------------------------------------------------
160 // destructor
162 {
163 DeleteEffect();
164 }
165}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseCameraComponentClass ScriptComponentClass SCR_BaseCameraComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Base component for SCR_CameraBase.
SCR_ManualCamera m_Camera
override EGadgetType GetType()
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
EDamageType type
void ~SCR_PostProcessCameraComponent()
SCR_PostProcessCameraComponentClass SCR_BaseCameraComponentClass Attribute()] private ref array< ref SCR_CameraPostProcessEffect > m_Effects
Post-process effect of scripted camera.
void OnCameraActivate()
void SCR_PostProcessCameraComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void OnCameraDeactivate()
static bool IsEditMode()
Definition Functions.c:1566
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
PostProcessEffectType
Definition EnWorld.c:20