2#include "base/SharedPtr.h"
3#include "../base/BaseTypes.h"
5namespace XXSharpKmyPhysics
10namespace XXSharpKmyGfx
12 ref class SpriteBatch;
13 ref class Manipulator;
14 ref class GameViewDrawHook;
16 ref class InternalCommandBufferHandle;
18 private ref class GameViewDrawSuspendChecker
21 virtual bool drawEnable() {
return true; }
24 private ref class GameView
28 GameView(
const std::shared_ptr<kmyGfx::GameView>& ptr);
30 kmyGfx::GameView* getNativePtr() {
return obj ? (*obj).get() :
nullptr; }
32 void draw(
bool swapbuffer,
float timeScale);
33 void preDraw(
float timeScale, Action<float>^ startFixedUpdate, Action<float>^ afterAnimate, Action<float>^ afterSimulate);
34 void postDraw(
bool swapbuffer);
35 void debugPause(
bool flg);
37 void setCamera(XXSharpKmyMath::Matrix4^ proj, XXSharpKmyMath::Matrix4^ view);
38 void setDirectionalLightPosture(XXSharpKmyMath::Matrix4^ posture);
39 void setDirectionalLightColor(XXSharpKmyGfx::Color color);
40 void setDirectionalLightShadowColor(XXSharpKmyGfx::Color color);
41 void setDirectionalLightShadowVolumeMargin(f32 margin);
42 void setDirectionalLightShadowBias(f32 bias);
43 void setDirectionalLightShadowDistance(f32 distance);
44 void setCascadeStep(
float s1,
float s2,
float s3);
45 void setCascadeCount(
int num);
46 void enableCascadeVisualize(
bool flg);
47 void setAmbientLight(XXSharpKmyGfx::Color color);
48 void setBuildingLightBrightness(
float value);
49 void setViewport(
int x,
int y,
int width,
int height);
50 void setViewportSize(
int width,
int height);
51 XXSharpKmyMath::Vector2 getViewportSize();
52 u32 getDisplayID() {
return obj ? obj->getDisplayID() : 0; }
53 void setDisplayID(
unsigned int id);
54 void setBackGroundColor(XXSharpKmyGfx::Color color);
55 void addPickupFrame(
int size);
56 void addCaptureFrame(
int width,
int height);
57 void removeCaptureFrame();
58 void enableBloom(
bool flg);
59 void setBloomParam(
float apply,
float hilightThreshold);
60 void enableAutoExposure(
bool flg);
61 void setAutoExposureParam(
float targetBrightness,
float minScale,
float maxScale);
62 void enableChromaticAbberation(
bool flg);
63 void setChromaticAbberationParam(
float size);
64 void enableDof(
bool flg);
65 void enableFxaa(
bool flg);
66 void setDofParam(
float focalDistance,
float focalRange,
float radius);
67 void enableSharpen(
bool flg);
68 void setShapenParam(
float strength,
float distance);
69 void getImage(
int x,
int y,
int w,
int h, array<UINT32> ^buffer);
70 void getDepth(
int x,
int y,
int w,
int h, array<float>^ buffer);
71 void getNormal(
int x,
int y,
int w,
int h, array<UINT32>^ buffer);
72 void getCaptureFrame(array<UINT32> ^color, array<UINT32> ^depth);
73 void createScreenShot(System::String^ path);
74 void setSpriteBatch(SpriteBatch^ s);
75 void setFogColor(XXSharpKmyGfx::Color color);
76 void setFogParam(f32 start, f32 depthDensity, f32 heightFallOff);
77 void setSSAOParam(f32 radius, f32 minLimit, f32 maxLimit, f32 shadowScale,
int sampleCount, f32 contrast, XXSharpKmyGfx::Color color, SSAOALGORITHM algorithm, SSAOBLURTYPE blurType,
int linearThresholdLevel,
float fadeDistance);
78 void enableSSSSS(
bool flg);
79 void setSSSSSParam(f32 radius,
int sampleCount, f32 apply);
80 void clearSettings() {
if(obj)obj->clearSettings(); }
82 unsigned short pickup(
float x,
float y, XXSharpKmyMath::Vector3% wpos);
83 int pickupDetail(
float x,
float y, array<UINT16> ^idlist, array<XXSharpKmyMath::Vector3> ^wposlist, array<float> ^depthlist);
84 void getTerrainNormal(
float x,
float y, XXSharpKmyMath::Vector3% nrm);
92 void pickupRect(
float left,
float top,
float right,
float bottom, System::Collections::Generic::List<UINT16>^ idlist,
bool ignoreTerrain,
bool ignoreManipulator);
93 void addHilightPickupID(
unsigned short id);
94 array<unsigned short>^ getHilightPicupIDs();
95 void clearHilightPickupID();
96 void addHoverHilightPickupID(
unsigned short id);
97 void clearHoverHilightPickupID();
99 void setReflectionMap(Texture^ tex);
100 void setSkyBoxMaterial(System::Guid mtl);
101 void setLutMap(System::Guid
id);
102 void setReflectionMap(Texture^ tex,
float interpolateTime);
103 void setLutMap(System::Guid
id,
float interpolateTime);
104 void use2DGizmo() {
if(obj)obj->use2DGizmo(); }
105 void enableVignette(
bool flg);
106 void setVignette(
float value);
107 void setIBLIntensity(
float value);
108 void setReflectionIntensity(
float value);
109 void setBillboardLightModulation(
float value);
111 void setDistanceFadeEnable(
bool flg) {
if (obj)obj->setDistanceFadeEnable(flg); }
112 void setDistanceFadeStart(
float v) {
if (obj)obj->setDistanceFadeStart(v); }
114 bool XZPlaneHitTest(
float u,
float v,
float yoffset, XXSharpKmyMath::Vector3 %hitpos);
115 void addPhysics() {
if (obj)obj->addPhysics(); }
116 XXSharpKmyPhysics::PhysicsBase^ getPhysics();
117 void addManipulator() {
if (obj)obj->addManipulator(); }
118 Manipulator^ getManipulator();
119 static void setMainGameView(GameView^ gv);
120 static GameView^ getMainGameView();
121 void resetQualityAdjust() {
if (obj)obj->m_gpuTime.resetQualityAdjust((*obj).get()); }
122 void set3DGizmoDrawEnabled(
bool flg);
123 void setModelBoundSphereDrawType(ModelBoundSphereDrawType flg) {
if (obj)obj->setModelBoundSphereDrawType((kmyGfx::ModelBoundSphereDrawType)flg); }
124 void setSelectionDrawEnabled(
bool flg);
125 void setPhysicsDebugDrawEnabled(
int flag);
126 void setPhysicsDebugDrawContactPoints(
bool flg);
127 void setPhysicsDebugDrawConstraints(
bool flg);
128 void setPhysicsProcessEnabled(
bool flag);
129 bool viewVolumeCheck(
float x,
float y,
float z,
float radius);
130 void addSubGameView(GameView^ sub);
131 void addSubGameView(GameView^ sub, SubGameViewDrawTrigger type);
132 void enableAsSubGameView(
bool flg);
133 void removeSubGameView(GameView^ sub,
bool removeForce);
134 void removeSubGameView(GameView^ sub) { removeSubGameView(sub,
true); }
135 Texture^ getCaptureColorTexture();
136 Texture^ getCaptureDepthTexture();
137 void copyBaseRenderingEnviroment(GameView^ src);
138 void baseImageCapture(
bool flg);
139 void enableDynamicResolution(
bool flg);
140 void setShadowMapScale(
float s);
141 void addDrawHook(GameViewDrawHook ^d);
142 void removeDrawHook(GameViewDrawHook^ d);
143 void clearDrawHook();
144 void usetDeferredLighting(
bool flg);
145 void ignoreSuspendChecker() { m_ignoreSuspendChecker =
true; }
146 void setHiddenStencilColor(
float r,
float g,
float b,
float a) {
if(obj)obj->setHiddenStencilColor(r, g, b, a); };
147 void addDrawCommand(DrawEvent ev, InternalCommandBufferHandle^ icb);
149 float getBlockElapsed(XXSharpKmyBase::PerformancePeriodType type);
150 int getFixedUpdateStepCount();
152 static GameView^ getTaskGameView();
153 static void setSpriteBatchToTaskGameView(SpriteBatch^ s);
154 static void setMaximumResolution(
int w,
int h);
155 static void useAsyncCommandExec() { kmyGfx::GameViewStatics::asyncRendering(); }
156 static void globalEnablePostFX(
bool flg);
157 static Texture^ getPickupIDTexture();
158 static Texture^ getBaseDepthTexture();
159 static void setPerformanceMeterDrawMode(
int mode) { }
160 static void setDrawSuspendChecker(GameViewDrawSuspendChecker^ body);
161 static bool isDrawSuspending();
162 static GameViewDrawSuspendChecker^ s_checker;
163 static void bootProgressMessage(System::String^ text);
164 static void windowsMessageEvent(IntPtr hWnd, UINT message, WPARAM wparam, LPARAM lparam);
165 static int getCurrentGameView3DScreenWidth();
166 static int getCurrentGameView3DScreenHeight();
167 static void waitPreviousDrawingFinished();
168 static void enableDraw(
bool flg);
169 static void enableLimitFPS(
bool flg);
170 static void setMaximumFPS(
int fps);
171 static void setMaximumPhysicsUpdateCount(
int count);
173 bool m_ignoreSuspendChecker =
false;
179 void enableIconDrawer(
bool enable) {
if (obj) obj->m_iconDrawer._enable = enable; }
180 void showMiniMeter(
bool flg) {
if (obj)obj->m_showMiniMeter = flg; }
181 void showDevelopHint(
bool flg) {
if (obj)obj->m_showDevelopHint = flg; }
183 XXSharpKmyMath::Matrix4 getCameraProj()
185 return (context._setCamera) ? context._cameraProj : XXSharpKmyMath::Matrix4::identity();
187 XXSharpKmyMath::Matrix4 getCameraView()
189 return (context._setCamera) ? context._cameraView : XXSharpKmyMath::Matrix4::identity();
193 XXSharpKmyBase::SharedPtr<kmyGfx::GameView>^ obj =
nullptr;
197 bool _setSpriteBatch =
false;
198 SpriteBatch ^_spriteBatch;
199 bool _setCamera =
false;
200 XXSharpKmyMath::Matrix4 _cameraProj;
201 XXSharpKmyMath::Matrix4 _cameraView;
202 bool _setDLPosture =
false;
203 XXSharpKmyMath::Matrix4 _directionalLightPosture;
204 bool _setDLColor =
false;
205 XXSharpKmyGfx::Color _directionalLightColor;
206 bool _setDLShadowColor =
false;
207 XXSharpKmyGfx::Color _directionalLightShadowColor;
208 bool _setDLShadowVM =
false;
209 f32 _directionalLightShadowVolumeMargin;
210 bool _setDLShadowBias =
false;
211 f32 _directionalLightShadowBias;
212 bool _setDLShadowDistane =
false;
213 f32 _directionalLightShadowDistance;
214 bool _setCascadeStep =
false;
218 bool _setCascadeCount =
false;
219 int _cascadeCount = 4;
220 bool _setEnableCascadeViusalize =
false;
221 bool _enableCascadeVisualize =
false;
222 bool _setAmbientLight =
false;
223 XXSharpKmyGfx::Color _ambientLight;
224 bool _setViewport =
false;
229 bool _setViewportSize =
false;
230 int _viewportSizeWidth;
231 int _viewportSizeHeight;
232 bool _setDisplayID =
false;
233 unsigned int _displayID;
234 bool _setBackGroundColor =
false;
235 XXSharpKmyGfx::Color _backGroundColor;
236 bool _setBloom =
false;
238 bool _setBloomParam =
false;
239 float _bloomParamApply;
240 float _bloomParamHilightThreshold;
241 bool _setAutoExposure =
false;
243 bool _setAutoExposureParam =
false;
244 float _autoExposureParamTargetBrightness;
245 float _autoExposureParamMinScale;
246 float _autoExposureParamMaxScale;
247 bool _setChromaticAbberation =
false;
248 bool _chromaticAbberation;
249 bool _setChromaticAbberationParam =
false;
250 float _chromaticAbberationParmSize;
251 bool _setDof =
false;
253 bool _setDofParam =
false;
254 float _dofParamSmoothStart;
255 float _dofParamSmoothRange;
256 float _dofParamRadius;
257 bool _setFxaa =
false;
259 bool _setReflectionMap =
false;
260 Texture^ _reflectionMap;
261 bool _setSkyBoxMaterial =
false;
262 System::Guid _skyBoxMaterial;
263 bool _setLutMap =
false;
264 System::Guid _lutMap;
265 bool _setFogColor =
false;
266 XXSharpKmyGfx::Color _fogColor;
267 bool _setFogParam =
false;
269 f32 _fogParamDepthDensity;
270 f32 _fogParamHeightFallOff;
271 bool _setSSAOParam =
false;
272 f32 _ssaoParamRadius;
273 f32 _ssaoParamMinLimit;
274 f32 _ssaoParamMaxLimit;
275 f32 _ssaoParamShadowScle;
276 int _ssaoParamSampleCount;
277 f32 _ssaoParamContrast;
278 XXSharpKmyGfx::Color _ssaoParamColor;
281 int _ssaoLinearThresholdLevel;
282 float _ssaoFadeDistance;
283 bool _setSSSSS =
false;
285 bool _setSSSSSParam =
false;
286 f32 _SSSSSParamRadius;
287 int _SSSSSParamSampleCount;
288 f32 _SSSSSParamApply;
289 bool _setShadowMapScale =
false;
290 float _shadowMapScale;
292 bool _setEnableVignette =
false;
293 bool _enableVignette;
294 bool _setVignette =
false;
296 bool _setIBLIntensity =
false;
298 bool _setBillboardLightModulation =
false;
299 float _billboardLightModulation;
300 bool _setReflectionIntensity =
false;
301 float _reflectionIntensity;
302 bool _setUsetDeferredLighting =
false;
303 bool _usetDeferredLighting;
305 bool _setSharpen =
false;
306 bool _sharpen =
false;
307 bool _setSharpenParam =
false;
308 float _sharpenParamStrength;
309 float _sharpenParamDistance;
311 void copy(settings% o)
313 _setSpriteBatch = o._setSpriteBatch;
314 _spriteBatch = o._spriteBatch;
315 _setCamera = o._setCamera;
316 _cameraProj = o._cameraProj;
317 _cameraView = o._cameraView;
318 _setDLPosture = o._setDLPosture;
319 _directionalLightPosture = o._directionalLightPosture;
320 _setDLColor = o._setDLColor;
321 _directionalLightColor = o._directionalLightColor;
322 _setDLShadowColor = o._setDLShadowColor;
323 _directionalLightShadowColor = o._directionalLightShadowColor;
324 _setDLShadowVM = o._setDLShadowVM;
325 _directionalLightShadowVolumeMargin = o._directionalLightShadowVolumeMargin;
326 _setDLShadowBias = o._setDLShadowBias;
327 _directionalLightShadowBias = o._directionalLightShadowBias;
328 _setDLShadowDistane = o._setDLShadowDistane;
329 _directionalLightShadowDistance = o._directionalLightShadowDistance;
330 _cascadeStep1 = o._cascadeStep1;
331 _cascadeStep2 = o._cascadeStep2;
332 _cascadeStep3 = o._cascadeStep3;
333 _cascadeCount = o._cascadeCount;
334 _enableCascadeVisualize = o._enableCascadeVisualize;
335 _setAmbientLight = o._setAmbientLight;
336 _ambientLight = o._ambientLight;
337 _setViewportSize = o._setViewportSize;
338 _viewportSizeWidth = o._viewportSizeWidth;
339 _viewportSizeHeight = o._viewportSizeHeight;
340 _setDisplayID = o._setDisplayID;
341 _displayID = o._displayID;
342 _setBackGroundColor = o._setBackGroundColor;
343 _backGroundColor = o._backGroundColor;
344 _setBloom = o._setBloom;
346 _setBloomParam = o._setBloomParam;
347 _bloomParamApply = o._bloomParamApply;
348 _bloomParamHilightThreshold = o._bloomParamHilightThreshold;
349 _setAutoExposure = o._setAutoExposure;
350 _autoExposure = o._autoExposure;
351 _setAutoExposureParam = o._setAutoExposureParam;
352 _autoExposureParamTargetBrightness = o._autoExposureParamTargetBrightness;
353 _autoExposureParamMinScale = o._autoExposureParamMinScale;
354 _autoExposureParamMaxScale = o._autoExposureParamMaxScale;
355 _setChromaticAbberation = o._setChromaticAbberation;
356 _chromaticAbberation = o._chromaticAbberation;
357 _setChromaticAbberationParam = o._setChromaticAbberationParam;
358 _chromaticAbberationParmSize = o._chromaticAbberationParmSize;
361 _setDofParam = o._setDofParam;
362 _dofParamSmoothStart = o._dofParamSmoothStart;
363 _dofParamSmoothRange = o._dofParamSmoothRange;
364 _dofParamRadius = o._dofParamRadius;
365 _setFxaa = o._setFxaa;
367 _setReflectionMap = o._setReflectionMap;
368 _reflectionMap = o._reflectionMap;
369 _setSkyBoxMaterial = o._setSkyBoxMaterial;
370 _skyBoxMaterial = o._skyBoxMaterial;
371 _setLutMap = o._setLutMap;
373 _setFogColor = o._setFogColor;
374 _fogColor = o._fogColor;
375 _setFogParam = o._setFogParam;
376 _fogParamStart = o._fogParamStart;
377 _fogParamDepthDensity = o._fogParamDepthDensity;
378 _fogParamHeightFallOff = o._fogParamHeightFallOff;
379 _setSSAOParam = o._setSSAOParam;
380 _ssaoParamRadius = o._ssaoParamRadius;
381 _ssaoParamMinLimit = o._ssaoParamMinLimit;
382 _ssaoParamMaxLimit = o._ssaoParamMaxLimit;
383 _ssaoParamShadowScle = o._ssaoParamShadowScle;
384 _ssaoParamSampleCount = o._ssaoParamSampleCount;
385 _ssaoParamContrast = o._ssaoParamContrast;
386 _ssaoParamColor = o._ssaoParamColor;
387 _setSSSSS = o._setSSSSS;
389 _setSSSSSParam = o._setSSSSSParam;
390 _SSSSSParamRadius = o._SSSSSParamRadius;
391 _SSSSSParamSampleCount = o._SSSSSParamSampleCount;
392 _SSSSSParamApply = o._SSSSSParamApply;
393 _setShadowMapScale = o._setShadowMapScale;
394 _shadowMapScale = o._shadowMapScale;
396 _setEnableVignette = o._setEnableVignette;
397 _enableVignette = o._enableVignette;
398 _setVignette = o._setVignette;
399 _vignatte = o._vignatte;
400 _setIBLIntensity = o._setIBLIntensity;
401 _IBLIntensity = o._IBLIntensity;
402 _setReflectionIntensity = o._setReflectionIntensity;
403 _reflectionIntensity = o._reflectionIntensity;
404 _setUsetDeferredLighting = o._setUsetDeferredLighting;
405 _usetDeferredLighting = o._usetDeferredLighting;
410 settings contextSaved;
413 private ref class GfxTest
417 static void addParticleResourceForLoadTest(System::String^ path);
SSAOBLURTYPE
Definition: GfxTypes.cs:223
SSAOALGORITHM
Definition: GfxTypes.cs:216