diff options
| author | Miles Macklin <[email protected]> | 2018-03-19 15:10:24 +1300 |
|---|---|---|
| committer | Miles Macklin <[email protected]> | 2018-03-19 15:10:24 +1300 |
| commit | 8ee05c79ae1748ef132a12e4fb0af284899faec6 (patch) | |
| tree | 82bd5aa1892e28ce7886b6cfeafe66a47ff38e67 /demo/d3d/shadersDemoContext.cpp | |
| parent | Flex 1.2 (beta 2) (diff) | |
| download | flex-8ee05c79ae1748ef132a12e4fb0af284899faec6.tar.xz flex-8ee05c79ae1748ef132a12e4fb0af284899faec6.zip | |
Flex 1.2.0 release
Diffstat (limited to 'demo/d3d/shadersDemoContext.cpp')
| -rw-r--r-- | demo/d3d/shadersDemoContext.cpp | 184 |
1 files changed, 0 insertions, 184 deletions
diff --git a/demo/d3d/shadersDemoContext.cpp b/demo/d3d/shadersDemoContext.cpp deleted file mode 100644 index d1e7c99..0000000 --- a/demo/d3d/shadersDemoContext.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// to fix min max windows macros -#define NOMINMAX - -// SDL -#include <SDL_syswm.h> - -// This -#include "shadersDemoContext.h" - -DemoContext* s_context = NULL; - -void SetDemoContext(DemoContext* context) -{ - s_context = context; -} - -DemoContext* GetDemoContext() -{ - return s_context; -} - -void ReshapeRender(SDL_Window* window) -{ - int width, height; - SDL_GetWindowSize(window, &width, &height); - s_context->onSizeChanged(width, height, false); -} - -void DestroyRender() -{ - if (s_context) - { - delete s_context; - s_context = nullptr; - } -} - -void StartFrame(Vec4 colorIn) { s_context->startFrame(colorIn); } -void EndFrame() { s_context->endFrame(); } -void PresentFrame(bool fullSync) { s_context->presentFrame(fullSync); } - -void FlushGraphicsAndWait() { s_context->flushGraphicsAndWait(); } - -void ReadFrame(int* backbuffer, int width, int height) -{ - assert(0); -} - -void GetViewRay(int x, int y, Vec3& origin, Vec3& dir) { return s_context->getViewRay(x, y, origin, dir); } - -void SetFillMode(bool wire) { s_context->setFillMode(wire); } - -void SetCullMode(bool enabled) { s_context->setCullMode(enabled); } - -void SetView(Matrix44 view, Matrix44 projection) { return s_context->setView(view, projection); } - -FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height) { return s_context->createFluidRenderer(width, height); } - -void DestroyFluidRenderer(FluidRenderer* renderer) { return s_context->destroyFluidRenderer(renderer); } - -FluidRenderBuffers* CreateFluidRenderBuffers(int numParticles, bool enableInterop) { return s_context->createFluidRenderBuffers(numParticles, enableInterop); } - -void UpdateFluidRenderBuffers(FluidRenderBuffers* buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) -{ - s_context->updateFluidRenderBuffers(buffers, particles, densities, anisotropy1, anisotropy2, anisotropy3, numParticles, indices, numIndices); -} - -void UpdateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density) { return s_context->updateFluidRenderBuffers(buffers, flex, anisotropy, density); } - -void DestroyFluidRenderBuffers(FluidRenderBuffers* buffers) { return s_context->destroyFluidRenderBuffers(buffers); } - -ShadowMap* ShadowCreate() { return s_context->shadowCreate(); } - -void ShadowDestroy(ShadowMap* map) { s_context->shadowDestroy(map); } - -void ShadowBegin(ShadowMap* map) { s_context->shadowBegin(map); } - -void ShadowEnd() { s_context->shadowEnd(); } - - -void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor) -{ - s_context->bindSolidShader(lightPos, lightTarget, lightTransform, shadowMap, bias, fogColor); -} - -void UnbindSolidShader() { s_context->unbindSolidShader(); } - -void DrawMesh(const Mesh* m, Vec3 color) { s_context->drawMesh(m, color); } - -void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) -{ - s_context->drawCloth(positions, normals, uvs, indices, numTris, numPositions, colorIndex, expand, twosided, smooth); -} - -void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) -{ - s_context->drawRope(positions, indices, numIndices, radius, color); -} - -void DrawPlane(const Vec4& p, bool color) { s_context->drawPlane(p, color); } - -void DrawPlanes(Vec4* planes, int n, float bias) { s_context->drawPlanes(planes, n, bias); } - -GpuMesh* CreateGpuMesh(const Mesh* m) -{ - return m ? s_context->createGpuMesh(m) : nullptr; -} - -void DestroyGpuMesh(GpuMesh* m) { s_context->destroyGpuMesh(m); } - -void DrawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color) { s_context->drawGpuMesh(m, xform, color); } - -void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color) { s_context->drawGpuMeshInstances(m, xforms, n, color); } - -void DrawPoints(FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity) -{ - s_context->drawPoints(buffers, n, offset, radius, screenWidth, screenAspect, fov, lightPos, lightTarget, lightTransform, shadowTex, showDensity); -} - -void RenderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) -{ - s_context->renderEllipsoids(renderer, buffers, n, offset, radius, screenWidth, screenAspect, fov, lightPos, lightTarget, lightTransform, shadowMap, color, blur, ior, debug); -} - -DiffuseRenderBuffers* CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop) { return s_context->createDiffuseRenderBuffers(numDiffuseParticles, enableInterop); } - -void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers) { return s_context->destroyDiffuseRenderBuffers(buffers); } - -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) -{ - s_context->updateDiffuseRenderBuffers(buffers, diffusePositions, diffuseVelocities, numDiffuseParticles); -} - -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver) { return s_context->updateDiffuseRenderBuffers(buffers, solver); } - -int GetNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) { return s_context->getNumDiffuseRenderParticles(buffers); } - -void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers* buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) -{ - s_context->drawDiffuse(render, buffers, n, radius, screenWidth, screenAspect, fov, color, lightPos, lightTarget, lightTransform, shadowMap, motionBlur, inscatter, outscatter, shadowEnabled, front); -} - -void BeginLines() { s_context->beginLines(); } - -void DrawLine(const Vec3& p, const Vec3& q, const Vec4& color) { s_context->drawLine(p, q, color); } - -void EndLines() { s_context->endLines(); } - -void BeginPoints(float size) {} -void DrawPoint(const Vec3& p, const Vec4& color) {} -void EndPoints() {} - -float RendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) -{ - return s_context->rendererGetDeviceTimestamps(begin, end, freq); -} - -void* GetGraphicsCommandQueue() { return s_context->getGraphicsCommandQueue(); } -void GraphicsTimerBegin() { s_context->graphicsTimerBegin(); } -void GraphicsTimerEnd() { s_context->graphicsTimerEnd(); } - -void StartGpuWork() { s_context->startGpuWork(); } -void EndGpuWork() { s_context->endGpuWork(); } - -void DrawImguiGraph() { return s_context->drawImguiGraph(); } - -void GetRenderDevice(void** deviceOut, void** contextOut) { return s_context->getRenderDevice(deviceOut, contextOut); } - -void InitRender(const RenderInitOptions& options) -{ - if (!s_context) - { - assert(false && "A context has not been set with SetDemoContext!"); - return; - } - if (!s_context->initialize(options)) - { - assert(!"Unable to initialize context!"); - delete s_context; - s_context = nullptr; - return; - } -} - |