aboutsummaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
Diffstat (limited to 'demo')
-rw-r--r--demo/benchmark.h192
-rw-r--r--demo/compiler/makeandroid/Makefile203
-rw-r--r--demo/compiler/makeandroid/Makefile.flexCUDA.mk225
-rw-r--r--demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk136
-rw-r--r--demo/compiler/makeandroid/Makefile.flexDevice.mk100
-rw-r--r--demo/compiler/makeandroid/Makefile.flexExtCUDA.mk205
-rw-r--r--demo/compiler/makelinux64/Makefile198
-rw-r--r--demo/compiler/makelinux64/Makefile.flexCUDA.mk217
-rw-r--r--demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk201
-rw-r--r--demo/compiler/makelinux64/Makefile.flexDevice.mk177
-rw-r--r--demo/compiler/makelinux64/Makefile.flexExtCUDA.mk197
-rw-r--r--demo/compiler/vc12win32/flexDemoCUDA.sln33
-rw-r--r--demo/compiler/vc12win32/flexDemoCUDA.vcxproj347
-rw-r--r--demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters351
-rw-r--r--demo/compiler/vc12win32/flexDemoCUDA.vcxproj.user9
-rw-r--r--demo/compiler/vc12win32/flexDemoD3D.sln33
-rw-r--r--demo/compiler/vc12win32/flexDemoD3D.vcxproj720
-rw-r--r--demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters456
-rw-r--r--demo/compiler/vc12win32/flexDemoD3D.vcxproj.user9
-rw-r--r--demo/compiler/vc12win64/flexDemoCUDA.sln33
-rw-r--r--demo/compiler/vc12win64/flexDemoCUDA.vcxproj347
-rw-r--r--demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters351
-rw-r--r--demo/compiler/vc12win64/flexDemoCUDA.vcxproj.user9
-rw-r--r--demo/compiler/vc12win64/flexDemoD3D.sln33
-rw-r--r--demo/compiler/vc12win64/flexDemoD3D.vcxproj720
-rw-r--r--demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters456
-rw-r--r--demo/compiler/vc12win64/flexDemoD3D.vcxproj.user9
-rw-r--r--demo/compiler/vc14win32/flexDemoCUDA.sln33
-rw-r--r--demo/compiler/vc14win32/flexDemoCUDA.vcxproj347
-rw-r--r--demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters351
-rw-r--r--demo/compiler/vc14win32/flexDemoCUDA.vcxproj.user9
-rw-r--r--demo/compiler/vc14win32/flexDemoD3D.sln33
-rw-r--r--demo/compiler/vc14win32/flexDemoD3D.vcxproj720
-rw-r--r--demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters456
-rw-r--r--demo/compiler/vc14win32/flexDemoD3D.vcxproj.user9
-rw-r--r--demo/compiler/vc14win64/flexDemoCUDA.sln33
-rw-r--r--demo/compiler/vc14win64/flexDemoCUDA.vcxproj347
-rw-r--r--demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters351
-rw-r--r--demo/compiler/vc14win64/flexDemoCUDA.vcxproj.user9
-rw-r--r--demo/compiler/vc14win64/flexDemoD3D.sln33
-rw-r--r--demo/compiler/vc14win64/flexDemoD3D.vcxproj720
-rw-r--r--demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters456
-rw-r--r--demo/compiler/vc14win64/flexDemoD3D.vcxproj.user9
-rw-r--r--demo/compiler/xpj/flexDemoCUDA.xpj298
-rw-r--r--demo/compiler/xpj/flexDemoD3D.xpj208
-rw-r--r--demo/d3d11/appD3D11Ctx.cpp761
-rw-r--r--demo/d3d11/appD3D11Ctx.h93
-rw-r--r--demo/d3d11/debugLineRender.h199
-rw-r--r--demo/d3d11/diffuseRender.cpp217
-rw-r--r--demo/d3d11/diffuseRender.h69
-rw-r--r--demo/d3d11/fluidRender.cpp458
-rw-r--r--demo/d3d11/fluidRender.h126
-rw-r--r--demo/d3d11/imguiGraph.cpp472
-rw-r--r--demo/d3d11/imguiGraph.h29
-rw-r--r--demo/d3d11/imguiGraphD3D11.cpp473
-rw-r--r--demo/d3d11/imguiGraphD3D11.h67
-rw-r--r--demo/d3d11/meshRender.cpp221
-rw-r--r--demo/d3d11/meshRender.h297
-rw-r--r--demo/d3d11/pointRender.cpp206
-rw-r--r--demo/d3d11/pointRender.h88
-rw-r--r--demo/d3d11/renderTarget.cpp146
-rw-r--r--demo/d3d11/renderTarget.h51
-rw-r--r--demo/d3d11/shaders/blurDepthPS.hlsl91
-rw-r--r--demo/d3d11/shaders/blurDepthPS.hlsl.h664
-rw-r--r--demo/d3d11/shaders/compositePS.hlsl194
-rw-r--r--demo/d3d11/shaders/compositePS.hlsl.h1643
-rw-r--r--demo/d3d11/shaders/debugLinePS.hlsl10
-rw-r--r--demo/d3d11/shaders/debugLinePS.hlsl.h121
-rw-r--r--demo/d3d11/shaders/debugLineVS.hlsl26
-rw-r--r--demo/d3d11/shaders/debugLineVS.hlsl.h213
-rw-r--r--demo/d3d11/shaders/diffuseGS.hlsl176
-rw-r--r--demo/d3d11/shaders/diffuseGS.hlsl.h973
-rw-r--r--demo/d3d11/shaders/diffusePS.hlsl37
-rw-r--r--demo/d3d11/shaders/diffusePS.hlsl.h216
-rw-r--r--demo/d3d11/shaders/diffuseVS.hlsl26
-rw-r--r--demo/d3d11/shaders/diffuseVS.hlsl.h425
-rw-r--r--demo/d3d11/shaders/ellipsoidDepthGS.hlsl127
-rw-r--r--demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h414
-rw-r--r--demo/d3d11/shaders/ellipsoidDepthPS.hlsl108
-rw-r--r--demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h662
-rw-r--r--demo/d3d11/shaders/ellipsoidDepthVS.hlsl195
-rw-r--r--demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h940
-rw-r--r--demo/d3d11/shaders/imguiPS.hlsl22
-rw-r--r--demo/d3d11/shaders/imguiPS.hlsl.h197
-rw-r--r--demo/d3d11/shaders/imguiVS.hlsl31
-rw-r--r--demo/d3d11/shaders/imguiVS.hlsl.h248
-rw-r--r--demo/d3d11/shaders/meshPS.hlsl130
-rw-r--r--demo/d3d11/shaders/meshPS.hlsl.h1553
-rw-r--r--demo/d3d11/shaders/meshShadowPS.hlsl11
-rw-r--r--demo/d3d11/shaders/meshShadowPS.hlsl.h156
-rw-r--r--demo/d3d11/shaders/meshVS.hlsl91
-rw-r--r--demo/d3d11/shaders/meshVS.hlsl.h635
-rw-r--r--demo/d3d11/shaders/passThroughVS.hlsl26
-rw-r--r--demo/d3d11/shaders/passThroughVS.hlsl.h145
-rw-r--r--demo/d3d11/shaders/pointGS.hlsl84
-rw-r--r--demo/d3d11/shaders/pointGS.hlsl.h740
-rw-r--r--demo/d3d11/shaders/pointPS.hlsl103
-rw-r--r--demo/d3d11/shaders/pointPS.hlsl.h947
-rw-r--r--demo/d3d11/shaders/pointVS.hlsl26
-rw-r--r--demo/d3d11/shaders/pointVS.hlsl.h374
-rw-r--r--demo/d3d11/shaders/shaderCommon.h237
-rw-r--r--demo/d3d11/shadersD3D11.cpp1041
-rw-r--r--demo/d3d11/shadowMap.cpp162
-rw-r--r--demo/d3d11/shadowMap.h51
-rw-r--r--demo/helpers.h1698
-rw-r--r--demo/imgui.cpp699
-rw-r--r--demo/imgui.h110
-rw-r--r--demo/main.cpp3012
-rw-r--r--demo/opengl/imguiRenderGL.cpp484
-rw-r--r--demo/opengl/imguiRenderGL.h26
-rw-r--r--demo/opengl/shader.cpp248
-rw-r--r--demo/opengl/shader.h84
-rw-r--r--demo/opengl/shadersGL.cpp2772
-rw-r--r--demo/scenes.h115
-rw-r--r--demo/scenes/adhesion.h50
-rw-r--r--demo/scenes/armadilloshower.h75
-rw-r--r--demo/scenes/bananas.h60
-rw-r--r--demo/scenes/bouyancy.h76
-rw-r--r--demo/scenes/bunnybath.h84
-rw-r--r--demo/scenes/ccdfluid.h107
-rw-r--r--demo/scenes/clothlayers.h81
-rw-r--r--demo/scenes/dambreak.h62
-rw-r--r--demo/scenes/darts.h59
-rw-r--r--demo/scenes/debris.h319
-rw-r--r--demo/scenes/deformables.h42
-rw-r--r--demo/scenes/envcloth.h77
-rw-r--r--demo/scenes/flag.h83
-rw-r--r--demo/scenes/fluidblock.h72
-rw-r--r--demo/scenes/fluidclothcoupling.h192
-rw-r--r--demo/scenes/forcefield.h92
-rw-r--r--demo/scenes/frictionmoving.h93
-rw-r--r--demo/scenes/frictionramp.h40
-rw-r--r--demo/scenes/gamemesh.h191
-rw-r--r--demo/scenes/googun.h72
-rw-r--r--demo/scenes/granularpile.h57
-rw-r--r--demo/scenes/granularshape.h36
-rw-r--r--demo/scenes/inflatable.h159
-rw-r--r--demo/scenes/initialoverlap.h30
-rw-r--r--demo/scenes/lighthouse.h59
-rw-r--r--demo/scenes/localspacecloth.h134
-rw-r--r--demo/scenes/localspacefluid.h127
-rw-r--r--demo/scenes/lowdimensionalshapes.h54
-rw-r--r--demo/scenes/melting.h70
-rw-r--r--demo/scenes/mixedpile.h221
-rw-r--r--demo/scenes/nonconvex.h47
-rw-r--r--demo/scenes/parachutingbunnies.h167
-rw-r--r--demo/scenes/pasta.h47
-rw-r--r--demo/scenes/plasticbody.h271
-rw-r--r--demo/scenes/plasticstack.h50
-rw-r--r--demo/scenes/player.h290
-rw-r--r--demo/scenes/potpourri.h117
-rw-r--r--demo/scenes/rayleightaylor.h143
-rw-r--r--demo/scenes/restitution.h27
-rw-r--r--demo/scenes/ridigbody.h139
-rw-r--r--demo/scenes/rigidfluidcoupling.h61
-rw-r--r--demo/scenes/rigidpile.h129
-rw-r--r--demo/scenes/rigidrotation.h56
-rw-r--r--demo/scenes/rockpool.h78
-rw-r--r--demo/scenes/sdfcollision.h54
-rw-r--r--demo/scenes/shapecollision.h101
-rw-r--r--demo/scenes/softbody.h325
-rw-r--r--demo/scenes/spherecloth.h85
-rw-r--r--demo/scenes/surfacetension.h57
-rw-r--r--demo/scenes/tearing.h132
-rw-r--r--demo/scenes/thinbox.h66
-rw-r--r--demo/scenes/trianglecollision.h47
-rw-r--r--demo/scenes/triggervolume.h81
-rw-r--r--demo/scenes/viscosity.h79
-rw-r--r--demo/scenes/waterballoon.h336
-rw-r--r--demo/shaders.h182
-rw-r--r--demo/stb_truetype.h1810
171 files changed, 45732 insertions, 0 deletions
diff --git a/demo/benchmark.h b/demo/benchmark.h
new file mode 100644
index 0000000..c0ab7c2
--- /dev/null
+++ b/demo/benchmark.h
@@ -0,0 +1,192 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2013-2017 NVIDIA Corporation. All rights reserved.
+
+#pragma once
+
+#include <iomanip>
+
+const char* g_benchmarkFilename = "../../benchmark.txt";
+std::ofstream g_benchmarkFile;
+
+// returns the new scene if one is requested
+int BenchmarkUpdate()
+{
+ // Enable console benchmark profiling
+ static NvFlexTimers sTimersSum;
+ static std::vector<NvFlexDetailTimer> sDTimersSum;
+ static float sTotalFrameTime = 0.0f;
+ static int sSamples = 0;
+
+ static int benchmarkIter = 0;
+ const int numBenchmarks = 5;
+ const char* benchmarkList[numBenchmarks] = { "Env Cloth Small", "Viscosity Med", "Inflatables", "Game Mesh Particles", "Rigid4" };
+ const char* benchmarkChartPrefix[numBenchmarks] = { "EnvClothSmall", "ViscosityMed", "Inflatables", "GameMeshParticles", "Rigid4" }; //no spaces
+ //float benchmarkEnergyCheck[numBenchmarks] = { 6000, 1000, 1000, 150426, 63710 };
+
+ int newScene = -1;
+
+ if (g_benchmark && benchmarkIter == 0 && g_frame == 1)
+ {
+ // check and see if the first scene is the same as the first benchmark
+ // switch to benchmark if it is not the same
+ if (strcmp(benchmarkList[0], g_scenes[g_scene]->GetName()) == 0)
+ benchmarkIter++;
+ else
+ g_frame = -1;
+ }
+
+ if (g_frame == 200)
+ {
+ memset(&sTimersSum, 0, sizeof(NvFlexTimers));
+ sTotalFrameTime = 0.0f;
+ sSamples = 0;
+ g_emit = true;
+ sDTimersSum.resize(g_numDetailTimers);
+ }
+ if (g_frame >= 200 && g_frame < 400)
+ {
+ sTotalFrameTime += g_realdt * 1000.0f; //convert to milliseconds
+
+ for (int i = 0; i < g_numDetailTimers; i++) {
+ sDTimersSum[i].name = g_detailTimers[i].name;
+ sDTimersSum[i].time += g_detailTimers[i].time;
+ }
+
+ sTimersSum.total += g_timers.total;
+
+ sSamples++;
+ }
+ if (g_frame == 400)
+ {
+
+ for (int i = 0; i < g_numDetailTimers; i++) {
+ sDTimersSum[i].time /= sSamples;
+ }
+
+ if (g_teamCity)
+ {
+ const char* prefix = benchmarkChartPrefix[benchmarkIter - 1];
+
+ float exclusive = 0.0f;
+
+ for (int i = 0; i < g_numDetailTimers - 1; i++) {
+ exclusive += sDTimersSum[i].time;
+ }
+
+ printf("##teamcity[buildStatisticValue key='%s_FrameTime' value='%f']\n", prefix, sTotalFrameTime / sSamples);
+ printf("##teamcity[buildStatisticValue key='%s_SumKernel' value='%f']\n", prefix, exclusive);
+
+ for (int i = 0; i < g_numDetailTimers - 1; i++) {
+ printf("##teamcity[buildStatisticValue key='%s_%s' value='%f']\n", prefix, sDTimersSum[i].name, sDTimersSum[i].time);
+ }
+ printf("\n");
+ }
+ else
+ {
+ printf("Scene: %s\n", g_scenes[g_scene]->GetName());
+ printf("FrameTime %f\n", sTotalFrameTime / sSamples);
+ printf("________________________________\n");
+ float exclusive = 0.0f;
+
+ for (int i = 0; i < g_numDetailTimers-1; i++) {
+ exclusive += sDTimersSum[i].time;
+ printf("%s %f\n", sDTimersSum[i].name, sDTimersSum[i].time);
+ }
+ printf("Sum(exclusive) %f\n", exclusive);
+ printf("Sum(inclusive) %f\n", sDTimersSum[g_numDetailTimers - 1].time);
+ printf("________________________________\n");
+ }
+
+ // Dumping benchmark data to txt files
+
+ g_benchmarkFile.open(g_benchmarkFilename, std::ofstream::out | std::ofstream::app);
+ g_benchmarkFile << std::fixed << std::setprecision(6);
+ g_benchmarkFile << "Scene: " << g_scenes[g_scene]->GetName() << std::endl;
+ g_benchmarkFile << "FrameTime " << sTotalFrameTime / sSamples << std::endl;
+ g_benchmarkFile << "________________________________" << std::endl;
+ float exclusive = 0.0f;
+
+ for (int i = 0; i < g_numDetailTimers - 1; i++) {
+ exclusive += sDTimersSum[i].time;
+ g_benchmarkFile << sDTimersSum[i].name<<" "<< sDTimersSum[i].time << std::endl;
+ }
+
+ g_benchmarkFile << "Sum(exclusive) "<< exclusive << std::endl;
+ g_benchmarkFile << "Sum(inclusive) "<< sDTimersSum[g_numDetailTimers - 1].time<< std::endl;
+ g_benchmarkFile << "________________________________" << std::endl << std::endl;
+ g_benchmarkFile.close();
+
+ if (g_benchmark)
+ {
+
+#if 0
+ // Do basic kinetic energy verification check to ensure that the benchmark runs correctly
+ NvFlexGetVelocities(g_flex, g_buffers->velocities.buffer, g_buffers->velocities.size());
+
+ float sumVelocities = 0.0f;
+ for (int i = 0; i < g_buffers->velocities.size(); ++i)
+ {
+ sumVelocities += g_buffers->velocities[i].x * g_buffers->velocities[i].x + g_buffers->velocities[i].y * g_buffers->velocities[i].y + g_buffers->velocities[i].z * g_buffers->velocities[i].z;
+ }
+ // Tolerance 50%
+ int benchmark_id = benchmarkIter - 1;
+ if (sumVelocities > (benchmarkEnergyCheck[benchmark_id] * 1.50) ||
+ sumVelocities < (benchmarkEnergyCheck[benchmark_id] * 0.50))
+ printf("Benchmark kinetic energy verification failed! Expected: [%f], Actual: [%f]\n\n", benchmarkEnergyCheck[benchmark_id], sumVelocities);
+#endif
+
+ g_frame = -1;
+ }
+ }
+
+ if (g_benchmark && g_frame == -1)
+ {
+ if (benchmarkIter == numBenchmarks)
+ exit(0);
+
+ for (int i = 0; i < int(g_scenes.size()); ++i)
+ {
+ if (strcmp(benchmarkList[benchmarkIter], g_scenes[i]->GetName()) == 0)
+ newScene = i;
+ }
+ assert(newScene != -1);
+
+ benchmarkIter++;
+ }
+
+ return newScene;
+}
+
+void BenchmarkInit()
+{
+ g_benchmarkFile.open(g_benchmarkFilename, std::ofstream::out | std::ofstream::app);
+ g_benchmarkFile << "Compute Device: " << g_deviceName << std::endl;
+ g_benchmarkFile << "HLSL Extensions: " << (g_extensions ? "ON" : "OFF") << std::endl << std::endl;
+ g_benchmarkFile.close();
+}
+
+
diff --git a/demo/compiler/makeandroid/Makefile b/demo/compiler/makeandroid/Makefile
new file mode 100644
index 0000000..0b462ff
--- /dev/null
+++ b/demo/compiler/makeandroid/Makefile
@@ -0,0 +1,203 @@
+#!/usr/bin/make
+# Makefile generated by XPJ for android
+
+DEPSDIR = .deps
+NDKROOT = "$(NDK_ROOT)"/"$(NDK_VERSION)"
+NDK_BIN_DIR = "$(NDK_ROOT)"/"$(NDK_VERSION)"/toolchains/"$(NDK_TOOLCHAIN)"/prebuilt/"linux-x86_64"/bin
+NDK_PREFIX = arm-linux-androideabi-
+JAVA_HOME = ./../xpj/"$(JAVA_HOME)"
+ANT_TOOL = ./../xpj/"$(ANT_HOME}"/bin/ant
+#default defines
+OBJS_DIR = build
+RMDIR = rm -fr
+ECHO = echo
+CCLD = $(NDK_BIN_DIR)/$(NDK_PREFIX)g++
+CXX = $(NDK_BIN_DIR)/$(NDK_PREFIX)g++
+CC = $(NDK_BIN_DIR)/$(NDK_PREFIX)gcc
+RANLIB = $(NDK_BIN_DIR)/$(NDK_PREFIX)ranlib
+AR = $(NDK_BIN_DIR)/$(NDK_PREFIX)ar
+STRIP = $(NDK_BIN_DIR)/$(NDK_PREFIX)strip
+OBJDUMP = $(NDK_BIN_DIR)/$(NDK_PREFIX)objdump
+OBJCOPY = $(NDK_BIN_DIR)/$(NDK_PREFIX)objcopy
+-include Makedefs.ANDROID.mk
+
+all: debug release
+
+debug: build_flexExtCUDA_debug
+
+release: build_flexExtCUDA_release build_flexDemoCUDA_release
+
+clean: clean_flexExtCUDA_release clean_flexExtCUDA_debug clean_flexDemoCUDA_release
+ rm -rf $(DEPSDIR)
+
+
+clean_release: clean_flexExtCUDA_release clean_flexDemoCUDA_release
+ rm -rf $(DEPSDIR)
+
+
+clean_debug: clean_flexExtCUDA_debug clean_flexDemoCUDA_debug
+ rm -rf $(DEPSDIR)
+
+
+include Makefile.flexExtCUDA.mk
+include Makefile.flexDemoCUDA.mk
+
+
+# Disable implicit rules to speedup build
+.SUFFIXES:
+SUFFIXES :=
+%.out:
+%.a:
+%.ln:
+%.o:
+%: %.o
+%.c:
+%: %.c
+%.ln: %.c
+%.o: %.c
+%.cc:
+%: %.cc
+%.o: %.cc
+%.C:
+%: %.C
+%.o: %.C
+%.cpp:
+%: %.cpp
+%.o: %.cpp
+%.p:
+%: %.p
+%.o: %.p
+%.f:
+%:
+ %.f%.o: %.f
+%.F:
+%: %.F
+%.o: %.F
+%.f: %.F
+%.r:
+%: %.r
+%.o: %.r
+%.f: %.r
+%.y:
+%.ln: %.y
+%.c: %.y
+%.l:
+%.ln: %.l
+%.c: %.l
+%.r: %.l
+%.s:
+%: %.s
+%.o: %.s
+%.S:
+%: %.S
+%.o: %.S
+%.s: %.S
+%.mod:
+%: %.mod
+%.o: %.mod
+%.sym:
+%.def:
+%.sym: %.def
+%.h:
+%.info:
+%.dvi:
+%.tex:
+%.dvi: %.tex
+%.texinfo:
+%.info: %.texinfo
+%.dvi: %.texinfo
+%.texi:
+%.info: %.texi
+%.dvi: %.texi
+%.txinfo:
+%.info: %.txinfo
+%.dvi: %.txinfo
+%.w:
+%.c: %.w
+%.tex: %.w
+%.ch:
+%.web:
+%.p: %.web
+%.tex: %.web
+%.sh:
+%: %.sh
+%.elc:
+%.el:
+(%): %
+%.out: %
+%.c: %.w %.ch
+%.tex: %.w %.ch
+%: %,v
+%: RCS/%,v
+%: RCS/%
+%: s.%
+%: SCCS/s.%
+.web.p:
+.l.r:
+.dvi:
+.F.o:
+.l:
+.y.ln:
+.o:
+.y:
+.def.sym:
+.p.o:
+.p:
+.txinfo.dvi:
+.a:
+.l.ln:
+.w.c:
+.texi.dvi:
+.sh:
+.cc:
+.cc.o:
+.def:
+.c.o:
+.r.o:
+.r:
+.info:
+.elc:
+.l.c:
+.out:
+.C:
+.r.f:
+.S:
+.texinfo.info:
+.c:
+.w.tex:
+.c.ln:
+.s.o:
+.s:
+.texinfo.dvi:
+.el:
+.texinfo:
+.y.c:
+.web.tex:
+.texi.info:
+.DEFAULT:
+.h:
+.tex.dvi:
+.cpp.o:
+.cpp:
+.C.o:
+.ln:
+.texi:
+.txinfo:
+.tex:
+.txinfo.info:
+.ch:
+.S.s:
+.mod:
+.mod.o:
+.F.f:
+.w:
+.S.o:
+.F:
+.web:
+.sym:
+.f:
+.f.o:
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makeandroid/Makefile.flexCUDA.mk b/demo/compiler/makeandroid/Makefile.flexCUDA.mk
new file mode 100644
index 0000000..2f9e44a
--- /dev/null
+++ b/demo/compiler/makeandroid/Makefile.flexCUDA.mk
@@ -0,0 +1,225 @@
+# Makefile generated by XPJ for android
+-include Makefile.custom
+ProjectName = flexCUDA
+flexCUDA_cppfiles += ./../../../src/cuda/util.cpp
+flexCUDA_cuda_src_cuda_bvh_cu += ./../../../src/cuda/bvh.cu
+flexCUDA_cuda_src_cuda_flex_cu += ./../../../src/cuda/flex.cu
+flexCUDA_cuda_src_cuda_sort_cu += ./../../../src/cuda/sort.cu
+
+flexCUDA_cpp_release_dep = $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexCUDA_cppfiles)))))
+flexCUDA_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexCUDA_ccfiles)))))
+flexCUDA_c_release_dep = $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexCUDA_cfiles)))))
+flexCUDA_release_dep = $(flexCUDA_cpp_release_dep) $(flexCUDA_cc_release_dep) $(flexCUDA_c_release_dep)
+-include $(flexCUDA_release_dep)
+flexCUDA_cpp_debug_dep = $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexCUDA_cppfiles)))))
+flexCUDA_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(flexCUDA_ccfiles)))))
+flexCUDA_c_debug_dep = $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexCUDA_cfiles)))))
+flexCUDA_debug_dep = $(flexCUDA_cpp_debug_dep) $(flexCUDA_cc_debug_dep) $(flexCUDA_c_debug_dep)
+-include $(flexCUDA_debug_dep)
+flexCUDA_release_hpaths :=
+flexCUDA_release_hpaths += ./../../..
+flexCUDA_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include
+flexCUDA_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport
+flexCUDA_release_hpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include
+flexCUDA_release_lpaths :=
+flexCUDA_release_lpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/lib
+flexCUDA_release_lpaths += ./../../../lib/android
+flexCUDA_release_lpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/libs/armeabi-v7a
+flexCUDA_release_defines := $(flexCUDA_custom_defines)
+flexCUDA_release_defines += android
+flexCUDA_release_defines += ANDROID=1
+flexCUDA_release_defines += ANDROID_PLAT=1
+flexCUDA_release_defines += DISABLE_IMPORTGL
+flexCUDA_release_libraries :=
+flexCUDA_release_common_cflags := $(flexCUDA_custom_cflags)
+flexCUDA_release_common_cflags += -MMD
+flexCUDA_release_common_cflags += $(addprefix -D, $(flexCUDA_release_defines))
+flexCUDA_release_common_cflags += $(addprefix -I, $(flexCUDA_release_hpaths))
+flexCUDA_release_cflags := $(flexCUDA_release_common_cflags)
+flexCUDA_release_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexCUDA_release_cflags += -O3 -ffast-math
+flexCUDA_release_cppflags := $(flexCUDA_release_common_cflags)
+flexCUDA_release_cppflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexCUDA_release_cppflags += -O3 -ffast-math
+flexCUDA_release_lflags := $(flexCUDA_custom_lflags)
+flexCUDA_release_lflags += $(addprefix -L, $(flexCUDA_release_lpaths))
+flexCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexCUDA_release_libraries)) -Wl,--end-group
+flexCUDA_release_objsdir = $(OBJS_DIR)/flexCUDA_release
+flexCUDA_release_cpp_o = $(addprefix $(flexCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexCUDA_cppfiles)))))
+flexCUDA_release_cc_o = $(addprefix $(flexCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexCUDA_ccfiles)))))
+flexCUDA_release_c_o = $(addprefix $(flexCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexCUDA_cfiles)))))
+flexCUDA_release_cuda_src_cuda_bvh_cu_o += $(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o
+flexCUDA_release_cuda_src_cuda_flex_cu_o += $(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o
+flexCUDA_release_cuda_src_cuda_sort_cu_o += $(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o
+flexCUDA_release_obj = $(flexCUDA_release_cpp_o) $(flexCUDA_release_cc_o) $(flexCUDA_release_c_o) $(flexCUDA_release_cuda_src_cuda_bvh_cu_o) $(flexCUDA_release_cuda_src_cuda_flex_cu_o) $(flexCUDA_release_cuda_src_cuda_sort_cu_o)
+flexCUDA_release_bin := ./../../../lib/android/libNvFlexReleaseCUDA_armv7l.a
+
+clean_flexCUDA_release:
+ @$(ECHO) clean flexCUDA release
+ @$(RMDIR) $(flexCUDA_release_objsdir)
+ @$(RMDIR) $(flexCUDA_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexCUDA/release
+
+build_flexCUDA_release: postbuild_flexCUDA_release
+postbuild_flexCUDA_release: mainbuild_flexCUDA_release
+mainbuild_flexCUDA_release: prebuild_flexCUDA_release $(flexCUDA_release_bin)
+prebuild_flexCUDA_release:
+
+$(flexCUDA_release_bin): $(flexCUDA_release_obj)
+ mkdir -p `dirname ./../../../lib/android/libNvFlexReleaseCUDA_armv7l.a`
+ @$(AR) rcs $(flexCUDA_release_bin) $(flexCUDA_release_obj)
+ $(ECHO) building $@ complete!
+
+$(flexCUDA_release_cuda_src_cuda_bvh_cu_o): $(flexCUDA_cuda_src_cuda_bvh_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o`
+ $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o"
+ "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o"
+
+$(flexCUDA_release_cuda_src_cuda_flex_cu_o): $(flexCUDA_cuda_src_cuda_flex_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o`
+ $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o"
+ "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o"
+
+$(flexCUDA_release_cuda_src_cuda_sort_cu_o): $(flexCUDA_cuda_src_cuda_sort_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o`
+ $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o"
+ "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o"
+
+flexCUDA_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexCUDA_release_cpp_o): $(flexCUDA_release_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))))))
+ cp $(flexCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ rm -f $(flexCUDA_release_DEPDIR).d
+
+$(flexCUDA_release_cc_o): $(flexCUDA_release_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))))))
+ cp $(flexCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))))).release.P; \
+ rm -f $(flexCUDA_release_DEPDIR).d
+
+$(flexCUDA_release_c_o): $(flexCUDA_release_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexCUDA_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))))))
+ cp $(flexCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ rm -f $(flexCUDA_release_DEPDIR).d
+
+flexCUDA_debug_hpaths :=
+flexCUDA_debug_hpaths += ./../../..
+flexCUDA_debug_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include
+flexCUDA_debug_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport
+flexCUDA_debug_hpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include
+flexCUDA_debug_lpaths :=
+flexCUDA_debug_lpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/lib
+flexCUDA_debug_lpaths += ./../../../lib/android
+flexCUDA_debug_lpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/libs/armeabi-v7a
+flexCUDA_debug_defines := $(flexCUDA_custom_defines)
+flexCUDA_debug_defines += android
+flexCUDA_debug_defines += ANDROID=1
+flexCUDA_debug_defines += ANDROID_PLAT=1
+flexCUDA_debug_defines += DISABLE_IMPORTGL
+flexCUDA_debug_libraries :=
+flexCUDA_debug_common_cflags := $(flexCUDA_custom_cflags)
+flexCUDA_debug_common_cflags += -MMD
+flexCUDA_debug_common_cflags += $(addprefix -D, $(flexCUDA_debug_defines))
+flexCUDA_debug_common_cflags += $(addprefix -I, $(flexCUDA_debug_hpaths))
+flexCUDA_debug_cflags := $(flexCUDA_debug_common_cflags)
+flexCUDA_debug_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexCUDA_debug_cflags += -g -O0
+flexCUDA_debug_cppflags := $(flexCUDA_debug_common_cflags)
+flexCUDA_debug_cppflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexCUDA_debug_cppflags += -g -O0
+flexCUDA_debug_lflags := $(flexCUDA_custom_lflags)
+flexCUDA_debug_lflags += $(addprefix -L, $(flexCUDA_debug_lpaths))
+flexCUDA_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexCUDA_debug_libraries)) -Wl,--end-group
+flexCUDA_debug_objsdir = $(OBJS_DIR)/flexCUDA_debug
+flexCUDA_debug_cpp_o = $(addprefix $(flexCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexCUDA_cppfiles)))))
+flexCUDA_debug_cc_o = $(addprefix $(flexCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexCUDA_ccfiles)))))
+flexCUDA_debug_c_o = $(addprefix $(flexCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexCUDA_cfiles)))))
+flexCUDA_debug_cuda_src_cuda_bvh_cu_o += $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o
+flexCUDA_debug_cuda_src_cuda_flex_cu_o += $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o
+flexCUDA_debug_cuda_src_cuda_sort_cu_o += $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o
+flexCUDA_debug_obj = $(flexCUDA_debug_cpp_o) $(flexCUDA_debug_cc_o) $(flexCUDA_debug_c_o) $(flexCUDA_debug_cuda_src_cuda_bvh_cu_o) $(flexCUDA_debug_cuda_src_cuda_flex_cu_o) $(flexCUDA_debug_cuda_src_cuda_sort_cu_o)
+flexCUDA_debug_bin := ./../../../lib/android/libNvFlexDebugCUDA_armv7l.a
+
+clean_flexCUDA_debug:
+ @$(ECHO) clean flexCUDA debug
+ @$(RMDIR) $(flexCUDA_debug_objsdir)
+ @$(RMDIR) $(flexCUDA_debug_bin)
+ @$(RMDIR) $(DEPSDIR)/flexCUDA/debug
+
+build_flexCUDA_debug: postbuild_flexCUDA_debug
+postbuild_flexCUDA_debug: mainbuild_flexCUDA_debug
+mainbuild_flexCUDA_debug: prebuild_flexCUDA_debug $(flexCUDA_debug_bin)
+prebuild_flexCUDA_debug:
+
+$(flexCUDA_debug_bin): $(flexCUDA_debug_obj)
+ mkdir -p `dirname ./../../../lib/android/libNvFlexDebugCUDA_armv7l.a`
+ @$(AR) rcs $(flexCUDA_debug_bin) $(flexCUDA_debug_obj)
+ $(ECHO) building $@ complete!
+
+$(flexCUDA_debug_cuda_src_cuda_bvh_cu_o): $(flexCUDA_cuda_src_cuda_bvh_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o`
+ $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o"
+ "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o"
+
+$(flexCUDA_debug_cuda_src_cuda_flex_cu_o): $(flexCUDA_cuda_src_cuda_flex_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o`
+ $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o"
+ "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o"
+
+$(flexCUDA_debug_cuda_src_cuda_sort_cu_o): $(flexCUDA_cuda_src_cuda_sort_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o`
+ $(ECHO) "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o"
+ "../../../../../../external/CUDA/cuda-6.0-linux/bin/nvcc" -ccbin /home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include" -I"../../.." -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport" -I"/home/mmacklin/swhost/devrel/libdev/flex/dev/main/../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include" --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o"
+
+flexCUDA_debug_DEPDIR = $(dir $(@))/$(*F)
+$(flexCUDA_debug_cpp_o): $(flexCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))))))
+ cp $(flexCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ rm -f $(flexCUDA_debug_DEPDIR).d
+
+$(flexCUDA_debug_cc_o): $(flexCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))))))
+ cp $(flexCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))))).debug.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))))).debug.P; \
+ rm -f $(flexCUDA_debug_DEPDIR).d
+
+$(flexCUDA_debug_c_o): $(flexCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexCUDA_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))))))
+ cp $(flexCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ rm -f $(flexCUDA_debug_DEPDIR).d
+
+clean_flexCUDA: clean_flexCUDA_release clean_flexCUDA_debug
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk b/demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk
new file mode 100644
index 0000000..dbfbaab
--- /dev/null
+++ b/demo/compiler/makeandroid/Makefile.flexDemoCUDA.mk
@@ -0,0 +1,136 @@
+# Makefile generated by XPJ for android
+-include Makefile.custom
+ProjectName = flexDemoCUDA
+flexDemoCUDA_cppfiles += ./../../imgui.cpp
+flexDemoCUDA_cppfiles += ./../../main.cpp
+flexDemoCUDA_cppfiles += ./../../opengl/imguiRenderGL.cpp
+flexDemoCUDA_cppfiles += ./../../opengl/shader.cpp
+flexDemoCUDA_cppfiles += ./../../opengl/shadersGL.cpp
+flexDemoCUDA_cppfiles += ./../../../core/aabbtree.cpp
+flexDemoCUDA_cppfiles += ./../../../core/core.cpp
+flexDemoCUDA_cppfiles += ./../../../core/extrude.cpp
+flexDemoCUDA_cppfiles += ./../../../core/maths.cpp
+flexDemoCUDA_cppfiles += ./../../../core/mesh.cpp
+flexDemoCUDA_cppfiles += ./../../../core/perlin.cpp
+flexDemoCUDA_cppfiles += ./../../../core/pfm.cpp
+flexDemoCUDA_cppfiles += ./../../../core/platform.cpp
+flexDemoCUDA_cppfiles += ./../../../core/sdf.cpp
+flexDemoCUDA_cppfiles += ./../../../core/tga.cpp
+flexDemoCUDA_cppfiles += ./../../../core/voxelize.cpp
+flexDemoCUDA_cppfiles += ./../../../external/egl_setup/egl_setup.cpp
+
+flexDemoCUDA_cpp_release_dep = $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexDemoCUDA_cppfiles)))))
+flexDemoCUDA_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexDemoCUDA_ccfiles)))))
+flexDemoCUDA_c_release_dep = $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexDemoCUDA_cfiles)))))
+flexDemoCUDA_release_dep = $(flexDemoCUDA_cpp_release_dep) $(flexDemoCUDA_cc_release_dep) $(flexDemoCUDA_c_release_dep)
+-include $(flexDemoCUDA_release_dep)
+flexDemoCUDA_release_hpaths :=
+flexDemoCUDA_release_hpaths += ./../../..
+flexDemoCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include
+flexDemoCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport
+flexDemoCUDA_release_hpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/include
+flexDemoCUDA_release_hpaths += ./../../../external/egl_setup
+flexDemoCUDA_release_hpaths += ./../../../external/regal_static/include
+flexDemoCUDA_release_lpaths :=
+flexDemoCUDA_release_lpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/lib
+flexDemoCUDA_release_lpaths += ./../../../lib/android
+flexDemoCUDA_release_lpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/libs/armeabi-v7a
+flexDemoCUDA_release_lpaths += ./../../../external/regal_static/lib/armeabi-v7a
+flexDemoCUDA_release_lpaths += ./../../../lib/android
+flexDemoCUDA_release_defines := $(flexDemoCUDA_custom_defines)
+flexDemoCUDA_release_defines += android
+flexDemoCUDA_release_defines += ANDROID=1
+flexDemoCUDA_release_defines += ANDROID_PLAT=1
+flexDemoCUDA_release_defines += DISABLE_IMPORTGL
+flexDemoCUDA_release_defines += NDEBUG
+flexDemoCUDA_release_libraries :=
+flexDemoCUDA_release_libraries += flexExt_cuda_release_armv7l
+flexDemoCUDA_release_libraries += android
+flexDemoCUDA_release_libraries += stdc++
+flexDemoCUDA_release_libraries += c
+flexDemoCUDA_release_libraries += m
+flexDemoCUDA_release_libraries += log
+flexDemoCUDA_release_libraries += dl
+flexDemoCUDA_release_libraries += EGL
+flexDemoCUDA_release_libraries += gomp
+flexDemoCUDA_release_libraries += cudart_static
+flexDemoCUDA_release_libraries += Regal_static
+flexDemoCUDA_release_libraries += stlport_static
+flexDemoCUDA_release_libraries += NvFlexRelease_armv7l
+flexDemoCUDA_release_libraries += NvFlexExtRelease_armv7l
+flexDemoCUDA_release_common_cflags := $(flexDemoCUDA_custom_cflags)
+flexDemoCUDA_release_common_cflags += -MMD
+flexDemoCUDA_release_common_cflags += $(addprefix -D, $(flexDemoCUDA_release_defines))
+flexDemoCUDA_release_common_cflags += $(addprefix -I, $(flexDemoCUDA_release_hpaths))
+flexDemoCUDA_release_common_cflags += -std=c++11 -fno-exceptions -fno-rtti
+flexDemoCUDA_release_common_cflags += -fpic -fPIC -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -O2 -g -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300
+flexDemoCUDA_release_cflags := $(flexDemoCUDA_release_common_cflags)
+flexDemoCUDA_release_cppflags := $(flexDemoCUDA_release_common_cflags)
+flexDemoCUDA_release_lflags := $(flexDemoCUDA_custom_lflags)
+flexDemoCUDA_release_lflags += $(addprefix -L, $(flexDemoCUDA_release_lpaths))
+flexDemoCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexDemoCUDA_release_libraries)) -Wl,--end-group
+flexDemoCUDA_release_lflags += --sysroot="$(NDK_ROOT)"/"$(NDK_VERSION)"/platforms/android-15/arch-arm -shared -Wl,--no-undefined
+flexDemoCUDA_release_objsdir = $(OBJS_DIR)/flexDemoCUDA_release
+flexDemoCUDA_release_cpp_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDemoCUDA_cppfiles)))))
+flexDemoCUDA_release_cc_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexDemoCUDA_ccfiles)))))
+flexDemoCUDA_release_c_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexDemoCUDA_cfiles)))))
+flexDemoCUDA_release_obj = $(flexDemoCUDA_release_cpp_o) $(flexDemoCUDA_release_cc_o) $(flexDemoCUDA_release_c_o)
+flexDemoCUDA_release_bin := ./../android/flex_project/libs/armeabi-v7a/libflexDemo.so
+
+clean_flexDemoCUDA_release:
+ @$(ECHO) clean flexDemoCUDA release
+ @$(RMDIR) $(flexDemoCUDA_release_objsdir)
+ @$(RMDIR) $(flexDemoCUDA_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexDemoCUDA/release
+
+build_flexDemoCUDA_release: postbuild_flexDemoCUDA_release
+postbuild_flexDemoCUDA_release: mainbuild_flexDemoCUDA_release preantbuild_flexDemoCUDA_release antbuild_flexDemoCUDA_release
+preantbuild_flexDemoCUDA_release: mainbuild_flexDemoCUDA_release
+antbuild_flexDemoCUDA_release: preantbuild_flexDemoCUDA_release
+ dos2unix $(ANT_TOOL); JAVA_HOME=$(JAVA_HOME) $(ANT_TOOL) -f ./../android/flex_project/build.xml debug
+mainbuild_flexDemoCUDA_release: prebuild_flexDemoCUDA_release $(flexDemoCUDA_release_bin)
+prebuild_flexDemoCUDA_release:
+
+$(flexDemoCUDA_release_bin): $(flexDemoCUDA_release_obj) build_flexExtCUDA_release
+ mkdir -p `dirname ./../android/flex_project/libs/armeabi-v7a/libflexDemo.so`
+ $(CXX) -shared $(flexDemoCUDA_release_obj) $(flexDemoCUDA_release_lflags) -lc -o $@
+ $(ECHO) building $@ complete!
+
+flexDemoCUDA_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexDemoCUDA_release_cpp_o): $(flexDemoCUDA_release_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDemoCUDA_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))))
+ cp $(flexDemoCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))).P; \
+ rm -f $(flexDemoCUDA_release_DEPDIR).d
+
+$(flexDemoCUDA_release_cc_o): $(flexDemoCUDA_release_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDemoCUDA_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))))
+ cp $(flexDemoCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))).release.P; \
+ rm -f $(flexDemoCUDA_release_DEPDIR).d
+
+$(flexDemoCUDA_release_c_o): $(flexDemoCUDA_release_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexDemoCUDA_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))))))
+ cp $(flexDemoCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))))).P; \
+ rm -f $(flexDemoCUDA_release_DEPDIR).d
+
+clean_flexDemoCUDA: clean_flexDemoCUDA_release
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makeandroid/Makefile.flexDevice.mk b/demo/compiler/makeandroid/Makefile.flexDevice.mk
new file mode 100644
index 0000000..4467ea7
--- /dev/null
+++ b/demo/compiler/makeandroid/Makefile.flexDevice.mk
@@ -0,0 +1,100 @@
+# Makefile generated by XPJ for android
+-include Makefile.custom
+ProjectName = flexDevice
+flexDevice_cppfiles += ./../../../src/device/PhysXDevice.cpp
+flexDevice_cppfiles += ./../../../src/device/flexDevice.cpp
+
+flexDevice_cpp_release_dep = $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexDevice_cppfiles)))))
+flexDevice_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexDevice_ccfiles)))))
+flexDevice_c_release_dep = $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexDevice_cfiles)))))
+flexDevice_release_dep = $(flexDevice_cpp_release_dep) $(flexDevice_cc_release_dep) $(flexDevice_c_release_dep)
+-include $(flexDevice_release_dep)
+flexDevice_release_hpaths :=
+flexDevice_release_hpaths += ./../../..
+flexDevice_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/platforms/android-15/arch-arm/usr/include
+flexDevice_release_hpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/stlport
+flexDevice_release_hpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/include
+flexDevice_release_lpaths :=
+flexDevice_release_lpaths += ./../../../../../../external/CUDA/cuda-6.0-linux/targets/armv7-linux-androideabi/lib
+flexDevice_release_lpaths += ./../../../lib/android
+flexDevice_release_lpaths += ./../../../../../../external/android-ndk/android-ndk-r10e-linux/sources/cxx-stl/stlport/libs/armeabi-v7a
+flexDevice_release_defines := $(flexDevice_custom_defines)
+flexDevice_release_defines += android
+flexDevice_release_defines += ANDROID=1
+flexDevice_release_defines += ANDROID_PLAT=1
+flexDevice_release_defines += DISABLE_IMPORTGL
+flexDevice_release_libraries :=
+flexDevice_release_common_cflags := $(flexDevice_custom_cflags)
+flexDevice_release_common_cflags += -MMD
+flexDevice_release_common_cflags += $(addprefix -D, $(flexDevice_release_defines))
+flexDevice_release_common_cflags += $(addprefix -I, $(flexDevice_release_hpaths))
+flexDevice_release_cflags := $(flexDevice_release_common_cflags)
+flexDevice_release_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexDevice_release_cflags += -O3 -ffast-math
+flexDevice_release_cppflags := $(flexDevice_release_common_cflags)
+flexDevice_release_cppflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexDevice_release_cppflags += -O3 -ffast-math
+flexDevice_release_lflags := $(flexDevice_custom_lflags)
+flexDevice_release_lflags += $(addprefix -L, $(flexDevice_release_lpaths))
+flexDevice_release_lflags += -Wl,--start-group $(addprefix -l, $(flexDevice_release_libraries)) -Wl,--end-group
+flexDevice_release_objsdir = $(OBJS_DIR)/flexDevice_release
+flexDevice_release_cpp_o = $(addprefix $(flexDevice_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDevice_cppfiles)))))
+flexDevice_release_cc_o = $(addprefix $(flexDevice_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexDevice_ccfiles)))))
+flexDevice_release_c_o = $(addprefix $(flexDevice_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexDevice_cfiles)))))
+flexDevice_release_obj = $(flexDevice_release_cpp_o) $(flexDevice_release_cc_o) $(flexDevice_release_c_o)
+flexDevice_release_bin := ./../../../lib/android/libflexDevice_x64.a
+
+clean_flexDevice_release:
+ @$(ECHO) clean flexDevice release
+ @$(RMDIR) $(flexDevice_release_objsdir)
+ @$(RMDIR) $(flexDevice_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexDevice/release
+
+build_flexDevice_release: postbuild_flexDevice_release
+postbuild_flexDevice_release: mainbuild_flexDevice_release
+mainbuild_flexDevice_release: prebuild_flexDevice_release $(flexDevice_release_bin)
+prebuild_flexDevice_release:
+
+$(flexDevice_release_bin): $(flexDevice_release_obj)
+ mkdir -p `dirname ./../../../lib/android/libflexDevice_x64.a`
+ @$(AR) rcs $(flexDevice_release_bin) $(flexDevice_release_obj)
+ $(ECHO) building $@ complete!
+
+flexDevice_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexDevice_release_cpp_o): $(flexDevice_release_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDevice_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))))))
+ cp $(flexDevice_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))))).P; \
+ rm -f $(flexDevice_release_DEPDIR).d
+
+$(flexDevice_release_cc_o): $(flexDevice_release_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDevice_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))))))
+ cp $(flexDevice_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))))).release.P; \
+ rm -f $(flexDevice_release_DEPDIR).d
+
+$(flexDevice_release_c_o): $(flexDevice_release_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexDevice_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))))))
+ cp $(flexDevice_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))))).P; \
+ rm -f $(flexDevice_release_DEPDIR).d
+
+clean_flexDevice: clean_flexDevice_release
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makeandroid/Makefile.flexExtCUDA.mk b/demo/compiler/makeandroid/Makefile.flexExtCUDA.mk
new file mode 100644
index 0000000..8a33251
--- /dev/null
+++ b/demo/compiler/makeandroid/Makefile.flexExtCUDA.mk
@@ -0,0 +1,205 @@
+# Makefile generated by XPJ for android
+-include Makefile.custom
+ProjectName = flexExtCUDA
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtCloth.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtContainer.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtMovingFrame.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtRigid.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtSoft.cpp
+flexExtCUDA_cuda_extensions_cuda_flexExt_cu += ./../../../extensions/cuda/flexExt.cu
+flexExtCUDA_cppfiles += ./../../../core/sdf.cpp
+flexExtCUDA_cppfiles += ./../../../core/voxelize.cpp
+flexExtCUDA_cppfiles += ./../../../core/maths.cpp
+flexExtCUDA_cppfiles += ./../../../core/aabbtree.cpp
+
+flexExtCUDA_cpp_release_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_c_release_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_release_dep = $(flexExtCUDA_cpp_release_dep) $(flexExtCUDA_cc_release_dep) $(flexExtCUDA_c_release_dep)
+-include $(flexExtCUDA_release_dep)
+flexExtCUDA_cpp_debug_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_c_debug_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_debug_dep = $(flexExtCUDA_cpp_debug_dep) $(flexExtCUDA_cc_debug_dep) $(flexExtCUDA_c_debug_dep)
+-include $(flexExtCUDA_debug_dep)
+flexExtCUDA_release_hpaths :=
+flexExtCUDA_release_hpaths += ./../../..
+flexExtCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include
+flexExtCUDA_release_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport
+flexExtCUDA_release_hpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/include
+flexExtCUDA_release_lpaths :=
+flexExtCUDA_release_lpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/lib
+flexExtCUDA_release_lpaths += ./../../../lib/android
+flexExtCUDA_release_lpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/libs/armeabi-v7a
+flexExtCUDA_release_defines := $(flexExtCUDA_custom_defines)
+flexExtCUDA_release_defines += android
+flexExtCUDA_release_defines += ANDROID=1
+flexExtCUDA_release_defines += ANDROID_PLAT=1
+flexExtCUDA_release_defines += DISABLE_IMPORTGL
+flexExtCUDA_release_libraries :=
+flexExtCUDA_release_libraries += ./../../../lib/android/libNvFlexRelease_armv7l.a
+flexExtCUDA_release_common_cflags := $(flexExtCUDA_custom_cflags)
+flexExtCUDA_release_common_cflags += -MMD
+flexExtCUDA_release_common_cflags += $(addprefix -D, $(flexExtCUDA_release_defines))
+flexExtCUDA_release_common_cflags += $(addprefix -I, $(flexExtCUDA_release_hpaths))
+flexExtCUDA_release_common_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexExtCUDA_release_common_cflags += -O3 -ffast-math
+flexExtCUDA_release_cflags := $(flexExtCUDA_release_common_cflags)
+flexExtCUDA_release_cppflags := $(flexExtCUDA_release_common_cflags)
+flexExtCUDA_release_lflags := $(flexExtCUDA_custom_lflags)
+flexExtCUDA_release_lflags += $(addprefix -L, $(flexExtCUDA_release_lpaths))
+flexExtCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexExtCUDA_release_libraries)) -Wl,--end-group
+flexExtCUDA_release_objsdir = $(OBJS_DIR)/flexExtCUDA_release
+flexExtCUDA_release_cpp_o = $(addprefix $(flexExtCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_release_cc_o = $(addprefix $(flexExtCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_release_c_o = $(addprefix $(flexExtCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_release_cuda_extensions_cuda_flexExt_cu_o += $(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o
+flexExtCUDA_release_obj = $(flexExtCUDA_release_cpp_o) $(flexExtCUDA_release_cc_o) $(flexExtCUDA_release_c_o) $(flexExtCUDA_release_cuda_extensions_cuda_flexExt_cu_o)
+flexExtCUDA_release_bin := ./../../../lib/android/libflexExt_cuda_release_armv7l.a
+
+clean_flexExtCUDA_release:
+ @$(ECHO) clean flexExtCUDA release
+ @$(RMDIR) $(flexExtCUDA_release_objsdir)
+ @$(RMDIR) $(flexExtCUDA_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexExtCUDA/release
+
+build_flexExtCUDA_release: postbuild_flexExtCUDA_release
+postbuild_flexExtCUDA_release: mainbuild_flexExtCUDA_release
+mainbuild_flexExtCUDA_release: prebuild_flexExtCUDA_release $(flexExtCUDA_release_bin)
+prebuild_flexExtCUDA_release:
+
+$(flexExtCUDA_release_bin): $(flexExtCUDA_release_obj)
+ mkdir -p `dirname ./../../../lib/android/libflexExt_cuda_release_armv7l.a`
+ @$(AR) rcs $(flexExtCUDA_release_bin) $(flexExtCUDA_release_obj)
+ $(ECHO) building $@ complete!
+
+$(flexExtCUDA_release_cuda_extensions_cuda_flexExt_cu_o): $(flexExtCUDA_cuda_extensions_cuda_flexExt_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o`
+ $(ECHO) "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o"
+ "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o"
+
+flexExtCUDA_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexExtCUDA_release_cpp_o): $(flexExtCUDA_release_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))))))
+ cp $(flexExtCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ rm -f $(flexExtCUDA_release_DEPDIR).d
+
+$(flexExtCUDA_release_cc_o): $(flexExtCUDA_release_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))))))
+ cp $(flexExtCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).release.P; \
+ rm -f $(flexExtCUDA_release_DEPDIR).d
+
+$(flexExtCUDA_release_c_o): $(flexExtCUDA_release_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexExtCUDA_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))))))
+ cp $(flexExtCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ rm -f $(flexExtCUDA_release_DEPDIR).d
+
+flexExtCUDA_debug_hpaths :=
+flexExtCUDA_debug_hpaths += ./../../..
+flexExtCUDA_debug_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include
+flexExtCUDA_debug_hpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport
+flexExtCUDA_debug_hpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/include
+flexExtCUDA_debug_lpaths :=
+flexExtCUDA_debug_lpaths += $(CUDA_PATH)/targets/armv7-linux-androideabi/lib
+flexExtCUDA_debug_lpaths += ./../../../lib/android
+flexExtCUDA_debug_lpaths += $(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/libs/armeabi-v7a
+flexExtCUDA_debug_defines := $(flexExtCUDA_custom_defines)
+flexExtCUDA_debug_defines += android
+flexExtCUDA_debug_defines += ANDROID=1
+flexExtCUDA_debug_defines += ANDROID_PLAT=1
+flexExtCUDA_debug_defines += DISABLE_IMPORTGL
+flexExtCUDA_debug_libraries :=
+flexExtCUDA_debug_libraries += ./../../../lib/android/libNvFlexDebug_armv7l.a
+flexExtCUDA_debug_common_cflags := $(flexExtCUDA_custom_cflags)
+flexExtCUDA_debug_common_cflags += -MMD
+flexExtCUDA_debug_common_cflags += $(addprefix -D, $(flexExtCUDA_debug_defines))
+flexExtCUDA_debug_common_cflags += $(addprefix -I, $(flexExtCUDA_debug_hpaths))
+flexExtCUDA_debug_common_cflags += -Wall -std=c++11 -fpermissive -fno-strict-aliasing -fno-rtti -fno-exceptions
+flexExtCUDA_debug_common_cflags += -g -O0
+flexExtCUDA_debug_cflags := $(flexExtCUDA_debug_common_cflags)
+flexExtCUDA_debug_cppflags := $(flexExtCUDA_debug_common_cflags)
+flexExtCUDA_debug_lflags := $(flexExtCUDA_custom_lflags)
+flexExtCUDA_debug_lflags += $(addprefix -L, $(flexExtCUDA_debug_lpaths))
+flexExtCUDA_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexExtCUDA_debug_libraries)) -Wl,--end-group
+flexExtCUDA_debug_objsdir = $(OBJS_DIR)/flexExtCUDA_debug
+flexExtCUDA_debug_cpp_o = $(addprefix $(flexExtCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_debug_cc_o = $(addprefix $(flexExtCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_debug_c_o = $(addprefix $(flexExtCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_debug_cuda_extensions_cuda_flexExt_cu_o += $(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o
+flexExtCUDA_debug_obj = $(flexExtCUDA_debug_cpp_o) $(flexExtCUDA_debug_cc_o) $(flexExtCUDA_debug_c_o) $(flexExtCUDA_debug_cuda_extensions_cuda_flexExt_cu_o)
+flexExtCUDA_debug_bin := ./../../../lib/android/libflexExt_cuda_debug_armv7l.a
+
+clean_flexExtCUDA_debug:
+ @$(ECHO) clean flexExtCUDA debug
+ @$(RMDIR) $(flexExtCUDA_debug_objsdir)
+ @$(RMDIR) $(flexExtCUDA_debug_bin)
+ @$(RMDIR) $(DEPSDIR)/flexExtCUDA/debug
+
+build_flexExtCUDA_debug: postbuild_flexExtCUDA_debug
+postbuild_flexExtCUDA_debug: mainbuild_flexExtCUDA_debug
+mainbuild_flexExtCUDA_debug: prebuild_flexExtCUDA_debug $(flexExtCUDA_debug_bin)
+prebuild_flexExtCUDA_debug:
+
+$(flexExtCUDA_debug_bin): $(flexExtCUDA_debug_obj)
+ mkdir -p `dirname ./../../../lib/android/libflexExt_cuda_debug_armv7l.a`
+ @$(AR) rcs $(flexExtCUDA_debug_bin) $(flexExtCUDA_debug_obj)
+ $(ECHO) building $@ complete!
+
+$(flexExtCUDA_debug_cuda_extensions_cuda_flexExt_cu_o): $(flexExtCUDA_cuda_extensions_cuda_flexExt_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o`
+ $(ECHO) "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o"
+ "$(CUDA_PATH)/bin/nvcc" -ccbin $(NDK_ROOT)/$(NDK_VERSION)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -target-cpu-arch=ARM -m32 -arch=sm_32 -O3 -Xptxas -dlcm=ca -target-os-variant=Android -I"$(CUDA_PATH)/targets/armv7-linux-androideabi/include" -I"../../.." -I"$(NDK_ROOT)/$(NDK_VERSION)/sources/cxx-stl/stlport/stlport" -I"$(NDK_ROOT)/$(NDK_VERSION)/platforms/android-15/arch-arm/usr/include" --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o"
+
+flexExtCUDA_debug_DEPDIR = $(dir $(@))/$(*F)
+$(flexExtCUDA_debug_cpp_o): $(flexExtCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))))))
+ cp $(flexExtCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ rm -f $(flexExtCUDA_debug_DEPDIR).d
+
+$(flexExtCUDA_debug_cc_o): $(flexExtCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))))))
+ cp $(flexExtCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).debug.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).debug.P; \
+ rm -f $(flexExtCUDA_debug_DEPDIR).d
+
+$(flexExtCUDA_debug_c_o): $(flexExtCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexExtCUDA_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))))))
+ cp $(flexExtCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ rm -f $(flexExtCUDA_debug_DEPDIR).d
+
+clean_flexExtCUDA: clean_flexExtCUDA_release clean_flexExtCUDA_debug
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makelinux64/Makefile b/demo/compiler/makelinux64/Makefile
new file mode 100644
index 0000000..e055ede
--- /dev/null
+++ b/demo/compiler/makelinux64/Makefile
@@ -0,0 +1,198 @@
+#!/usr/bin/make
+# Makefile generated by XPJ for linux64
+
+DEPSDIR = .deps
+#default defines
+OBJS_DIR = build
+RMDIR = rm -fr
+ECHO = echo
+CCLD = g++
+CXX = g++
+CC = gcc
+RANLIB = ranlib
+AR = ar
+STRIP = strip
+OBJDUMP = objdump
+OBJCOPY = objcopy
+-include Makedefs.linux64.mk
+
+all: debug release
+
+debug: build_flexExtCUDA_debug build_flexDemoCUDA_debug
+
+release: build_flexExtCUDA_release build_flexDemoCUDA_release
+
+clean: clean_flexExtCUDA_release clean_flexExtCUDA_debug clean_flexDemoCUDA_release clean_flexDemoCUDA_debug
+ rm -rf $(DEPSDIR)
+
+
+clean_release: clean_flexExtCUDA_release clean_flexDemoCUDA_release
+ rm -rf $(DEPSDIR)
+
+
+clean_debug: clean_flexExtCUDA_debug clean_flexDemoCUDA_debug
+ rm -rf $(DEPSDIR)
+
+
+include Makefile.flexExtCUDA.mk
+include Makefile.flexDemoCUDA.mk
+
+
+# Disable implicit rules to speedup build
+.SUFFIXES:
+SUFFIXES :=
+%.out:
+%.a:
+%.ln:
+%.o:
+%: %.o
+%.c:
+%: %.c
+%.ln: %.c
+%.o: %.c
+%.cc:
+%: %.cc
+%.o: %.cc
+%.C:
+%: %.C
+%.o: %.C
+%.cpp:
+%: %.cpp
+%.o: %.cpp
+%.p:
+%: %.p
+%.o: %.p
+%.f:
+%:
+ %.f%.o: %.f
+%.F:
+%: %.F
+%.o: %.F
+%.f: %.F
+%.r:
+%: %.r
+%.o: %.r
+%.f: %.r
+%.y:
+%.ln: %.y
+%.c: %.y
+%.l:
+%.ln: %.l
+%.c: %.l
+%.r: %.l
+%.s:
+%: %.s
+%.o: %.s
+%.S:
+%: %.S
+%.o: %.S
+%.s: %.S
+%.mod:
+%: %.mod
+%.o: %.mod
+%.sym:
+%.def:
+%.sym: %.def
+%.h:
+%.info:
+%.dvi:
+%.tex:
+%.dvi: %.tex
+%.texinfo:
+%.info: %.texinfo
+%.dvi: %.texinfo
+%.texi:
+%.info: %.texi
+%.dvi: %.texi
+%.txinfo:
+%.info: %.txinfo
+%.dvi: %.txinfo
+%.w:
+%.c: %.w
+%.tex: %.w
+%.ch:
+%.web:
+%.p: %.web
+%.tex: %.web
+%.sh:
+%: %.sh
+%.elc:
+%.el:
+(%): %
+%.out: %
+%.c: %.w %.ch
+%.tex: %.w %.ch
+%: %,v
+%: RCS/%,v
+%: RCS/%
+%: s.%
+%: SCCS/s.%
+.web.p:
+.l.r:
+.dvi:
+.F.o:
+.l:
+.y.ln:
+.o:
+.y:
+.def.sym:
+.p.o:
+.p:
+.txinfo.dvi:
+.a:
+.l.ln:
+.w.c:
+.texi.dvi:
+.sh:
+.cc:
+.cc.o:
+.def:
+.c.o:
+.r.o:
+.r:
+.info:
+.elc:
+.l.c:
+.out:
+.C:
+.r.f:
+.S:
+.texinfo.info:
+.c:
+.w.tex:
+.c.ln:
+.s.o:
+.s:
+.texinfo.dvi:
+.el:
+.texinfo:
+.y.c:
+.web.tex:
+.texi.info:
+.DEFAULT:
+.h:
+.tex.dvi:
+.cpp.o:
+.cpp:
+.C.o:
+.ln:
+.texi:
+.txinfo:
+.tex:
+.txinfo.info:
+.ch:
+.S.s:
+.mod:
+.mod.o:
+.F.f:
+.w:
+.S.o:
+.F:
+.web:
+.sym:
+.f:
+.f.o:
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makelinux64/Makefile.flexCUDA.mk b/demo/compiler/makelinux64/Makefile.flexCUDA.mk
new file mode 100644
index 0000000..3d3b9cd
--- /dev/null
+++ b/demo/compiler/makelinux64/Makefile.flexCUDA.mk
@@ -0,0 +1,217 @@
+# Makefile generated by XPJ for linux64
+-include Makefile.custom
+ProjectName = flexCUDA
+flexCUDA_cppfiles += ./../../../src/cuda/util.cpp
+flexCUDA_cuda_src_cuda_bvh_cu += ./../../../src/cuda/bvh.cu
+flexCUDA_cuda_src_cuda_flex_cu += ./../../../src/cuda/flex.cu
+flexCUDA_cuda_src_cuda_sort_cu += ./../../../src/cuda/sort.cu
+
+flexCUDA_cpp_release_dep = $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexCUDA_cppfiles)))))
+flexCUDA_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexCUDA_ccfiles)))))
+flexCUDA_c_release_dep = $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexCUDA_cfiles)))))
+flexCUDA_release_dep = $(flexCUDA_cpp_release_dep) $(flexCUDA_cc_release_dep) $(flexCUDA_c_release_dep)
+-include $(flexCUDA_release_dep)
+flexCUDA_cpp_debug_dep = $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexCUDA_cppfiles)))))
+flexCUDA_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(flexCUDA_ccfiles)))))
+flexCUDA_c_debug_dep = $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexCUDA_cfiles)))))
+flexCUDA_debug_dep = $(flexCUDA_cpp_debug_dep) $(flexCUDA_cc_debug_dep) $(flexCUDA_c_debug_dep)
+-include $(flexCUDA_debug_dep)
+flexCUDA_release_hpaths :=
+flexCUDA_release_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/include
+flexCUDA_release_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/extras/cupti/include
+flexCUDA_release_hpaths += ./../../..
+flexCUDA_release_lpaths :=
+flexCUDA_release_lpaths += ./../../../../../../external/CUDA/8.0.44-linux/lib64
+flexCUDA_release_defines := $(flexCUDA_custom_defines)
+flexCUDA_release_libraries :=
+flexCUDA_release_libraries += ./../../../lib/linux64/NvFlexDevice_x64.a
+flexCUDA_release_common_cflags := $(flexCUDA_custom_cflags)
+flexCUDA_release_common_cflags += -MMD
+flexCUDA_release_common_cflags += $(addprefix -D, $(flexCUDA_release_defines))
+flexCUDA_release_common_cflags += $(addprefix -I, $(flexCUDA_release_hpaths))
+flexCUDA_release_common_cflags += -m64
+flexCUDA_release_cflags := $(flexCUDA_release_common_cflags)
+flexCUDA_release_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexCUDA_release_cflags += -O3 -ffast-math -DNDEBUG
+flexCUDA_release_cppflags := $(flexCUDA_release_common_cflags)
+flexCUDA_release_cppflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexCUDA_release_cppflags += -O3 -ffast-math -DNDEBUG
+flexCUDA_release_lflags := $(flexCUDA_custom_lflags)
+flexCUDA_release_lflags += $(addprefix -L, $(flexCUDA_release_lpaths))
+flexCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexCUDA_release_libraries)) -Wl,--end-group
+flexCUDA_release_lflags += -m64
+flexCUDA_release_objsdir = $(OBJS_DIR)/flexCUDA_release
+flexCUDA_release_cpp_o = $(addprefix $(flexCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexCUDA_cppfiles)))))
+flexCUDA_release_cc_o = $(addprefix $(flexCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexCUDA_ccfiles)))))
+flexCUDA_release_c_o = $(addprefix $(flexCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexCUDA_cfiles)))))
+flexCUDA_release_cuda_src_cuda_bvh_cu_o += $(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o
+flexCUDA_release_cuda_src_cuda_flex_cu_o += $(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o
+flexCUDA_release_cuda_src_cuda_sort_cu_o += $(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o
+flexCUDA_release_obj = $(flexCUDA_release_cpp_o) $(flexCUDA_release_cc_o) $(flexCUDA_release_c_o) $(flexCUDA_release_cuda_src_cuda_bvh_cu_o) $(flexCUDA_release_cuda_src_cuda_flex_cu_o) $(flexCUDA_release_cuda_src_cuda_sort_cu_o)
+flexCUDA_release_bin := ./../../../lib/linux64/NvFlexReleaseCUDA_x64.a
+
+clean_flexCUDA_release:
+ @$(ECHO) clean flexCUDA release
+ @$(RMDIR) $(flexCUDA_release_objsdir)
+ @$(RMDIR) $(flexCUDA_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexCUDA/release
+
+build_flexCUDA_release: postbuild_flexCUDA_release
+postbuild_flexCUDA_release: mainbuild_flexCUDA_release
+mainbuild_flexCUDA_release: prebuild_flexCUDA_release $(flexCUDA_release_bin)
+prebuild_flexCUDA_release:
+
+$(flexCUDA_release_bin): $(flexCUDA_release_obj)
+ mkdir -p `dirname ./../../../lib/linux64/NvFlexReleaseCUDA_x64.a`
+ @$(AR) rcs $(flexCUDA_release_bin) $(flexCUDA_release_obj)
+ $(ECHO) building $@ complete!
+
+$(flexCUDA_release_cuda_src_cuda_bvh_cu_o): $(flexCUDA_cuda_src_cuda_bvh_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o`
+ $(ECHO) ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o"
+ ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudabvh.o"
+
+$(flexCUDA_release_cuda_src_cuda_flex_cu_o): $(flexCUDA_cuda_src_cuda_flex_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o`
+ $(ECHO) ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o"
+ ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudaflex.o"
+
+$(flexCUDA_release_cuda_src_cuda_sort_cu_o): $(flexCUDA_cuda_src_cuda_sort_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o`
+ $(ECHO) ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o"
+ ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_release/cuda/src/cudasort.o"
+
+flexCUDA_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexCUDA_release_cpp_o): $(flexCUDA_release_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))))))
+ cp $(flexCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ rm -f $(flexCUDA_release_DEPDIR).d
+
+$(flexCUDA_release_cc_o): $(flexCUDA_release_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))))))
+ cp $(flexCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_ccfiles))))).release.P; \
+ rm -f $(flexCUDA_release_DEPDIR).d
+
+$(flexCUDA_release_c_o): $(flexCUDA_release_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexCUDA_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))))))
+ cp $(flexCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_release_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ rm -f $(flexCUDA_release_DEPDIR).d
+
+flexCUDA_debug_hpaths :=
+flexCUDA_debug_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/include
+flexCUDA_debug_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/extras/cupti/include
+flexCUDA_debug_hpaths += ./../../..
+flexCUDA_debug_lpaths :=
+flexCUDA_debug_lpaths += ./../../../../../../external/CUDA/8.0.44-linux/lib64
+flexCUDA_debug_defines := $(flexCUDA_custom_defines)
+flexCUDA_debug_libraries :=
+flexCUDA_debug_libraries += ./../../../lib/linux64/NvFlexDevice_x64.a
+flexCUDA_debug_common_cflags := $(flexCUDA_custom_cflags)
+flexCUDA_debug_common_cflags += -MMD
+flexCUDA_debug_common_cflags += $(addprefix -D, $(flexCUDA_debug_defines))
+flexCUDA_debug_common_cflags += $(addprefix -I, $(flexCUDA_debug_hpaths))
+flexCUDA_debug_common_cflags += -m64
+flexCUDA_debug_cflags := $(flexCUDA_debug_common_cflags)
+flexCUDA_debug_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexCUDA_debug_cflags += -g -O0
+flexCUDA_debug_cppflags := $(flexCUDA_debug_common_cflags)
+flexCUDA_debug_cppflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexCUDA_debug_cppflags += -g -O0
+flexCUDA_debug_lflags := $(flexCUDA_custom_lflags)
+flexCUDA_debug_lflags += $(addprefix -L, $(flexCUDA_debug_lpaths))
+flexCUDA_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexCUDA_debug_libraries)) -Wl,--end-group
+flexCUDA_debug_lflags += -m64
+flexCUDA_debug_objsdir = $(OBJS_DIR)/flexCUDA_debug
+flexCUDA_debug_cpp_o = $(addprefix $(flexCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexCUDA_cppfiles)))))
+flexCUDA_debug_cc_o = $(addprefix $(flexCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexCUDA_ccfiles)))))
+flexCUDA_debug_c_o = $(addprefix $(flexCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexCUDA_cfiles)))))
+flexCUDA_debug_cuda_src_cuda_bvh_cu_o += $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o
+flexCUDA_debug_cuda_src_cuda_flex_cu_o += $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o
+flexCUDA_debug_cuda_src_cuda_sort_cu_o += $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o
+flexCUDA_debug_obj = $(flexCUDA_debug_cpp_o) $(flexCUDA_debug_cc_o) $(flexCUDA_debug_c_o) $(flexCUDA_debug_cuda_src_cuda_bvh_cu_o) $(flexCUDA_debug_cuda_src_cuda_flex_cu_o) $(flexCUDA_debug_cuda_src_cuda_sort_cu_o)
+flexCUDA_debug_bin := ./../../../lib/linux64/NvFlexDebugCUDA_x64.a
+
+clean_flexCUDA_debug:
+ @$(ECHO) clean flexCUDA debug
+ @$(RMDIR) $(flexCUDA_debug_objsdir)
+ @$(RMDIR) $(flexCUDA_debug_bin)
+ @$(RMDIR) $(DEPSDIR)/flexCUDA/debug
+
+build_flexCUDA_debug: postbuild_flexCUDA_debug
+postbuild_flexCUDA_debug: mainbuild_flexCUDA_debug
+mainbuild_flexCUDA_debug: prebuild_flexCUDA_debug $(flexCUDA_debug_bin)
+prebuild_flexCUDA_debug:
+
+$(flexCUDA_debug_bin): $(flexCUDA_debug_obj)
+ mkdir -p `dirname ./../../../lib/linux64/NvFlexDebugCUDA_x64.a`
+ @$(AR) rcs $(flexCUDA_debug_bin) $(flexCUDA_debug_obj)
+ $(ECHO) building $@ complete!
+
+$(flexCUDA_debug_cuda_src_cuda_bvh_cu_o): $(flexCUDA_cuda_src_cuda_bvh_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o`
+ $(ECHO) ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o"
+ ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/bvh.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudabvh.o"
+
+$(flexCUDA_debug_cuda_src_cuda_flex_cu_o): $(flexCUDA_cuda_src_cuda_flex_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o`
+ $(ECHO) ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o"
+ ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/flex.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudaflex.o"
+
+$(flexCUDA_debug_cuda_src_cuda_sort_cu_o): $(flexCUDA_cuda_src_cuda_sort_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o`
+ $(ECHO) ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o"
+ ../../../../../../external/CUDA/8.0.44-linux/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I../../../../../../external/CUDA/8.0.44-linux/include -I../../../external/cub-1.3.2 --compile "../../../src/cuda/sort.cu" -o "$(OBJS_DIR)/flexCUDA_debug/cuda/src/cudasort.o"
+
+flexCUDA_debug_DEPDIR = $(dir $(@))/$(*F)
+$(flexCUDA_debug_cpp_o): $(flexCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))))))
+ cp $(flexCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cppfiles))))).P; \
+ rm -f $(flexCUDA_debug_DEPDIR).d
+
+$(flexCUDA_debug_cc_o): $(flexCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))))))
+ cp $(flexCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))))).debug.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_ccfiles))))).debug.P; \
+ rm -f $(flexCUDA_debug_DEPDIR).d
+
+$(flexCUDA_debug_c_o): $(flexCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexCUDA: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexCUDA_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))))))
+ cp $(flexCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexCUDA_debug_objsdir),, $@))), $(flexCUDA_cfiles))))).P; \
+ rm -f $(flexCUDA_debug_DEPDIR).d
+
+clean_flexCUDA: clean_flexCUDA_release clean_flexCUDA_debug
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk b/demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk
new file mode 100644
index 0000000..152205d
--- /dev/null
+++ b/demo/compiler/makelinux64/Makefile.flexDemoCUDA.mk
@@ -0,0 +1,201 @@
+# Makefile generated by XPJ for linux64
+-include Makefile.custom
+ProjectName = flexDemoCUDA
+flexDemoCUDA_cppfiles += ./../../imgui.cpp
+flexDemoCUDA_cppfiles += ./../../main.cpp
+flexDemoCUDA_cppfiles += ./../../opengl/imguiRenderGL.cpp
+flexDemoCUDA_cppfiles += ./../../opengl/shader.cpp
+flexDemoCUDA_cppfiles += ./../../opengl/shadersGL.cpp
+flexDemoCUDA_cppfiles += ./../../../core/aabbtree.cpp
+flexDemoCUDA_cppfiles += ./../../../core/core.cpp
+flexDemoCUDA_cppfiles += ./../../../core/extrude.cpp
+flexDemoCUDA_cppfiles += ./../../../core/maths.cpp
+flexDemoCUDA_cppfiles += ./../../../core/mesh.cpp
+flexDemoCUDA_cppfiles += ./../../../core/perlin.cpp
+flexDemoCUDA_cppfiles += ./../../../core/pfm.cpp
+flexDemoCUDA_cppfiles += ./../../../core/platform.cpp
+flexDemoCUDA_cppfiles += ./../../../core/sdf.cpp
+flexDemoCUDA_cppfiles += ./../../../core/tga.cpp
+flexDemoCUDA_cppfiles += ./../../../core/voxelize.cpp
+
+flexDemoCUDA_cpp_release_dep = $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexDemoCUDA_cppfiles)))))
+flexDemoCUDA_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexDemoCUDA_ccfiles)))))
+flexDemoCUDA_c_release_dep = $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexDemoCUDA_cfiles)))))
+flexDemoCUDA_release_dep = $(flexDemoCUDA_cpp_release_dep) $(flexDemoCUDA_cc_release_dep) $(flexDemoCUDA_c_release_dep)
+-include $(flexDemoCUDA_release_dep)
+flexDemoCUDA_cpp_debug_dep = $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexDemoCUDA_cppfiles)))))
+flexDemoCUDA_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(flexDemoCUDA_ccfiles)))))
+flexDemoCUDA_c_debug_dep = $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexDemoCUDA_cfiles)))))
+flexDemoCUDA_debug_dep = $(flexDemoCUDA_cpp_debug_dep) $(flexDemoCUDA_cc_debug_dep) $(flexDemoCUDA_c_debug_dep)
+-include $(flexDemoCUDA_debug_dep)
+flexDemoCUDA_release_hpaths :=
+flexDemoCUDA_release_hpaths += $(CUDA_PATH)/include
+flexDemoCUDA_release_hpaths += $(CUDA_PATH)/extras/cupti/include
+flexDemoCUDA_release_hpaths += ./../../..
+flexDemoCUDA_release_lpaths :=
+flexDemoCUDA_release_lpaths += $(CUDA_PATH)/lib64
+flexDemoCUDA_release_lpaths += ./../../../lib/linux64
+flexDemoCUDA_release_defines := $(flexDemoCUDA_custom_defines)
+flexDemoCUDA_release_libraries :=
+flexDemoCUDA_release_libraries += :NvFlexExtReleaseCUDA_x64.a
+flexDemoCUDA_release_libraries += :NvFlexReleaseCUDA_x64.a
+flexDemoCUDA_release_libraries += :NvFlexExtReleaseCUDA_x64.a
+flexDemoCUDA_release_libraries += :libSDL2.a
+flexDemoCUDA_release_libraries += :libSDL2main.a
+flexDemoCUDA_release_common_cflags := $(flexDemoCUDA_custom_cflags)
+flexDemoCUDA_release_common_cflags += -MMD
+flexDemoCUDA_release_common_cflags += $(addprefix -D, $(flexDemoCUDA_release_defines))
+flexDemoCUDA_release_common_cflags += $(addprefix -I, $(flexDemoCUDA_release_hpaths))
+flexDemoCUDA_release_common_cflags += -m64
+flexDemoCUDA_release_common_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexDemoCUDA_release_common_cflags += -O3 -ffast-math -DNDEBUG
+flexDemoCUDA_release_cflags := $(flexDemoCUDA_release_common_cflags)
+flexDemoCUDA_release_cppflags := $(flexDemoCUDA_release_common_cflags)
+flexDemoCUDA_release_lflags := $(flexDemoCUDA_custom_lflags)
+flexDemoCUDA_release_lflags += $(addprefix -L, $(flexDemoCUDA_release_lpaths))
+flexDemoCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexDemoCUDA_release_libraries)) -Wl,--end-group
+flexDemoCUDA_release_lflags += -g -L../../../external/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L../../../external/SDL2-2.0.4/lib/x64/ -L$(CUDA_PATH)/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl
+flexDemoCUDA_release_lflags += -m64
+flexDemoCUDA_release_objsdir = $(OBJS_DIR)/flexDemoCUDA_release
+flexDemoCUDA_release_cpp_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDemoCUDA_cppfiles)))))
+flexDemoCUDA_release_cc_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexDemoCUDA_ccfiles)))))
+flexDemoCUDA_release_c_o = $(addprefix $(flexDemoCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexDemoCUDA_cfiles)))))
+flexDemoCUDA_release_obj = $(flexDemoCUDA_release_cpp_o) $(flexDemoCUDA_release_cc_o) $(flexDemoCUDA_release_c_o)
+flexDemoCUDA_release_bin := ./../../../bin/linux64/NvFlexDemoReleaseCUDA_x64
+
+clean_flexDemoCUDA_release:
+ @$(ECHO) clean flexDemoCUDA release
+ @$(RMDIR) $(flexDemoCUDA_release_objsdir)
+ @$(RMDIR) $(flexDemoCUDA_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexDemoCUDA/release
+
+build_flexDemoCUDA_release: postbuild_flexDemoCUDA_release
+postbuild_flexDemoCUDA_release: mainbuild_flexDemoCUDA_release
+mainbuild_flexDemoCUDA_release: prebuild_flexDemoCUDA_release $(flexDemoCUDA_release_bin)
+prebuild_flexDemoCUDA_release:
+
+$(flexDemoCUDA_release_bin): $(flexDemoCUDA_release_obj) build_flexExtCUDA_release
+ mkdir -p `dirname ./../../../bin/linux64/NvFlexDemoReleaseCUDA_x64`
+ $(CCLD) $(flexDemoCUDA_release_obj) $(flexDemoCUDA_release_lflags) -o $(flexDemoCUDA_release_bin)
+ $(ECHO) building $@ complete!
+
+flexDemoCUDA_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexDemoCUDA_release_cpp_o): $(flexDemoCUDA_release_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDemoCUDA_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))))
+ cp $(flexDemoCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))).P; \
+ rm -f $(flexDemoCUDA_release_DEPDIR).d
+
+$(flexDemoCUDA_release_cc_o): $(flexDemoCUDA_release_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDemoCUDA_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))))
+ cp $(flexDemoCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))).release.P; \
+ rm -f $(flexDemoCUDA_release_DEPDIR).d
+
+$(flexDemoCUDA_release_c_o): $(flexDemoCUDA_release_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexDemoCUDA_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))))))
+ cp $(flexDemoCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDemoCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_release_objsdir),, $@))), $(flexDemoCUDA_cfiles))))).P; \
+ rm -f $(flexDemoCUDA_release_DEPDIR).d
+
+flexDemoCUDA_debug_hpaths :=
+flexDemoCUDA_debug_hpaths += $(CUDA_PATH)/include
+flexDemoCUDA_debug_hpaths += $(CUDA_PATH)/extras/cupti/include
+flexDemoCUDA_debug_hpaths += ./../../..
+flexDemoCUDA_debug_lpaths :=
+flexDemoCUDA_debug_lpaths += $(CUDA_PATH)/lib64
+flexDemoCUDA_debug_lpaths += ./../../../lib/linux64
+flexDemoCUDA_debug_defines := $(flexDemoCUDA_custom_defines)
+flexDemoCUDA_debug_libraries :=
+flexDemoCUDA_debug_libraries += :NvFlexExtDebugCUDA_x64.a
+flexDemoCUDA_debug_libraries += :NvFlexDebugCUDA_x64.a
+flexDemoCUDA_debug_libraries += :NvFlexExtDebugCUDA_x64.a
+flexDemoCUDA_debug_libraries += :libSDL2.a
+flexDemoCUDA_debug_libraries += :libSDL2main.a
+flexDemoCUDA_debug_common_cflags := $(flexDemoCUDA_custom_cflags)
+flexDemoCUDA_debug_common_cflags += -MMD
+flexDemoCUDA_debug_common_cflags += $(addprefix -D, $(flexDemoCUDA_debug_defines))
+flexDemoCUDA_debug_common_cflags += $(addprefix -I, $(flexDemoCUDA_debug_hpaths))
+flexDemoCUDA_debug_common_cflags += -m64
+flexDemoCUDA_debug_common_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexDemoCUDA_debug_common_cflags += -g -O0
+flexDemoCUDA_debug_cflags := $(flexDemoCUDA_debug_common_cflags)
+flexDemoCUDA_debug_cppflags := $(flexDemoCUDA_debug_common_cflags)
+flexDemoCUDA_debug_lflags := $(flexDemoCUDA_custom_lflags)
+flexDemoCUDA_debug_lflags += $(addprefix -L, $(flexDemoCUDA_debug_lpaths))
+flexDemoCUDA_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexDemoCUDA_debug_libraries)) -Wl,--end-group
+flexDemoCUDA_debug_lflags += -g -L../../../external/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L../../../external/SDL2-2.0.4/lib/x64/ -L$(CUDA_PATH)/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl
+flexDemoCUDA_debug_lflags += -m64
+flexDemoCUDA_debug_objsdir = $(OBJS_DIR)/flexDemoCUDA_debug
+flexDemoCUDA_debug_cpp_o = $(addprefix $(flexDemoCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDemoCUDA_cppfiles)))))
+flexDemoCUDA_debug_cc_o = $(addprefix $(flexDemoCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexDemoCUDA_ccfiles)))))
+flexDemoCUDA_debug_c_o = $(addprefix $(flexDemoCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexDemoCUDA_cfiles)))))
+flexDemoCUDA_debug_obj = $(flexDemoCUDA_debug_cpp_o) $(flexDemoCUDA_debug_cc_o) $(flexDemoCUDA_debug_c_o)
+flexDemoCUDA_debug_bin := ./../../../bin/linux64/NvFlexDemoDebugCUDA_x64
+
+clean_flexDemoCUDA_debug:
+ @$(ECHO) clean flexDemoCUDA debug
+ @$(RMDIR) $(flexDemoCUDA_debug_objsdir)
+ @$(RMDIR) $(flexDemoCUDA_debug_bin)
+ @$(RMDIR) $(DEPSDIR)/flexDemoCUDA/debug
+
+build_flexDemoCUDA_debug: postbuild_flexDemoCUDA_debug
+postbuild_flexDemoCUDA_debug: mainbuild_flexDemoCUDA_debug
+mainbuild_flexDemoCUDA_debug: prebuild_flexDemoCUDA_debug $(flexDemoCUDA_debug_bin)
+prebuild_flexDemoCUDA_debug:
+
+$(flexDemoCUDA_debug_bin): $(flexDemoCUDA_debug_obj) build_flexExtCUDA_debug
+ mkdir -p `dirname ./../../../bin/linux64/NvFlexDemoDebugCUDA_x64`
+ $(CCLD) $(flexDemoCUDA_debug_obj) $(flexDemoCUDA_debug_lflags) -o $(flexDemoCUDA_debug_bin)
+ $(ECHO) building $@ complete!
+
+flexDemoCUDA_debug_DEPDIR = $(dir $(@))/$(*F)
+$(flexDemoCUDA_debug_cpp_o): $(flexDemoCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDemoCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))))
+ cp $(flexDemoCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cppfiles))))).P; \
+ rm -f $(flexDemoCUDA_debug_DEPDIR).d
+
+$(flexDemoCUDA_debug_cc_o): $(flexDemoCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDemoCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))))
+ cp $(flexDemoCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))).debug.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_ccfiles))))).debug.P; \
+ rm -f $(flexDemoCUDA_debug_DEPDIR).d
+
+$(flexDemoCUDA_debug_c_o): $(flexDemoCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexDemoCUDA: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexDemoCUDA_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cfiles))))))
+ cp $(flexDemoCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDemoCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDemoCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDemoCUDA_debug_objsdir),, $@))), $(flexDemoCUDA_cfiles))))).P; \
+ rm -f $(flexDemoCUDA_debug_DEPDIR).d
+
+clean_flexDemoCUDA: clean_flexDemoCUDA_release clean_flexDemoCUDA_debug
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makelinux64/Makefile.flexDevice.mk b/demo/compiler/makelinux64/Makefile.flexDevice.mk
new file mode 100644
index 0000000..6bea080
--- /dev/null
+++ b/demo/compiler/makelinux64/Makefile.flexDevice.mk
@@ -0,0 +1,177 @@
+# Makefile generated by XPJ for linux64
+-include Makefile.custom
+ProjectName = flexDevice
+flexDevice_cppfiles += ./../../../src/device/PhysXDevice.cpp
+flexDevice_cppfiles += ./../../../src/device/flexDevice.cpp
+
+flexDevice_cpp_release_dep = $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexDevice_cppfiles)))))
+flexDevice_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexDevice_ccfiles)))))
+flexDevice_c_release_dep = $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexDevice_cfiles)))))
+flexDevice_release_dep = $(flexDevice_cpp_release_dep) $(flexDevice_cc_release_dep) $(flexDevice_c_release_dep)
+-include $(flexDevice_release_dep)
+flexDevice_cpp_debug_dep = $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexDevice_cppfiles)))))
+flexDevice_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(flexDevice_ccfiles)))))
+flexDevice_c_debug_dep = $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexDevice_cfiles)))))
+flexDevice_debug_dep = $(flexDevice_cpp_debug_dep) $(flexDevice_cc_debug_dep) $(flexDevice_c_debug_dep)
+-include $(flexDevice_debug_dep)
+flexDevice_release_hpaths :=
+flexDevice_release_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/include
+flexDevice_release_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/extras/cupti/include
+flexDevice_release_hpaths += ./../../..
+flexDevice_release_lpaths :=
+flexDevice_release_lpaths += ./../../../../../../external/CUDA/8.0.44-linux/lib64
+flexDevice_release_defines := $(flexDevice_custom_defines)
+flexDevice_release_libraries :=
+flexDevice_release_common_cflags := $(flexDevice_custom_cflags)
+flexDevice_release_common_cflags += -MMD
+flexDevice_release_common_cflags += $(addprefix -D, $(flexDevice_release_defines))
+flexDevice_release_common_cflags += $(addprefix -I, $(flexDevice_release_hpaths))
+flexDevice_release_common_cflags += -m64
+flexDevice_release_cflags := $(flexDevice_release_common_cflags)
+flexDevice_release_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexDevice_release_cflags += -O3 -ffast-math -DNDEBUG
+flexDevice_release_cppflags := $(flexDevice_release_common_cflags)
+flexDevice_release_cppflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexDevice_release_cppflags += -O3 -ffast-math -DNDEBUG
+flexDevice_release_lflags := $(flexDevice_custom_lflags)
+flexDevice_release_lflags += $(addprefix -L, $(flexDevice_release_lpaths))
+flexDevice_release_lflags += -Wl,--start-group $(addprefix -l, $(flexDevice_release_libraries)) -Wl,--end-group
+flexDevice_release_lflags += -m64
+flexDevice_release_objsdir = $(OBJS_DIR)/flexDevice_release
+flexDevice_release_cpp_o = $(addprefix $(flexDevice_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDevice_cppfiles)))))
+flexDevice_release_cc_o = $(addprefix $(flexDevice_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexDevice_ccfiles)))))
+flexDevice_release_c_o = $(addprefix $(flexDevice_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexDevice_cfiles)))))
+flexDevice_release_obj = $(flexDevice_release_cpp_o) $(flexDevice_release_cc_o) $(flexDevice_release_c_o)
+flexDevice_release_bin := ./../../../lib/linux64/NvFlexDeviceRelease_x64.a
+
+clean_flexDevice_release:
+ @$(ECHO) clean flexDevice release
+ @$(RMDIR) $(flexDevice_release_objsdir)
+ @$(RMDIR) $(flexDevice_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexDevice/release
+
+build_flexDevice_release: postbuild_flexDevice_release
+postbuild_flexDevice_release: mainbuild_flexDevice_release
+mainbuild_flexDevice_release: prebuild_flexDevice_release $(flexDevice_release_bin)
+prebuild_flexDevice_release:
+
+$(flexDevice_release_bin): $(flexDevice_release_obj)
+ mkdir -p `dirname ./../../../lib/linux64/NvFlexDeviceRelease_x64.a`
+ @$(AR) rcs $(flexDevice_release_bin) $(flexDevice_release_obj)
+ $(ECHO) building $@ complete!
+
+flexDevice_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexDevice_release_cpp_o): $(flexDevice_release_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDevice_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))))))
+ cp $(flexDevice_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cppfiles))))).P; \
+ rm -f $(flexDevice_release_DEPDIR).d
+
+$(flexDevice_release_cc_o): $(flexDevice_release_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDevice_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))))))
+ cp $(flexDevice_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_ccfiles))))).release.P; \
+ rm -f $(flexDevice_release_DEPDIR).d
+
+$(flexDevice_release_c_o): $(flexDevice_release_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexDevice_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))))))
+ cp $(flexDevice_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDevice/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_release_objsdir),, $@))), $(flexDevice_cfiles))))).P; \
+ rm -f $(flexDevice_release_DEPDIR).d
+
+flexDevice_debug_hpaths :=
+flexDevice_debug_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/include
+flexDevice_debug_hpaths += ./../../../../../../external/CUDA/8.0.44-linux/extras/cupti/include
+flexDevice_debug_hpaths += ./../../..
+flexDevice_debug_lpaths :=
+flexDevice_debug_lpaths += ./../../../../../../external/CUDA/8.0.44-linux/lib64
+flexDevice_debug_defines := $(flexDevice_custom_defines)
+flexDevice_debug_libraries :=
+flexDevice_debug_common_cflags := $(flexDevice_custom_cflags)
+flexDevice_debug_common_cflags += -MMD
+flexDevice_debug_common_cflags += $(addprefix -D, $(flexDevice_debug_defines))
+flexDevice_debug_common_cflags += $(addprefix -I, $(flexDevice_debug_hpaths))
+flexDevice_debug_common_cflags += -m64
+flexDevice_debug_cflags := $(flexDevice_debug_common_cflags)
+flexDevice_debug_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexDevice_debug_cflags += -g -O0
+flexDevice_debug_cppflags := $(flexDevice_debug_common_cflags)
+flexDevice_debug_cppflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexDevice_debug_cppflags += -g -O0
+flexDevice_debug_lflags := $(flexDevice_custom_lflags)
+flexDevice_debug_lflags += $(addprefix -L, $(flexDevice_debug_lpaths))
+flexDevice_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexDevice_debug_libraries)) -Wl,--end-group
+flexDevice_debug_lflags += -m64
+flexDevice_debug_objsdir = $(OBJS_DIR)/flexDevice_debug
+flexDevice_debug_cpp_o = $(addprefix $(flexDevice_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexDevice_cppfiles)))))
+flexDevice_debug_cc_o = $(addprefix $(flexDevice_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexDevice_ccfiles)))))
+flexDevice_debug_c_o = $(addprefix $(flexDevice_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexDevice_cfiles)))))
+flexDevice_debug_obj = $(flexDevice_debug_cpp_o) $(flexDevice_debug_cc_o) $(flexDevice_debug_c_o)
+flexDevice_debug_bin := ./../../../lib/linux64/NvFlexDeviceDebug_x64.a
+
+clean_flexDevice_debug:
+ @$(ECHO) clean flexDevice debug
+ @$(RMDIR) $(flexDevice_debug_objsdir)
+ @$(RMDIR) $(flexDevice_debug_bin)
+ @$(RMDIR) $(DEPSDIR)/flexDevice/debug
+
+build_flexDevice_debug: postbuild_flexDevice_debug
+postbuild_flexDevice_debug: mainbuild_flexDevice_debug
+mainbuild_flexDevice_debug: prebuild_flexDevice_debug $(flexDevice_debug_bin)
+prebuild_flexDevice_debug:
+
+$(flexDevice_debug_bin): $(flexDevice_debug_obj)
+ mkdir -p `dirname ./../../../lib/linux64/NvFlexDeviceDebug_x64.a`
+ @$(AR) rcs $(flexDevice_debug_bin) $(flexDevice_debug_obj)
+ $(ECHO) building $@ complete!
+
+flexDevice_debug_DEPDIR = $(dir $(@))/$(*F)
+$(flexDevice_debug_cpp_o): $(flexDevice_debug_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDevice_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cppfiles))))))
+ cp $(flexDevice_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cppfiles))))).P; \
+ rm -f $(flexDevice_debug_DEPDIR).d
+
+$(flexDevice_debug_cc_o): $(flexDevice_debug_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexDevice_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_ccfiles))))))
+ cp $(flexDevice_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_ccfiles))))).debug.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_ccfiles))))).debug.P; \
+ rm -f $(flexDevice_debug_DEPDIR).d
+
+$(flexDevice_debug_c_o): $(flexDevice_debug_objsdir)/%.o:
+ $(ECHO) flexDevice: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexDevice_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cfiles))))))
+ cp $(flexDevice_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexDevice_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexDevice/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexDevice_debug_objsdir),, $@))), $(flexDevice_cfiles))))).P; \
+ rm -f $(flexDevice_debug_DEPDIR).d
+
+clean_flexDevice: clean_flexDevice_release clean_flexDevice_debug
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/makelinux64/Makefile.flexExtCUDA.mk b/demo/compiler/makelinux64/Makefile.flexExtCUDA.mk
new file mode 100644
index 0000000..78dd100
--- /dev/null
+++ b/demo/compiler/makelinux64/Makefile.flexExtCUDA.mk
@@ -0,0 +1,197 @@
+# Makefile generated by XPJ for linux64
+-include Makefile.custom
+ProjectName = flexExtCUDA
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtCloth.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtContainer.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtMovingFrame.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtRigid.cpp
+flexExtCUDA_cppfiles += ./../../../extensions/flexExtSoft.cpp
+flexExtCUDA_cuda_extensions_cuda_flexExt_cu += ./../../../extensions/cuda/flexExt.cu
+flexExtCUDA_cppfiles += ./../../../core/sdf.cpp
+flexExtCUDA_cppfiles += ./../../../core/voxelize.cpp
+flexExtCUDA_cppfiles += ./../../../core/maths.cpp
+flexExtCUDA_cppfiles += ./../../../core/aabbtree.cpp
+
+flexExtCUDA_cpp_release_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_c_release_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_release_dep = $(flexExtCUDA_cpp_release_dep) $(flexExtCUDA_cc_release_dep) $(flexExtCUDA_c_release_dep)
+-include $(flexExtCUDA_release_dep)
+flexExtCUDA_cpp_debug_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_c_debug_dep = $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_debug_dep = $(flexExtCUDA_cpp_debug_dep) $(flexExtCUDA_cc_debug_dep) $(flexExtCUDA_c_debug_dep)
+-include $(flexExtCUDA_debug_dep)
+flexExtCUDA_release_hpaths :=
+flexExtCUDA_release_hpaths += $(CUDA_PATH)/include
+flexExtCUDA_release_hpaths += $(CUDA_PATH)/extras/cupti/include
+flexExtCUDA_release_hpaths += ./../../..
+flexExtCUDA_release_hpaths += ./../../../external/freeglut/include
+flexExtCUDA_release_lpaths :=
+flexExtCUDA_release_lpaths += $(CUDA_PATH)/lib64
+flexExtCUDA_release_defines := $(flexExtCUDA_custom_defines)
+flexExtCUDA_release_libraries :=
+flexExtCUDA_release_libraries += ./../../../lib/linux64/NvFlexReleaseCUDA_x64.a
+flexExtCUDA_release_common_cflags := $(flexExtCUDA_custom_cflags)
+flexExtCUDA_release_common_cflags += -MMD
+flexExtCUDA_release_common_cflags += $(addprefix -D, $(flexExtCUDA_release_defines))
+flexExtCUDA_release_common_cflags += $(addprefix -I, $(flexExtCUDA_release_hpaths))
+flexExtCUDA_release_common_cflags += -m64
+flexExtCUDA_release_common_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexExtCUDA_release_common_cflags += -O3 -ffast-math -DNDEBUG
+flexExtCUDA_release_cflags := $(flexExtCUDA_release_common_cflags)
+flexExtCUDA_release_cppflags := $(flexExtCUDA_release_common_cflags)
+flexExtCUDA_release_lflags := $(flexExtCUDA_custom_lflags)
+flexExtCUDA_release_lflags += $(addprefix -L, $(flexExtCUDA_release_lpaths))
+flexExtCUDA_release_lflags += -Wl,--start-group $(addprefix -l, $(flexExtCUDA_release_libraries)) -Wl,--end-group
+flexExtCUDA_release_lflags += -m64
+flexExtCUDA_release_objsdir = $(OBJS_DIR)/flexExtCUDA_release
+flexExtCUDA_release_cpp_o = $(addprefix $(flexExtCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_release_cc_o = $(addprefix $(flexExtCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_release_c_o = $(addprefix $(flexExtCUDA_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_release_cuda_extensions_cuda_flexExt_cu_o += $(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o
+flexExtCUDA_release_obj = $(flexExtCUDA_release_cpp_o) $(flexExtCUDA_release_cc_o) $(flexExtCUDA_release_c_o) $(flexExtCUDA_release_cuda_extensions_cuda_flexExt_cu_o)
+flexExtCUDA_release_bin := ./../../../lib/linux64/NvFlexExtReleaseCUDA_x64.a
+
+clean_flexExtCUDA_release:
+ @$(ECHO) clean flexExtCUDA release
+ @$(RMDIR) $(flexExtCUDA_release_objsdir)
+ @$(RMDIR) $(flexExtCUDA_release_bin)
+ @$(RMDIR) $(DEPSDIR)/flexExtCUDA/release
+
+build_flexExtCUDA_release: postbuild_flexExtCUDA_release
+postbuild_flexExtCUDA_release: mainbuild_flexExtCUDA_release
+mainbuild_flexExtCUDA_release: prebuild_flexExtCUDA_release $(flexExtCUDA_release_bin)
+prebuild_flexExtCUDA_release:
+
+$(flexExtCUDA_release_bin): $(flexExtCUDA_release_obj)
+ mkdir -p `dirname ./../../../lib/linux64/NvFlexExtReleaseCUDA_x64.a`
+ @$(AR) rcs $(flexExtCUDA_release_bin) $(flexExtCUDA_release_obj)
+ $(ECHO) building $@ complete!
+
+$(flexExtCUDA_release_cuda_extensions_cuda_flexExt_cu_o): $(flexExtCUDA_cuda_extensions_cuda_flexExt_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o`
+ $(ECHO) $(CUDA_PATH)/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I$(CUDA_PATH)/include -I../../../external/cub-1.3.2 --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o"
+ $(CUDA_PATH)/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I$(CUDA_PATH)/include -I../../../external/cub-1.3.2 --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_release/cuda/extensions/cudaflexExt.o"
+
+flexExtCUDA_release_DEPDIR = $(dir $(@))/$(*F)
+$(flexExtCUDA_release_cpp_o): $(flexExtCUDA_release_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))))))
+ cp $(flexExtCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ rm -f $(flexExtCUDA_release_DEPDIR).d
+
+$(flexExtCUDA_release_cc_o): $(flexExtCUDA_release_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))))))
+ cp $(flexExtCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).release.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).release.P; \
+ rm -f $(flexExtCUDA_release_DEPDIR).d
+
+$(flexExtCUDA_release_c_o): $(flexExtCUDA_release_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexExtCUDA_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))))))
+ cp $(flexExtCUDA_release_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_release_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ rm -f $(flexExtCUDA_release_DEPDIR).d
+
+flexExtCUDA_debug_hpaths :=
+flexExtCUDA_debug_hpaths += $(CUDA_PATH)/include
+flexExtCUDA_debug_hpaths += $(CUDA_PATH)/extras/cupti/include
+flexExtCUDA_debug_hpaths += ./../../..
+flexExtCUDA_debug_hpaths += ./../../../external/freeglut/include
+flexExtCUDA_debug_lpaths :=
+flexExtCUDA_debug_lpaths += $(CUDA_PATH)/lib64
+flexExtCUDA_debug_defines := $(flexExtCUDA_custom_defines)
+flexExtCUDA_debug_libraries :=
+flexExtCUDA_debug_libraries += ./../../../lib/linux64/NvFlexDebugCUDA_x64.a
+flexExtCUDA_debug_common_cflags := $(flexExtCUDA_custom_cflags)
+flexExtCUDA_debug_common_cflags += -MMD
+flexExtCUDA_debug_common_cflags += $(addprefix -D, $(flexExtCUDA_debug_defines))
+flexExtCUDA_debug_common_cflags += $(addprefix -I, $(flexExtCUDA_debug_hpaths))
+flexExtCUDA_debug_common_cflags += -m64
+flexExtCUDA_debug_common_cflags += -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+flexExtCUDA_debug_common_cflags += -g -O0
+flexExtCUDA_debug_cflags := $(flexExtCUDA_debug_common_cflags)
+flexExtCUDA_debug_cppflags := $(flexExtCUDA_debug_common_cflags)
+flexExtCUDA_debug_lflags := $(flexExtCUDA_custom_lflags)
+flexExtCUDA_debug_lflags += $(addprefix -L, $(flexExtCUDA_debug_lpaths))
+flexExtCUDA_debug_lflags += -Wl,--start-group $(addprefix -l, $(flexExtCUDA_debug_libraries)) -Wl,--end-group
+flexExtCUDA_debug_lflags += -m64
+flexExtCUDA_debug_objsdir = $(OBJS_DIR)/flexExtCUDA_debug
+flexExtCUDA_debug_cpp_o = $(addprefix $(flexExtCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(flexExtCUDA_cppfiles)))))
+flexExtCUDA_debug_cc_o = $(addprefix $(flexExtCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(flexExtCUDA_ccfiles)))))
+flexExtCUDA_debug_c_o = $(addprefix $(flexExtCUDA_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(flexExtCUDA_cfiles)))))
+flexExtCUDA_debug_cuda_extensions_cuda_flexExt_cu_o += $(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o
+flexExtCUDA_debug_obj = $(flexExtCUDA_debug_cpp_o) $(flexExtCUDA_debug_cc_o) $(flexExtCUDA_debug_c_o) $(flexExtCUDA_debug_cuda_extensions_cuda_flexExt_cu_o)
+flexExtCUDA_debug_bin := ./../../../lib/linux64/NvFlexExtDebugCUDA_x64.a
+
+clean_flexExtCUDA_debug:
+ @$(ECHO) clean flexExtCUDA debug
+ @$(RMDIR) $(flexExtCUDA_debug_objsdir)
+ @$(RMDIR) $(flexExtCUDA_debug_bin)
+ @$(RMDIR) $(DEPSDIR)/flexExtCUDA/debug
+
+build_flexExtCUDA_debug: postbuild_flexExtCUDA_debug
+postbuild_flexExtCUDA_debug: mainbuild_flexExtCUDA_debug
+mainbuild_flexExtCUDA_debug: prebuild_flexExtCUDA_debug $(flexExtCUDA_debug_bin)
+prebuild_flexExtCUDA_debug:
+
+$(flexExtCUDA_debug_bin): $(flexExtCUDA_debug_obj)
+ mkdir -p `dirname ./../../../lib/linux64/NvFlexExtDebugCUDA_x64.a`
+ @$(AR) rcs $(flexExtCUDA_debug_bin) $(flexExtCUDA_debug_obj)
+ $(ECHO) building $@ complete!
+
+$(flexExtCUDA_debug_cuda_extensions_cuda_flexExt_cu_o): $(flexExtCUDA_cuda_extensions_cuda_flexExt_cu)
+ @mkdir -p `dirname $(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o`
+ $(ECHO) $(CUDA_PATH)/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I$(CUDA_PATH)/include -I../../../external/cub-1.3.2 --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o"
+ $(CUDA_PATH)/bin/nvcc -O3 -g -arch=sm_30 -m64 -Xcompiler -fPIC -D_FORCE_INLINES -I../../.. -I../../../external -I$(CUDA_PATH)/include -I../../../external/cub-1.3.2 --compile "./../../../extensions/cuda/flexExt.cu" -o "$(OBJS_DIR)/flexExtCUDA_debug/cuda/extensions/cudaflexExt.o"
+
+flexExtCUDA_debug_DEPDIR = $(dir $(@))/$(*F)
+$(flexExtCUDA_debug_cpp_o): $(flexExtCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))))))
+ cp $(flexExtCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cppfiles))))).P; \
+ rm -f $(flexExtCUDA_debug_DEPDIR).d
+
+$(flexExtCUDA_debug_cc_o): $(flexExtCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))...
+ mkdir -p $(dir $(@))
+ $(CXX) $(flexExtCUDA_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles)) -o $@
+ mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))))))
+ cp $(flexExtCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).debug.P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_ccfiles))))).debug.P; \
+ rm -f $(flexExtCUDA_debug_DEPDIR).d
+
+$(flexExtCUDA_debug_c_o): $(flexExtCUDA_debug_objsdir)/%.o:
+ $(ECHO) flexExtCUDA: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))...
+ mkdir -p $(dir $(@))
+ $(CC) $(flexExtCUDA_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles)) -o $@
+ @mkdir -p $(dir $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))))))
+ cp $(flexExtCUDA_debug_DEPDIR).d $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
+ -e '/^$$/ d' -e 's/$$/ :/' < $(flexExtCUDA_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/flexExtCUDA/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(flexExtCUDA_debug_objsdir),, $@))), $(flexExtCUDA_cfiles))))).P; \
+ rm -f $(flexExtCUDA_debug_DEPDIR).d
+
+clean_flexExtCUDA: clean_flexExtCUDA_release clean_flexExtCUDA_debug
+ rm -rf $(DEPSDIR)
+
+export VERBOSE
+ifndef VERBOSE
+.SILENT:
+endif
diff --git a/demo/compiler/vc12win32/flexDemoCUDA.sln b/demo/compiler/vc12win32/flexDemoCUDA.sln
new file mode 100644
index 0000000..e23a5c8
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoCUDA.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoCUDA", "./flexDemoCUDA.vcxproj", "{5159D6B6-76B6-4056-6797-30484A82D93C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280} = {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtCUDA", "./../../../extensions/compiler/vc12win32/flexExtCUDA.vcxproj", "{FD4C9C06-7BEC-CDF8-C631-CD32A428A280}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|Win32 = debug|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|Win32.ActiveCfg = debug|Win32
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|Win32.Build.0 = debug|Win32
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|Win32.ActiveCfg = release|Win32
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|Win32.Build.0 = release|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|Win32.ActiveCfg = debug|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|Win32.Build.0 = debug|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|Win32.ActiveCfg = release|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc12win32/flexDemoCUDA.vcxproj b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj
new file mode 100644
index 0000000..5073547
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{5159D6B6-76B6-4056-6797-30484A82D93C}</ProjectGuid>
+ <RootNamespace>flexDemoCUDA</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugCUDA_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexDebugCUDA_x86.lib;./../../../lib/win32/NvFlexExtDebugCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceDebug_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseCUDA_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexExtReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceRelease_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc12win32/flexExtCUDA.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters
new file mode 100644
index 0000000..45f6d6c
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.filters
@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="opengl">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.user b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.user
new file mode 100644
index 0000000..1860514
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoCUDA.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc12win32/flexDemoD3D.sln b/demo/compiler/vc12win32/flexDemoD3D.sln
new file mode 100644
index 0000000..40ab897
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoD3D.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoD3D", "./flexDemoD3D.vcxproj", "{EF4EDDD8-2620-47AA-E75D-4C682C276C02}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D} = {9B42889D-2F0D-0378-E87E-82C8D918DB4D}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtD3D", "./../../../extensions/compiler/vc12win32/flexExtD3D.vcxproj", "{9B42889D-2F0D-0378-E87E-82C8D918DB4D}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|Win32 = debug|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|Win32.ActiveCfg = debug|Win32
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|Win32.Build.0 = debug|Win32
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|Win32.ActiveCfg = release|Win32
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|Win32.Build.0 = release|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|Win32.ActiveCfg = debug|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|Win32.Build.0 = debug|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|Win32.ActiveCfg = release|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc12win32/flexDemoD3D.vcxproj b/demo/compiler/vc12win32/flexDemoD3D.vcxproj
new file mode 100644
index 0000000..4708dba
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoD3D.vcxproj
@@ -0,0 +1,720 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EF4EDDD8-2620-47AA-E75D-4C682C276C02}</ProjectGuid>
+ <RootNamespace>flexDemoD3D</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/DX/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugD3D_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;FLEX_DIRECT_COMPUTE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexDebugD3D_x86.lib;./../../../lib/win32/NvFlexExtDebugD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/D3D/demo/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseD3D_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexReleaseD3D_x86.lib;./../../../lib/win32/NvFlexExtReleaseD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc12win32/flexExtD3D.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters b/demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters
new file mode 100644
index 0000000..15615f5
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoD3D.vcxproj.filters
@@ -0,0 +1,456 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d11">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc12win32/flexDemoD3D.vcxproj.user b/demo/compiler/vc12win32/flexDemoD3D.vcxproj.user
new file mode 100644
index 0000000..1860514
--- /dev/null
+++ b/demo/compiler/vc12win32/flexDemoD3D.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc12win64/flexDemoCUDA.sln b/demo/compiler/vc12win64/flexDemoCUDA.sln
new file mode 100644
index 0000000..6685ca3
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoCUDA.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoCUDA", "./flexDemoCUDA.vcxproj", "{5159D6B6-76B6-4056-6797-30484A82D93C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280} = {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtCUDA", "./../../../extensions/compiler/vc12win64/flexExtCUDA.vcxproj", "{FD4C9C06-7BEC-CDF8-C631-CD32A428A280}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|x64 = debug|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|x64.ActiveCfg = debug|x64
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|x64.Build.0 = debug|x64
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|x64.ActiveCfg = release|x64
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|x64.Build.0 = release|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|x64.ActiveCfg = debug|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|x64.Build.0 = debug|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|x64.ActiveCfg = release|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc12win64/flexDemoCUDA.vcxproj b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj
new file mode 100644
index 0000000..d00d61c
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{5159D6B6-76B6-4056-6797-30484A82D93C}</ProjectGuid>
+ <RootNamespace>flexDemoCUDA</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugCUDA_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexDebugCUDA_x64.lib;./../../../lib/win64/NvFlexExtDebugCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceDebug_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseCUDA_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexExtReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceRelease_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc12win64/flexExtCUDA.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters
new file mode 100644
index 0000000..45f6d6c
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.filters
@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="opengl">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.user b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.user
new file mode 100644
index 0000000..0c241a3
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoCUDA.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc12win64/flexDemoD3D.sln b/demo/compiler/vc12win64/flexDemoD3D.sln
new file mode 100644
index 0000000..930cafe
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoD3D.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoD3D", "./flexDemoD3D.vcxproj", "{EF4EDDD8-2620-47AA-E75D-4C682C276C02}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D} = {9B42889D-2F0D-0378-E87E-82C8D918DB4D}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtD3D", "./../../../extensions/compiler/vc12win64/flexExtD3D.vcxproj", "{9B42889D-2F0D-0378-E87E-82C8D918DB4D}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|x64 = debug|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|x64.ActiveCfg = debug|x64
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|x64.Build.0 = debug|x64
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|x64.ActiveCfg = release|x64
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|x64.Build.0 = release|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|x64.ActiveCfg = debug|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|x64.Build.0 = debug|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|x64.ActiveCfg = release|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc12win64/flexDemoD3D.vcxproj b/demo/compiler/vc12win64/flexDemoD3D.vcxproj
new file mode 100644
index 0000000..50513db
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoD3D.vcxproj
@@ -0,0 +1,720 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EF4EDDD8-2620-47AA-E75D-4C682C276C02}</ProjectGuid>
+ <RootNamespace>flexDemoD3D</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v120</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/DX/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugD3D_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexDebugD3D_x64.lib;./../../../lib/win64/NvFlexExtDebugD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/D3D/demo/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseD3D_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexReleaseD3D_x64.lib;./../../../lib/win64/NvFlexExtReleaseD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc12win64/flexExtD3D.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters b/demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters
new file mode 100644
index 0000000..15615f5
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoD3D.vcxproj.filters
@@ -0,0 +1,456 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d11">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc12win64/flexDemoD3D.vcxproj.user b/demo/compiler/vc12win64/flexDemoD3D.vcxproj.user
new file mode 100644
index 0000000..0c241a3
--- /dev/null
+++ b/demo/compiler/vc12win64/flexDemoD3D.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win32/flexDemoCUDA.sln b/demo/compiler/vc14win32/flexDemoCUDA.sln
new file mode 100644
index 0000000..af85d47
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoCUDA.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoCUDA", "./flexDemoCUDA.vcxproj", "{5159D6B6-76B6-4056-6797-30484A82D93C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280} = {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtCUDA", "./../../../extensions/compiler/vc14win32/flexExtCUDA.vcxproj", "{FD4C9C06-7BEC-CDF8-C631-CD32A428A280}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|Win32 = debug|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|Win32.ActiveCfg = debug|Win32
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|Win32.Build.0 = debug|Win32
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|Win32.ActiveCfg = release|Win32
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|Win32.Build.0 = release|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|Win32.ActiveCfg = debug|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|Win32.Build.0 = debug|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|Win32.ActiveCfg = release|Win32
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc14win32/flexDemoCUDA.vcxproj b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj
new file mode 100644
index 0000000..d9aca99
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{5159D6B6-76B6-4056-6797-30484A82D93C}</ProjectGuid>
+ <RootNamespace>flexDemoCUDA</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugCUDA_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexDebugCUDA_x86.lib;./../../../lib/win32/NvFlexExtDebugCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceDebug_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseCUDA_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win32/NvFlexReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexExtReleaseCUDA_x86.lib;./../../../lib/win32/NvFlexDeviceRelease_x86.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc14win32/flexExtCUDA.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters
new file mode 100644
index 0000000..45f6d6c
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.filters
@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="opengl">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.user b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.user
new file mode 100644
index 0000000..1860514
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoCUDA.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win32/flexDemoD3D.sln b/demo/compiler/vc14win32/flexDemoD3D.sln
new file mode 100644
index 0000000..87a0521
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoD3D.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoD3D", "./flexDemoD3D.vcxproj", "{EF4EDDD8-2620-47AA-E75D-4C682C276C02}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D} = {9B42889D-2F0D-0378-E87E-82C8D918DB4D}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtD3D", "./../../../extensions/compiler/vc14win32/flexExtD3D.vcxproj", "{9B42889D-2F0D-0378-E87E-82C8D918DB4D}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|Win32 = debug|Win32
+ release|Win32 = release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|Win32.ActiveCfg = debug|Win32
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|Win32.Build.0 = debug|Win32
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|Win32.ActiveCfg = release|Win32
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|Win32.Build.0 = release|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|Win32.ActiveCfg = debug|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|Win32.Build.0 = debug|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|Win32.ActiveCfg = release|Win32
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|Win32.Build.0 = release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc14win32/flexDemoD3D.vcxproj b/demo/compiler/vc14win32/flexDemoD3D.vcxproj
new file mode 100644
index 0000000..6744073
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoD3D.vcxproj
@@ -0,0 +1,720 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|Win32">
+ <Configuration>debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|Win32">
+ <Configuration>release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EF4EDDD8-2620-47AA-E75D-4C682C276C02}</ProjectGuid>
+ <RootNamespace>flexDemoD3D</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/DX/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugD3D_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;FLEX_DIRECT_COMPUTE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexDebugD3D_x86.lib;./../../../lib/win32/NvFlexExtDebugD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <OutDir>./../../../bin/win32\</OutDir>
+ <IntDir>./build/win32/D3D/demo/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseD3D_x86</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <ClCompile>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib;./../../../lib/win32/NvFlexReleaseD3D_x86.lib;./../../../lib/win32/NvFlexExtReleaseD3D_x86.lib;./../../../external/glew/lib/win32/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x86.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x86.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|Win32'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|Win32'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|Win32'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> </ObjectFileOutput>
+ </FxCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc14win32/flexExtD3D.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters b/demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters
new file mode 100644
index 0000000..15615f5
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoD3D.vcxproj.filters
@@ -0,0 +1,456 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d11">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win32/flexDemoD3D.vcxproj.user b/demo/compiler/vc14win32/flexDemoD3D.vcxproj.user
new file mode 100644
index 0000000..1860514
--- /dev/null
+++ b/demo/compiler/vc14win32/flexDemoD3D.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win64/flexDemoCUDA.sln b/demo/compiler/vc14win64/flexDemoCUDA.sln
new file mode 100644
index 0000000..fd5dcb2
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoCUDA.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoCUDA", "./flexDemoCUDA.vcxproj", "{5159D6B6-76B6-4056-6797-30484A82D93C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280} = {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtCUDA", "./../../../extensions/compiler/vc14win64/flexExtCUDA.vcxproj", "{FD4C9C06-7BEC-CDF8-C631-CD32A428A280}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|x64 = debug|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|x64.ActiveCfg = debug|x64
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.debug|x64.Build.0 = debug|x64
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|x64.ActiveCfg = release|x64
+ {5159D6B6-76B6-4056-6797-30484A82D93C}.release|x64.Build.0 = release|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|x64.ActiveCfg = debug|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.debug|x64.Build.0 = debug|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|x64.ActiveCfg = release|x64
+ {FD4C9C06-7BEC-CDF8-C631-CD32A428A280}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc14win64/flexDemoCUDA.vcxproj b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj
new file mode 100644
index 0000000..056fb6d
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{5159D6B6-76B6-4056-6797-30484A82D93C}</ProjectGuid>
+ <RootNamespace>flexDemoCUDA</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugCUDA_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexDebugCUDA_x64.lib;./../../../lib/win64/NvFlexExtDebugCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceDebug_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugCUDA_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugCUDA_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseCUDA_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../../../..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>cudart.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../lib/win64/NvFlexReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexExtReleaseCUDA_x64.lib;./../../../lib/win64/NvFlexDeviceRelease_x64.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseCUDA_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseCUDA_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc14win64/flexExtCUDA.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters
new file mode 100644
index 0000000..45f6d6c
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.filters
@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="opengl">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\opengl\imguiRenderGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shader.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\opengl\shadersGL.cpp">
+ <Filter>opengl</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\opengl\imguiRenderGL.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\opengl\shader.h">
+ <Filter>opengl</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.user b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.user
new file mode 100644
index 0000000..0c241a3
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoCUDA.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win64/flexDemoD3D.sln b/demo/compiler/vc14win64/flexDemoD3D.sln
new file mode 100644
index 0000000..554cf23
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoD3D.sln
@@ -0,0 +1,33 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexDemoD3D", "./flexDemoD3D.vcxproj", "{EF4EDDD8-2620-47AA-E75D-4C682C276C02}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D} = {9B42889D-2F0D-0378-E87E-82C8D918DB4D}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flexExtD3D", "./../../../extensions/compiler/vc14win64/flexExtD3D.vcxproj", "{9B42889D-2F0D-0378-E87E-82C8D918DB4D}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ debug|x64 = debug|x64
+ release|x64 = release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|x64.ActiveCfg = debug|x64
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.debug|x64.Build.0 = debug|x64
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|x64.ActiveCfg = release|x64
+ {EF4EDDD8-2620-47AA-E75D-4C682C276C02}.release|x64.Build.0 = release|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|x64.ActiveCfg = debug|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.debug|x64.Build.0 = debug|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|x64.ActiveCfg = release|x64
+ {9B42889D-2F0D-0378-E87E-82C8D918DB4D}.release|x64.Build.0 = release|x64
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddins) = postSolution
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ EndGlobalSection
+EndGlobal
diff --git a/demo/compiler/vc14win64/flexDemoD3D.vcxproj b/demo/compiler/vc14win64/flexDemoD3D.vcxproj
new file mode 100644
index 0000000..9b3dfae
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoD3D.vcxproj
@@ -0,0 +1,720 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="debug|x64">
+ <Configuration>debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="release|x64">
+ <Configuration>release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EF4EDDD8-2620-47AA-E75D-4C682C276C02}</ProjectGuid>
+ <RootNamespace>flexDemoD3D</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/DX/debug\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoDebugD3D_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <ClCompile>
+ <FloatingPointModel>Precise</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexDebugD3D_x64.lib;./../../../lib/win64/NvFlexExtDebugD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoDebugD3D_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoDebugD3D_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <OutDir>./../../../bin/win64\</OutDir>
+ <IntDir>./build/win64/D3D/demo/release\</IntDir>
+ <TargetExt>.exe</TargetExt>
+ <TargetName>NvFlexDemoReleaseD3D_x64</TargetName>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ <CodeAnalysisRuleAssemblies />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <ClCompile>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <AdditionalOptions> /d2Zi+</AdditionalOptions>
+ <Optimization>Full</Optimization>
+ <AdditionalIncludeDirectories>$(CUDA_PATH)/include;$(CUDA_PATH)/extras/cupti/include;./../../..;./../..;./../../d3d11;./../../../external/SDL2-2.0.4/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CONSOLE;WIN32;_CRT_SECURE_NO_WARNINGS;FLEX_DX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <PrecompiledHeaderFile></PrecompiledHeaderFile>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2.lib;./../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib;./../../../lib/win64/NvFlexReleaseD3D_x64.lib;./../../../lib/win64/NvFlexExtReleaseD3D_x64.lib;./../../../external/glew/lib/x64/glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>$(OutDir)NvFlexDemoReleaseD3D_x64.exe</OutputFile>
+ <AdditionalLibraryDirectories>$(CUDA_PATH)/lib/x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>$(OutDir)/NvFlexDemoReleaseD3D_x64.exe.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ <ResourceCompile>
+ </ResourceCompile>
+ <ProjectReference>
+ </ProjectReference>
+ </ItemDefinitionGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLineVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">debugLinePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">imguiVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshPS_Shadow</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">meshVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">pointPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffuseGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">diffusePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Geometry</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthGS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">ellipsoidDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Vertex</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">passThroughVS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">blurDepthPS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='debug|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='debug|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='debug|x64'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='debug|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> </ObjectFileOutput>
+ <ShaderType Condition="'$(Configuration)|$(Platform)'=='release|x64'">Pixel</ShaderType>
+ <ShaderModel Condition="'$(Configuration)|$(Platform)'=='release|x64'">5.0</ShaderModel>
+ <EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</EnableDebuggingInformation>
+ <DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</DisableOptimizations>
+ <EntryPointName Condition="'$(Configuration)|$(Platform)'=='release|x64'">compositePS</EntryPointName>
+ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</TreatWarningAsError>
+ <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../../demo/d3d11/shaders/%(Filename).hlsl.h</HeaderFileOutput>
+ <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='release|x64'"> </ObjectFileOutput>
+ </FxCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="./../../../extensions/compiler/vc14win64/flexExtD3D.vcxproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets"></ImportGroup>
+</Project>
diff --git a/demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters b/demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters
new file mode 100644
index 0000000..15615f5
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoD3D.vcxproj.filters
@@ -0,0 +1,456 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="demo">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="demo\scenes">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\scenes\adhesion.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\armadilloshower.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bananas.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bouyancy.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\bunnybath.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ccdfluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\clothlayers.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\dambreak.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\darts.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\debris.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\deformables.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\envcloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\flag.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidblock.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\fluidclothcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\forcefield.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionmoving.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\frictionramp.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\gamemesh.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\googun.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\granularshape.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\inflatable.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\initialoverlap.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lighthouse.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\localspacefluid.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\lowdimensionalshapes.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\melting.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\mixedpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\nonconvex.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\parachutingbunnies.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\pasta.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\plasticstack.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\player.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\potpourri.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rayleightaylor.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\restitution.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\ridigbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidfluidcoupling.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidpile.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rigidrotation.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\rockpool.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\sdfcollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\shapecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\softbody.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\spherecloth.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\surfacetension.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\tearing.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\thinbox.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\trianglecollision.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\triggervolume.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\viscosity.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes\waterballoon.h">
+ <Filter>demo\scenes</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\imgui.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\main.cpp">
+ <Filter>demo</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\benchmark.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\helpers.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\imgui.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\scenes.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\shaders.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\stb_truetype.h">
+ <Filter>demo</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="include">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\include\NvFlex.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexDevice.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\include\NvFlexExt.h">
+ <Filter>include</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="core">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\core\aabbtree.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\core.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\extrude.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\maths.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\mesh.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\perlin.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\pfm.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\platform.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\sdf.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\tga.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\core\voxelize.cpp">
+ <Filter>core</Filter>
+ </ClCompile>
+ <ClInclude Include="..\..\..\core\aabbtree.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\cloth.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\convex.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\core.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\extrude.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat22.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat33.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mat44.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\maths.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\matnn.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\mesh.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\perlin.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\pfm.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\platform.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\point3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\quat.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\sdf.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\skylight.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\tga.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\types.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec2.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec3.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\vec4.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\core\voxelize.h">
+ <Filter>core</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="d3d11">
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\d3d11\appD3D11Ctx.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\debugLineRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\diffuseRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\fluidRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraph.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\imguiGraphD3D11.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\meshRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\pointRender.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\renderTarget.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\d3d11\shadowMap.h">
+ <Filter>d3d11</Filter>
+ </ClInclude>
+ <ClCompile Include="..\..\d3d11\appD3D11Ctx.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\diffuseRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\fluidRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraph.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\imguiGraphD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\meshRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\pointRender.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\renderTarget.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadersD3D11.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\d3d11\shadowMap.cpp">
+ <Filter>d3d11</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup><Filter Include="Shader Files"></Filter></ItemGroup>
+ <ItemGroup>
+ <FxCompile Include="./../../d3d11/shaders/debugLineVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/debugLinePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/imguiVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshShadowPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/meshVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/pointPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffuseGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/diffusePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthGS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/ellipsoidDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/passThroughVS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/blurDepthPS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ <FxCompile Include="./../../d3d11/shaders/compositePS.hlsl">
+ <Filter>Shader Files</Filter>
+ </FxCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/vc14win64/flexDemoD3D.vcxproj.user b/demo/compiler/vc14win64/flexDemoD3D.vcxproj.user
new file mode 100644
index 0000000..0c241a3
--- /dev/null
+++ b/demo/compiler/vc14win64/flexDemoD3D.vcxproj.user
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
+ <LocalDebuggerWorkingDirectory>$(OutputPath)</LocalDebuggerWorkingDirectory>
+</PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/demo/compiler/xpj/flexDemoCUDA.xpj b/demo/compiler/xpj/flexDemoCUDA.xpj
new file mode 100644
index 0000000..1257e14
--- /dev/null
+++ b/demo/compiler/xpj/flexDemoCUDA.xpj
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<XPJ version="4">
+
+ <template filename="../../../common.xpjt"/>
+
+ <Project name="flexDemoCUDA">
+
+ <Conditional value="${config}" match="internal">
+ <Import file="../../../src/device/compiler/xpj/flexDevice.xpj" />
+ <Import file="../../../src/compiler/xpj/flexCUDA.xpj" />
+ </Conditional>
+
+ <Import file="../../../extensions/compiler/xpj/flexExtCUDA.xpj" />
+
+ <Export platforms="Win32 Win64">../${xpj:TOOL}${xpj:PLATFORM}</Export>
+ <Export platform="android{x}" tool="make">../makeandroid</Export>
+ <Export platform="Linux64" tool="make">../makelinux64</Export>
+
+ <Var name="ProjectRoot" value="../../.."/>
+
+ <Target name="flexDemoCUDA">
+
+ <!-- Windows -->
+
+ <Config name="default" type="console" platforms="Win32 Win64">
+
+ <apply-template name="windows-common"/>
+
+ <OutDir platform="Win32">../../../bin/win32/</OutDir>
+ <OutDir platform="Win64">../../../bin/win64/</OutDir>
+ <DebugWorkingDir>$(OutputPath)</DebugWorkingDir>
+
+ <Preprocessor type="define">
+ _CONSOLE
+ WIN32
+ _CRT_SECURE_NO_WARNINGS
+ </Preprocessor>
+
+ <WarningLevel>3</WarningLevel>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+
+ <CharacterSet>MultiByte</CharacterSet>
+
+ <SearchPaths type="header">
+ ..\..\..\..\..
+ </SearchPaths>
+
+ <Libraries>
+ cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
+ </Libraries>
+
+ </Config>
+
+ <Config name="debug" type="console" platforms="Win32 Win64">
+ <OutFile platform="Win32">NvFlexDemoDebugCUDA_x86.exe</OutFile>
+ <OutFile platform="Win64">NvFlexDemoDebugCUDA_x64.exe</OutFile>
+
+ <IntDir>./build/${xpj:PLATFORM}/debug/</IntDir>
+
+ <Preprocessor type="define">
+ _DEBUG
+ </Preprocessor>
+ <Preprocessor type="define">
+ _ITERATOR_DEBUG_LEVEL=0
+ </Preprocessor>
+ <RuntimeLibrary>MTd</RuntimeLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <FloatingPointModel>Precise</FloatingPointModel>
+
+ <Libraries platforms="Win32">
+ ../../../lib/win32/NvFlexDebugCUDA_x86.lib
+ ../../../lib/win32/NvFlexExtDebugCUDA_x86.lib
+ ../../../lib/win32/NvFlexDeviceDebug_x86.lib
+ ../../../external/SDL2-2.0.4/lib/x86/SDL2.lib
+ ../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib
+ ../../../external/glew/lib/win32/glew32.lib
+ </Libraries>
+ <Libraries platforms="Win64">
+ ../../../lib/win64/NvFlexDebugCUDA_x64.lib
+ ../../../lib/win64/NvFlexExtDebugCUDA_x64.lib
+ ../../../lib/win64/NvFlexDeviceDebug_x64.lib
+ ../../../external/SDL2-2.0.4/lib/x64/SDL2.lib
+ ../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib
+ ../../../external/glew/lib/x64/glew32.lib
+ </Libraries>
+
+ </Config>
+
+ <Config name="release" type="console" platforms="Win32 Win64">
+ <OutFile platform="Win32">NvFlexDemoReleaseCUDA_x86.exe</OutFile>
+ <OutFile platform="Win64">NvFlexDemoReleaseCUDA_x64.exe</OutFile>
+
+ <IntDir>./build/${xpj:PLATFORM}/release/</IntDir>
+
+ <Preprocessor type="define">
+ NDEBUG
+ </Preprocessor>
+ <RuntimeLibrary>MT</RuntimeLibrary>
+ <WholeProgramOptimization>1</WholeProgramOptimization>
+ <Optimization>3</Optimization>
+ <EnableIntrinsicFunctions>true</EnableIntrinsicFunctions>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <EnableFunctionLevelLinking>true</EnableFunctionLevelLinking>
+ <EnableEnhancedInstructionSet>2</EnableEnhancedInstructionSet>
+ <FloatingPointModel>Fast</FloatingPointModel>
+
+ <Libraries platforms="Win32">
+ ../../../lib/win32/NvFlexReleaseCUDA_x86.lib
+ ../../../lib/win32/NvFlexExtReleaseCUDA_x86.lib
+ ../../../lib/win32/NvFlexDeviceRelease_x86.lib
+ ../../../external/SDL2-2.0.4/lib/x86/SDL2.lib
+ ../../../external/SDL2-2.0.4/lib/x86/SDL2main.lib
+ ../../../external/glew/lib/win32/glew32.lib
+ </Libraries>
+ <Libraries platforms="Win64">
+ ../../../lib/win64/NvFlexReleaseCUDA_x64.lib
+ ../../../lib/win64/NvFlexExtReleaseCUDA_x64.lib
+ ../../../lib/win64/NvFlexDeviceRelease_x64.lib
+ ../../../external/SDL2-2.0.4/lib/x64/SDL2.lib
+ ../../../external/SDL2-2.0.4/lib/x64/SDL2main.lib
+ ../../../external/glew/lib/x64/glew32.lib
+ </Libraries>
+
+ </Config>
+
+
+ <!-- Android -->
+
+ <Config name="default" type="app" platforms="android{x}">
+
+ <apply-template name="android-common"/>
+
+ <OutDir tool="make">${user:ProjectRoot}/demo/compiler/android/flex_project/libs/armeabi-v7a</OutDir>
+
+ <Preprocessor type="define">
+ android
+ ANDROID=1
+ ANDROID_PLAT=1
+ DISABLE_IMPORTGL
+ </Preprocessor>
+
+ <SearchPaths type="header" tool="make">
+ "${user:ProjectRoot}"
+ "${user:ProjectRoot}/external/egl_setup"
+ "${user:ProjectRoot}/external/regal_static/include"
+ </SearchPaths>
+
+ <SearchPaths type="library" tool="make">
+ "${user:ProjectRoot}/external/regal_static/lib/armeabi-v7a"
+ "${user:ProjectRoot}/lib/android"
+ </SearchPaths>
+
+ <Libraries>
+ android stdc++ c m log dl EGL gomp cudart_static Regal_static
+ </Libraries>
+
+ <Libraries tool="make">
+ stlport_static
+ </Libraries>
+
+ <ExceptionHandling>True</ExceptionHandling>
+ <RuntimeTypeInfo>True</RuntimeTypeInfo>
+
+ <CFlags>
+ -std=c++11 -fno-exceptions -fno-rtti
+ </CFlags>
+
+ <CFlags tool="make">
+ -fpic -fPIC -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -O2 -g -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300
+ </CFlags>
+
+ <LFlags tool="make">
+ --sysroot=${NDK_ROOT}/${NDK_VERSION}/platforms/android-15/arch-arm -shared -Wl,--no-undefined
+ </LFlags>
+
+ <AndroidAPILevel>15</AndroidAPILevel>
+ <AntBuildDirectory>
+ ${user:ProjectRoot}/demo/compiler/android/flex_project
+ </AntBuildDirectory>
+ <AntJavaSourceDir>
+ ${user:ProjectRoot}/demo/compiler/android/src
+ </AntJavaSourceDir>
+
+ </Config>
+
+ <Configuration name="release" platforms="android{x}">
+ <OutFile>libflexDemo.so</OutFile>
+
+ <Preprocessor type="define">
+ NDEBUG
+ </Preprocessor>
+
+ <AntBuildType>debug</AntBuildType>
+
+ <Libraries>
+ NvFlexRelease_armv7l
+ NvFlexExtRelease_armv7l
+ </Libraries>
+
+ </Configuration>
+
+ <!-- Linux -->
+
+ <Config name="default" type="console" platforms="linux64">
+
+ <apply-template name="linux-common"/>
+
+ <Var name="Cub" value="${user:External}/cub-1.3.2"/>
+ <var name="GCC" value="g++"/>
+
+ <OutDir platforms="linux64" tool="make">${user:ProjectRoot}/bin/linux64</OutDir>
+
+ <SearchPaths type="header" tool="make">
+ "${user:ProjectRoot}"
+ </SearchPaths>
+
+ <CFlags tool="make">
+ -Wall -std=c++0x -fPIC -fpermissive -fno-strict-aliasing
+ </CFlags>
+
+ <LFlags>
+ -g -L${user:External}/glew/lib/linux -L/usr/lib -L"../../../lib/linux64" -L${user:External}/SDL2-2.0.4/lib/x64/ -L${user:CUDA_PATH}/lib64 -lGL -lglut -lGLU -lGLEW -lcudart_static -ldl
+ </LFlags>
+
+ </Config>
+
+ <Config name="release" type="console" platforms="linux64">
+ <Libraries>
+ :NvFlexReleaseCUDA_x64.a
+ :NvFlexExtReleaseCUDA_x64.a
+ :libSDL2.a
+ :libSDL2main.a
+ </Libraries>
+
+ <cflags>-O3 -ffast-math -DNDEBUG</cflags>
+ <OutFile>NvFlexDemoReleaseCUDA_x64</OutFile>
+ </Config>
+
+ <Config name="debug" type="console" platforms="linux64">
+ <Libraries>
+ :NvFlexDebugCUDA_x64.a
+ :NvFlexExtDebugCUDA_x64.a
+ :libSDL2.a
+ :libSDL2main.a
+ </Libraries>
+
+ <cflags> -g -O0</cflags>
+ <OutFile>NvFlexDemoDebugCUDA_x64</OutFile>
+ </Config>
+
+ <!-- Common Source -->
+
+ <Files name="demo" type="source" root="${user:ProjectRoot}/demo">
+ *.cpp *.h
+ scenes/*.h
+ </Files>
+
+ <Files name="opengl" type="source" root="${user:ProjectRoot}/demo/opengl">
+ *.cpp *.h
+ </Files>
+
+ <Files name="include" type="source" root="${user:ProjectRoot}/include">
+ *.h
+ </Files>
+
+ <Files name="core" type="source" root="${user:ProjectRoot}/core">
+ *.cpp *.h
+ </Files>
+
+ <!-- Android Source -->
+
+ <Files name="egl_setup" root="${user:ProjectRoot}/external/egl_setup" platform="android{x}">
+ *.cpp
+ *.h
+ </Files>
+
+ <Files name="android" root="${user:ProjectRoot}/demo/android" platform="android{x}">
+ *.cpp
+ *.c
+ *.h
+ </Files>
+
+ <Dependencies>
+ flexExtCUDA
+ </Dependencies>
+
+ <Conditional value="${config}" match="internal">
+ <Dependencies>
+ flexCUDA
+ flexDevice
+ </Dependencies>
+ </Conditional>
+
+ </Target>
+ </Project>
+
+</XPJ> \ No newline at end of file
diff --git a/demo/compiler/xpj/flexDemoD3D.xpj b/demo/compiler/xpj/flexDemoD3D.xpj
new file mode 100644
index 0000000..0c95377
--- /dev/null
+++ b/demo/compiler/xpj/flexDemoD3D.xpj
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<XPJ version="4">
+
+ <template filename="../../../common.xpjt"/>
+
+ <Project name="flexDemoD3D">
+
+ <Conditional value="${config}" match="internal">
+ <Import file="../../../src/device/compiler/xpj/flexDevice.xpj" />
+ <Import file="../../../src/compiler/xpj/flexD3D.xpj" />
+ </Conditional>
+
+ <Import file="../../../extensions/compiler/xpj/flexExtD3D.xpj" />
+
+ <Export platforms="Win32 Win64">../${xpj:TOOL}${xpj:PLATFORM}</Export>
+
+ <Var name="ProjectRoot" value="../../.."/>
+
+ <Target name="flexDemoD3D">
+
+ <!-- Windows -->
+
+ <Config name="default" type="console" platforms="Win32 Win64">
+
+ <apply-template name="windows-common"/>
+
+ <OutDir platform="Win32">${user:ProjectRoot}/bin/win32/</OutDir>
+ <OutDir platform="Win64">${user:ProjectRoot}/bin/win64/</OutDir>
+ <DebugWorkingDir>$(OutputPath)</DebugWorkingDir>
+
+ <Preprocessor type="define">
+ _CONSOLE
+ WIN32
+ _CRT_SECURE_NO_WARNINGS
+ FLEX_DX
+ </Preprocessor>
+
+ <WarningLevel>3</WarningLevel>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+
+ <CharacterSet>MultiByte</CharacterSet>
+
+ <SearchPaths type="header">
+ ${user:ProjectRoot}
+ ${user:ProjectRoot}\demo
+ ${user:ProjectRoot}\demo\d3d11
+ ${user:ProjectRoot}\external\SDL2-2.0.4\include
+ </SearchPaths>
+
+ <Libraries>
+ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
+ </Libraries>
+
+ <Libraries platforms="Win32">
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2main.lib
+ </Libraries>
+ <Libraries platforms="Win64">
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2main.lib
+ </Libraries>
+
+ </Config>
+
+ <Config name="debug" type="console" platforms="Win32 Win64">
+ <OutFile platform="Win32">NvFlexDemoDebugD3D_x86.exe</OutFile>
+ <OutFile platform="Win64">NvFlexDemoDebugD3D_x64.exe</OutFile>
+
+ <IntDir>./build/${xpj:PLATFORM}/DX/debug/</IntDir>
+
+ <Preprocessor type="define" platforms="Win32">
+ _DEBUG
+ _ITERATOR_DEBUG_LEVEL=0
+ FLEX_DIRECT_COMPUTE
+ </Preprocessor>
+ <Preprocessor type="define" platforms="Win64">
+ _DEBUG
+ _ITERATOR_DEBUG_LEVEL=0
+ </Preprocessor>
+ <RuntimeLibrary>MTd</RuntimeLibrary>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <FloatingPointModel>Precise</FloatingPointModel>
+
+ <Libraries platforms="Win32">
+ ${user:ProjectRoot}/lib/win32/NvFlexDebugD3D_x86.lib
+ ${user:ProjectRoot}/lib/win32/NvFlexExtDebugD3D_x86.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2main.lib
+ ${user:ProjectRoot}/external/glew/lib/win32/glew32.lib
+ </Libraries>
+ <Libraries platforms="Win64">
+ ${user:ProjectRoot}/lib/win64/NvFlexDebugD3D_x64.lib
+ ${user:ProjectRoot}/lib/win64/NvFlexExtDebugD3D_x64.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2main.lib
+ ${user:ProjectRoot}/external/glew/lib/x64/glew32.lib
+ </Libraries>
+
+ </Config>
+
+ <Config name="release" type="console" platforms="Win32 Win64">
+ <OutFile platform="Win32">NvFlexDemoReleaseD3D_x86.exe</OutFile>
+ <OutFile platform="Win64">NvFlexDemoReleaseD3D_x64.exe</OutFile>
+
+ <IntDir>./build/${xpj:PLATFORM}/D3D/demo/release/</IntDir>
+
+ <Preprocessor type="define" platforms="Win32">
+ NDEBUG
+ </Preprocessor>
+ <Preprocessor type="define" platforms="Win64">
+ NDEBUG
+ </Preprocessor>
+ <RuntimeLibrary>MT</RuntimeLibrary>
+ <WholeProgramOptimization>1</WholeProgramOptimization>
+ <Optimization>3</Optimization>
+ <EnableIntrinsicFunctions>true</EnableIntrinsicFunctions>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <EnableFunctionLevelLinking>true</EnableFunctionLevelLinking>
+ <FloatingPointModel>Fast</FloatingPointModel>
+
+ <Libraries platforms="Win32">
+ ${user:ProjectRoot}/lib/win32/NvFlexReleaseD3D_x86.lib
+ ${user:ProjectRoot}/lib/win32/NvFlexExtReleaseD3D_x86.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x86/SDL2main.lib
+ ${user:ProjectRoot}/external/glew/lib/win32/glew32.lib
+ </Libraries>
+ <Libraries platforms="Win64">
+ ${user:ProjectRoot}/lib/win64/NvFlexReleaseD3D_x64.lib
+ ${user:ProjectRoot}/lib/win64/NvFlexExtReleaseD3D_x64.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2.lib
+ ${user:ProjectRoot}/external/SDL2-2.0.4/lib/x64/SDL2main.lib
+ ${user:ProjectRoot}/external/glew/lib/x64/glew32.lib
+ </Libraries>
+
+ </Config>
+
+ <!-- Common Source -->
+
+ <Files name="demo" type="source" root="${user:ProjectRoot}/demo">
+ *.cpp *.h
+ scenes/*.h
+ </Files>
+
+ <Files name="include" type="source" root="${user:ProjectRoot}/include">
+ *.h
+ </Files>
+
+ <Files name="core" type="source" root="${user:ProjectRoot}/core">
+ *.cpp *.h
+ </Files>
+
+ <Dependencies>
+ flexD3D
+ flexExtD3D
+ </Dependencies>
+
+ <Files name="d3d11" type="source" root="${user:ProjectRoot}/demo/d3d11">
+ *.h
+ *.cpp
+ </Files>
+
+
+ <HLSL Configurations="release" DisableOptim="No" Debug="No" ShaderModel="5.0" Platforms="Win32 Win64" ObjectFileOutput=" " WarningAsErrors="false" OutputHeaderFileName="${user:ProjectRoot}/demo/d3d11/shaders/%(Filename).hlsl.h">
+
+ <File ShaderType="Vertex" EntryPoint="debugLineVS"> "${user:ProjectRoot}/demo/d3d11/shaders/debugLineVS.hlsl" </File>
+ <File ShaderType="Pixel" EntryPoint="debugLinePS"> "${user:ProjectRoot}/demo/d3d11/shaders/debugLinePS.hlsl" </File>
+
+ <File ShaderType="Pixel" EntryPoint="imguiPS"> "${user:ProjectRoot}/demo/d3d11/shaders/imguiPS.hlsl" </File>
+ <File ShaderType="Vertex" EntryPoint="imguiVS"> "${user:ProjectRoot}/demo/d3d11/shaders/imguiVS.hlsl" </File>
+
+ <File ShaderType="Pixel" EntryPoint="meshPS"> "${user:ProjectRoot}/demo/d3d11/shaders/meshPS.hlsl" </File>
+ <File ShaderType="Pixel" EntryPoint="meshPS_Shadow"> "${user:ProjectRoot}/demo/d3d11/shaders/meshShadowPS.hlsl" </File>
+ <File ShaderType="Vertex" EntryPoint="meshVS"> "${user:ProjectRoot}/demo/d3d11/shaders/meshVS.hlsl" </File>
+
+ <File ShaderType="Vertex" EntryPoint="pointVS"> "${user:ProjectRoot}/demo/d3d11/shaders/pointVS.hlsl" </File>
+ <File ShaderType="Geometry" EntryPoint="pointGS"> "${user:ProjectRoot}/demo/d3d11/shaders/pointGS.hlsl" </File>
+ <File ShaderType="Pixel" EntryPoint="pointPS"> "${user:ProjectRoot}/demo/d3d11/shaders/pointPS.hlsl" </File>
+
+ <File ShaderType="Vertex" EntryPoint="diffuseVS"> "${user:ProjectRoot}/demo/d3d11/shaders/diffuseVS.hlsl" </File>
+ <File ShaderType="Geometry" EntryPoint="diffuseGS"> "${user:ProjectRoot}/demo/d3d11/shaders/diffuseGS.hlsl" </File>
+ <File ShaderType="Pixel" EntryPoint="diffusePS"> "${user:ProjectRoot}/demo/d3d11/shaders/diffusePS.hlsl" </File>
+
+ <File ShaderType="Vertex" EntryPoint="ellipsoidDepthVS"> "${user:ProjectRoot}/demo/d3d11/shaders/ellipsoidDepthVS.hlsl" </File>
+ <File ShaderType="Geometry" EntryPoint="ellipsoidDepthGS"> "${user:ProjectRoot}/demo/d3d11/shaders/ellipsoidDepthGS.hlsl" </File>
+ <File ShaderType="Pixel" EntryPoint="ellipsoidDepthPS"> "${user:ProjectRoot}/demo/d3d11/shaders/ellipsoidDepthPS.hlsl" </File>
+
+ <File ShaderType="Vertex" EntryPoint="passThroughVS"> "${user:ProjectRoot}/demo/d3d11/shaders/passThroughVS.hlsl" </File>
+ <File ShaderType="Pixel" EntryPoint="blurDepthPS"> "${user:ProjectRoot}/demo/d3d11/shaders/blurDepthPS.hlsl" </File>
+ <File ShaderType="Pixel" EntryPoint="compositePS"> "${user:ProjectRoot}/demo/d3d11/shaders/compositePS.hlsl" </File>
+
+ </HLSL>
+
+ <Dependencies>
+ flexExtD3D
+ </Dependencies>
+
+ <Conditional value="${config}" match="internal">
+ <Dependencies>
+ flexD3D
+ flexDevice
+ </Dependencies>
+ </Conditional>
+
+ </Target>
+ </Project>
+</XPJ> \ No newline at end of file
diff --git a/demo/d3d11/appD3D11Ctx.cpp b/demo/d3d11/appD3D11Ctx.cpp
new file mode 100644
index 0000000..85129e5
--- /dev/null
+++ b/demo/d3d11/appD3D11Ctx.cpp
@@ -0,0 +1,761 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+//direct3d headers
+#include <d3d11.h>
+#include <dxgi.h>
+
+// include the Direct3D Library file
+#pragma comment (lib, "d3d11.lib")
+#pragma comment (lib, "DXGI.lib")
+
+#include "appD3D11Ctx.h"
+
+#include <stdio.h>
+#include <math.h>
+
+#include <SDL.h>
+#include <SDL_video.h>
+#include <SDL_syswm.h>
+
+AppGraphProfiler* appGraphCreateProfiler(AppGraphCtx* ctx);
+void appGraphProfilerFrameBegin(AppGraphProfiler* profiler);
+void appGraphProfilerFrameEnd(AppGraphProfiler* profiler);
+void appGraphProfilerEnable(AppGraphProfiler* profiler, bool enabled);
+void appGraphProfilerBegin(AppGraphProfiler* profiler, const char* label);
+void appGraphProfilerEnd(AppGraphProfiler* profiler, const char* label);
+bool appGraphProfilerGet(AppGraphProfiler* profiler, const char** plabel, float* cpuTime, float* gpuTime, int index);
+void appGraphReleaseProfiler(AppGraphProfiler* profiler);
+
+AppGraphCtx::AppGraphCtx()
+{
+ m_profiler = appGraphCreateProfiler(this);
+ memset(&m_viewport, 0, sizeof(m_viewport));
+}
+
+AppGraphCtx::~AppGraphCtx()
+{
+ AppGraphCtxReleaseRenderTarget(this);
+
+ COMRelease(m_swapChain);
+ COMRelease(m_backBuffer);
+ COMRelease(m_rtv);
+ COMRelease(m_depthStencil);
+ COMRelease(m_dsv);
+ COMRelease(m_depthSRV);
+ COMRelease(m_depthState);
+ COMRelease(m_blendState);
+ COMRelease(m_resolvedTarget);
+ COMRelease(m_resolvedTargetSRV);
+ COMRelease(m_deviceContext);
+ COMRelease(m_device);
+
+ appGraphReleaseProfiler(m_profiler);
+ m_profiler = nullptr;
+}
+
+AppGraphCtx* AppGraphCtxCreate(int deviceID)
+{
+ AppGraphCtx* context = new AppGraphCtx;
+
+ HRESULT hr = S_OK;
+
+ // enumerate devices
+ IDXGIFactory1* pFactory = NULL;
+ CreateDXGIFactory1(IID_PPV_ARGS(&pFactory));
+ IDXGIAdapter1* pAdapterTemp = NULL;
+ IDXGIAdapter1* pAdapter = NULL;
+ DXGI_ADAPTER_DESC1 adapterDesc;
+ int adapterIdx = 0;
+ while (S_OK == pFactory->EnumAdapters1(adapterIdx, &pAdapterTemp))
+ {
+ pAdapterTemp->GetDesc1(&adapterDesc);
+
+ context->m_dedicatedVideoMemory = (size_t)adapterDesc.DedicatedVideoMemory;
+
+ if (deviceID == adapterIdx)
+ {
+ pAdapter = pAdapterTemp;
+ break;
+ }
+ else
+ {
+ pAdapterTemp->Release();
+ }
+ adapterIdx++;
+ }
+
+ D3D_DRIVER_TYPE driverTypes[] =
+ {
+ D3D_DRIVER_TYPE_UNKNOWN,
+ D3D_DRIVER_TYPE_HARDWARE,
+ D3D_DRIVER_TYPE_WARP,
+ D3D_DRIVER_TYPE_REFERENCE,
+ };
+ UINT numDriverTypes = 4;
+
+ D3D_FEATURE_LEVEL featureLevels[] =
+ {
+ D3D_FEATURE_LEVEL_11_1,
+ D3D_FEATURE_LEVEL_11_0,
+ D3D_FEATURE_LEVEL_10_1,
+ D3D_FEATURE_LEVEL_10_0,
+ };
+ UINT numFeatureLevels = 4;
+
+ UINT createDeviceFlags = 0;
+#ifdef _DEBUG
+ createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
+#endif
+
+ for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++)
+ {
+ D3D_FEATURE_LEVEL featureLevel;
+ D3D_DRIVER_TYPE driverType = driverTypes[driverTypeIndex];
+ hr = D3D11CreateDevice(pAdapter, driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels,
+ D3D11_SDK_VERSION, &context->m_device, &featureLevel, &context->m_deviceContext);
+ if (SUCCEEDED(hr))
+ {
+ break;
+ }
+ }
+ if (FAILED(hr))
+ {
+ delete context;
+ return nullptr;
+ }
+
+ // cleanup adapter and factory
+ COMRelease(pAdapter);
+ COMRelease(pFactory);
+
+ // create depth state
+ D3D11_DEPTH_STENCIL_DESC depthStateDesc = {};
+ depthStateDesc.DepthEnable = TRUE;
+ depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
+
+ if (hr = context->m_device->CreateDepthStencilState(&depthStateDesc, &context->m_depthState))
+ {
+ delete context;
+ return nullptr;
+ }
+
+ // create blend state
+ D3D11_BLEND_DESC blendStateDesc = {};
+ blendStateDesc.RenderTarget[0].BlendEnable = TRUE;
+ blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
+ blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
+ blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
+ blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
+ blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
+ blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
+ blendStateDesc.RenderTarget[0].RenderTargetWriteMask = 0x0f;
+
+ if (hr = context->m_device->CreateBlendState(&blendStateDesc, &context->m_blendState))
+ {
+ delete context;
+ return nullptr;
+ }
+
+ return context;
+}
+
+void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int samples)
+{
+ // TODO: fix iflip fullscreen support
+ fullscreen = false;
+
+ HWND hWnd = nullptr;
+ // get Windows handle to this SDL window
+ SDL_SysWMinfo winInfo;
+ SDL_VERSION(&winInfo.version);
+ if (SDL_GetWindowWMInfo(window, &winInfo))
+ {
+ if (winInfo.subsystem == SDL_SYSWM_WINDOWS)
+ {
+ hWnd = winInfo.info.win.window;
+ }
+ }
+ context->m_hWnd = hWnd;
+ context->m_fullscreen = fullscreen;
+
+ HRESULT hr = S_OK;
+
+ RECT rc;
+ GetClientRect(context->m_hWnd, &rc);
+ UINT width = rc.right - rc.left;
+ UINT height = rc.bottom - rc.top;
+
+ context->m_winW = width;
+ context->m_winH = height;
+
+ // enumerate devices
+ IDXGIFactory1* pFactory = NULL;
+ CreateDXGIFactory1(IID_PPV_ARGS(&pFactory));
+
+ // create the swap chain
+ for (int i = 0; i < 2; i++)
+ {
+ DXGI_SWAP_CHAIN_DESC desc;
+ ZeroMemory(&desc, sizeof(desc));
+ desc.BufferCount = 1;
+ desc.BufferDesc.Width = context->m_winW;
+ desc.BufferDesc.Height = context->m_winH;
+ desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ desc.BufferDesc.RefreshRate.Numerator = 0;
+ desc.BufferDesc.RefreshRate.Denominator = 0;
+ desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // DXGI_SWAP_EFFECT_FLIP_DISCARD;
+ desc.OutputWindow = context->m_hWnd;
+ desc.SampleDesc.Count = samples;
+ desc.SampleDesc.Quality = 0;
+ desc.Windowed = TRUE; // m_fullscreen ? FALSE : TRUE;
+ desc.Flags = 0u;
+
+ if (hr = pFactory->CreateSwapChain(context->m_device, &desc, (IDXGISwapChain**)&context->m_swapChain))
+ {
+ COMRelease(context->m_swapChain);
+ context->m_fullscreen = false;
+ continue;
+ }
+
+ if (!context->m_fullscreen)
+ {
+
+ }
+ else
+ {
+ hr = context->m_swapChain->SetFullscreenState(true, nullptr);
+ if (hr != S_OK)
+ {
+ COMRelease(context->m_swapChain);
+ context->m_fullscreen = false;
+ continue;
+ }
+ DXGI_SWAP_CHAIN_DESC desc = {};
+ context->m_swapChain->GetDesc(&desc);
+ context->m_swapChain->ResizeBuffers(1, context->m_winW, context->m_winH, desc.BufferDesc.Format, desc.Flags);
+ }
+ break;
+ }
+
+ // configure scissor and viewport
+ {
+ context->m_viewport.Width = float(context->m_winW);
+ context->m_viewport.Height = float(context->m_winH);
+ context->m_viewport.MaxDepth = 1.f;
+ }
+
+ COMRelease(pFactory);
+
+ // Create a render target view
+ context->m_backBuffer = NULL;
+ hr = context->m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&context->m_backBuffer);
+ if (FAILED(hr))
+ {
+ return;
+ }
+
+ hr = context->m_device->CreateRenderTargetView(context->m_backBuffer, NULL, &context->m_rtv);
+ if (FAILED(hr))
+ {
+ return;
+ }
+
+ context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, NULL);
+
+ // viewport
+ context->m_deviceContext->RSSetViewports(1, &context->m_viewport);
+
+ {
+ D3D11_TEXTURE2D_DESC texDesc = {};
+ texDesc.Width = width;
+ texDesc.Height = height;
+ texDesc.MipLevels = 1;
+ texDesc.ArraySize = 1;
+ texDesc.Format = DXGI_FORMAT_R32_TYPELESS; // DXGI_FORMAT_R24G8_TYPELESS
+ texDesc.SampleDesc.Count = samples;
+ texDesc.SampleDesc.Quality = 0u;
+ texDesc.Usage = D3D11_USAGE_DEFAULT;
+ texDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
+ texDesc.CPUAccessFlags = 0;
+ texDesc.MiscFlags = 0;
+
+ if (hr = context->m_device->CreateTexture2D(&texDesc, nullptr, &context->m_depthStencil))
+ {
+ return;
+ }
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC viewDesc = {};
+ viewDesc.Format = DXGI_FORMAT_D32_FLOAT;
+ viewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS;
+ viewDesc.Flags = 0u;
+ viewDesc.Texture2D.MipSlice = 0;
+
+ if (hr = context->m_device->CreateDepthStencilView(context->m_depthStencil, &viewDesc, &context->m_dsv))
+ {
+ return;
+ }
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
+ srvDesc.Format = DXGI_FORMAT_R32_FLOAT;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ srvDesc.Texture2D.MipLevels = 1;
+ srvDesc.Texture2D.MostDetailedMip = 0;
+
+ if (hr = context->m_device->CreateShaderResourceView(context->m_depthStencil, &srvDesc, &context->m_depthSRV))
+ {
+ return;
+ }
+ }
+
+ // resolved texture target (for refraction / scene sampling)
+ {
+ D3D11_TEXTURE2D_DESC texDesc = {};
+ texDesc.Width = width;
+ texDesc.Height = height;
+ texDesc.MipLevels = 1;
+ texDesc.ArraySize = 1;
+ texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ texDesc.SampleDesc.Count = 1;
+ texDesc.SampleDesc.Quality = 0u;
+ texDesc.Usage = D3D11_USAGE_DEFAULT;
+ texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ texDesc.CPUAccessFlags = 0;
+ texDesc.MiscFlags = 0;
+
+ if (hr = context->m_device->CreateTexture2D(&texDesc, nullptr, &context->m_resolvedTarget))
+ {
+ return;
+ }
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
+ srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MipLevels = 1;
+ srvDesc.Texture2D.MostDetailedMip = 0;
+
+ if (hr = context->m_device->CreateShaderResourceView(context->m_resolvedTarget, &srvDesc, &context->m_resolvedTargetSRV))
+ {
+ return;
+ }
+ }
+}
+
+void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context)
+{
+ if (context->m_swapChain == nullptr)
+ {
+ return;
+ }
+
+ BOOL bFullscreen = FALSE;
+ context->m_swapChain->GetFullscreenState(&bFullscreen, nullptr);
+ if (bFullscreen == TRUE) context->m_swapChain->SetFullscreenState(FALSE, nullptr);
+
+ COMRelease(context->m_swapChain);
+ COMRelease(context->m_backBuffer);
+ COMRelease(context->m_rtv);
+ COMRelease(context->m_depthStencil);
+ COMRelease(context->m_dsv);
+ COMRelease(context->m_depthSRV);
+ COMRelease(context->m_resolvedTarget);
+ COMRelease(context->m_resolvedTargetSRV);
+}
+
+void AppGraphCtxRelease(AppGraphCtx* context)
+{
+ if (context == nullptr) return;
+
+ delete context;
+}
+
+void AppGraphCtxResolveFrame(AppGraphCtx* context)
+{
+ context->m_deviceContext->ResolveSubresource(context->m_resolvedTarget, 0, context->m_backBuffer, 0, DXGI_FORMAT_R8G8B8A8_UNORM);
+}
+
+void AppGraphCtxFrameStart(AppGraphCtx* context, float clearColor[4])
+{
+ appGraphProfilerFrameBegin(context->m_profiler);
+
+ context->m_deviceContext->RSSetViewports(1, &context->m_viewport);
+ context->m_deviceContext->RSSetScissorRects(0, nullptr);
+
+ context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv);
+
+ context->m_deviceContext->ClearRenderTargetView(context->m_rtv, clearColor);
+ context->m_deviceContext->ClearDepthStencilView(context->m_dsv, D3D11_CLEAR_DEPTH, 1.f, 0u);
+
+ context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u);
+}
+
+void AppGraphCtxFramePresent(AppGraphCtx* context, bool fullsync)
+{
+ context->m_swapChain->Present(fullsync, 0);
+
+ appGraphProfilerFrameEnd(context->m_profiler);
+}
+
+void AppGraphCtxProfileEnable(AppGraphCtx* context, bool enabled)
+{
+ appGraphProfilerEnable(context->m_profiler, enabled);
+}
+
+void AppGraphCtxProfileBegin(AppGraphCtx* context, const char* label)
+{
+ appGraphProfilerBegin(context->m_profiler, label);
+}
+
+void AppGraphCtxProfileEnd(AppGraphCtx* context, const char* label)
+{
+ appGraphProfilerEnd(context->m_profiler, label);
+}
+
+bool AppGraphCtxProfileGet(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index)
+{
+ return appGraphProfilerGet(context->m_profiler, plabel, cpuTime, gpuTime, index);
+}
+
+// ******************************* Profiler *********************************
+
+namespace
+{
+ struct TimerCPU
+ {
+ LARGE_INTEGER oldCount;
+ LARGE_INTEGER count;
+ LARGE_INTEGER freq;
+ TimerCPU()
+ {
+ QueryPerformanceCounter(&count);
+ QueryPerformanceFrequency(&freq);
+ oldCount = count;
+ }
+ double getDeltaTime()
+ {
+ QueryPerformanceCounter(&count);
+ double dt = double(count.QuadPart - oldCount.QuadPart) / double(freq.QuadPart);
+ oldCount = count;
+ return dt;
+ }
+ };
+
+ struct TimerGPU
+ {
+ ID3D11Query* m_begin = nullptr;
+ ID3D11Query* m_end = nullptr;
+
+ TimerGPU() {}
+ ~TimerGPU()
+ {
+ COMRelease(m_begin);
+ COMRelease(m_end);
+ }
+ };
+
+ struct Timer
+ {
+ TimerCPU m_cpu;
+ TimerGPU m_gpu;
+
+ const char* m_label = nullptr;
+ float m_cpuTime = 0.f;
+ float m_gpuTime = 0.f;
+
+ Timer() {}
+ ~Timer() {}
+ };
+
+ struct TimerValue
+ {
+ const char* m_label = nullptr;
+ float m_cpuTime = 0.f;
+ float m_gpuTime = 0.f;
+
+ struct Stat
+ {
+ float m_time = 0.f;
+ float m_maxTime = 0.f;
+ float m_maxTimeAge = 0.f;
+
+ float m_smoothTime = 0.f;
+ float m_smoothTimeSum = 0.f;
+ float m_smoothTimeCount = 0.f;
+
+ Stat() {}
+ void push(float time)
+ {
+ m_time = time;
+
+ if (m_time > m_maxTime)
+ {
+ m_maxTime = m_time;
+ m_maxTimeAge = 0.f;
+ }
+
+ if (fabsf(m_time - m_maxTime) < 0.25f * m_maxTime)
+ {
+ m_smoothTimeSum += m_time;
+ m_smoothTimeCount += 1.f;
+ m_smoothTimeSum *= 0.98f;
+ m_smoothTimeCount *= 0.98f;
+ m_smoothTime = m_smoothTimeSum / m_smoothTimeCount;
+ }
+ }
+
+ float pull(float frameTime)
+ {
+ m_maxTimeAge += frameTime;
+
+ if (m_maxTimeAge > 1.f)
+ {
+ m_maxTimeAge = 0.f;
+ m_maxTime = m_time;
+ m_smoothTimeSum = 0.f;
+ m_smoothTimeCount = 0.f;
+ }
+ return m_smoothTime;
+ }
+ };
+
+ Stat m_cpu;
+ Stat m_gpu;
+
+ void push(float cpuTime, float gpuTime)
+ {
+ m_cpu.push(cpuTime);
+ m_gpu.push(gpuTime);
+ }
+
+ void pull(float frameTime)
+ {
+ m_cpuTime = m_cpu.pull(frameTime);
+ m_gpuTime = m_gpu.pull(frameTime);
+ }
+ };
+}
+
+struct AppGraphProfiler
+{
+ AppGraphCtx* m_context;
+
+ int m_state = 0;
+ bool m_enabled = false;
+
+ TimerCPU m_frameTimer;
+ float m_frameTime = 0.f;
+
+ ID3D11Query* m_disjoint = nullptr;
+
+ static const int m_timersCap = 64;
+ Timer m_timers[m_timersCap];
+ int m_timersSize = 0;
+
+ TimerValue m_timerValues[m_timersCap];
+ int m_timerValuesSize = 0;
+
+ AppGraphProfiler(AppGraphCtx* context);
+ ~AppGraphProfiler();
+};
+
+AppGraphProfiler::AppGraphProfiler(AppGraphCtx* context) : m_context(context)
+{
+}
+
+AppGraphProfiler::~AppGraphProfiler()
+{
+ COMRelease(m_disjoint);
+}
+
+AppGraphProfiler* appGraphCreateProfiler(AppGraphCtx* ctx)
+{
+ return new AppGraphProfiler(ctx);
+}
+
+void appGraphReleaseProfiler(AppGraphProfiler* profiler)
+{
+ delete profiler;
+}
+
+void appGraphProfilerFrameBegin(AppGraphProfiler* p)
+{
+ p->m_frameTime = (float)p->m_frameTimer.getDeltaTime();
+
+ if (p->m_state == 0 && p->m_enabled)
+ {
+ auto device = p->m_context->m_device;
+ auto deviceContext = p->m_context->m_deviceContext;
+
+ if (p->m_disjoint == nullptr)
+ {
+ D3D11_QUERY_DESC queryDesc;
+ queryDesc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT;
+ queryDesc.MiscFlags = 0u;
+ device->CreateQuery(&queryDesc, &p->m_disjoint);
+ }
+
+ deviceContext->Begin(p->m_disjoint);
+
+ p->m_timersSize = 0;
+
+ p->m_state = 1;
+ }
+}
+
+void appGraphProfilerFrameEnd(AppGraphProfiler* p)
+{
+ if (p->m_state == 1)
+ {
+ auto deviceContext = p->m_context->m_deviceContext;
+
+ deviceContext->End(p->m_disjoint);
+
+ p->m_state = 2;
+ }
+}
+
+void appGraphProfilerEnable(AppGraphProfiler* p, bool enabled)
+{
+ p->m_enabled = enabled;
+}
+
+void appGraphProfilerBegin(AppGraphProfiler* p, const char* label)
+{
+ if (p->m_state == 1 && p->m_timersSize < p->m_timersCap)
+ {
+ auto& timer = p->m_timers[p->m_timersSize++];
+ timer.m_label = label;
+ timer.m_cpu.getDeltaTime();
+
+ auto device = p->m_context->m_device;
+ auto deviceContext = p->m_context->m_deviceContext;
+
+ if (timer.m_gpu.m_begin == nullptr)
+ {
+ D3D11_QUERY_DESC queryDesc;
+ queryDesc.MiscFlags = 0u;
+ queryDesc.Query = D3D11_QUERY_TIMESTAMP;
+ device->CreateQuery(&queryDesc, &timer.m_gpu.m_begin);
+ device->CreateQuery(&queryDesc, &timer.m_gpu.m_end);
+ }
+
+ deviceContext->End(timer.m_gpu.m_begin);
+ }
+}
+
+void appGraphProfilerEnd(AppGraphProfiler* p, const char* label)
+{
+ if (p->m_state == 1)
+ {
+ Timer* timer = nullptr;
+ for (int i = 0; i < p->m_timersSize; i++)
+ {
+ if (strcmp(p->m_timers[i].m_label, label) == 0)
+ {
+ timer = &p->m_timers[i];
+ break;
+ }
+ }
+ if (timer)
+ {
+ auto deviceContext = p->m_context->m_deviceContext;
+
+ deviceContext->End(timer->m_gpu.m_end);
+
+ timer->m_cpuTime = (float)timer->m_cpu.getDeltaTime();
+ }
+ }
+}
+
+bool appGraphProfilerFlush(AppGraphProfiler* p)
+{
+ if (p->m_state == 2)
+ {
+ auto deviceContext = p->m_context->m_deviceContext;
+
+ // check disjoint for completion
+ if (deviceContext->GetData(p->m_disjoint, nullptr, 0u, 0u) != S_OK)
+ {
+ return false;
+ }
+
+ D3D11_QUERY_DATA_TIMESTAMP_DISJOINT tsDisjoint;
+ deviceContext->GetData(p->m_disjoint, &tsDisjoint, sizeof(tsDisjoint), 0u);
+ if (tsDisjoint.Disjoint)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < p->m_timersSize; i++)
+ {
+ Timer& timer = p->m_timers[i];
+
+ UINT64 tsBegin, tsEnd;
+ if (deviceContext->GetData(timer.m_gpu.m_begin, &tsBegin, sizeof(UINT64), 0) != S_OK)
+ {
+ return false;
+ }
+ if (deviceContext->GetData(timer.m_gpu.m_end, &tsEnd, sizeof(UINT64), 0) != S_OK)
+ {
+ return false;
+ }
+
+ timer.m_gpuTime = float(tsEnd - tsBegin) / float(tsDisjoint.Frequency);
+
+ // update TimerValue
+ int j = 0;
+ for (; j < p->m_timerValuesSize; j++)
+ {
+ TimerValue& value = p->m_timerValues[j];
+ if (strcmp(value.m_label, timer.m_label) == 0)
+ {
+ value.push(timer.m_cpuTime, timer.m_gpuTime);
+ break;
+ }
+ }
+ if (j >= p->m_timerValuesSize && p->m_timerValuesSize < p->m_timersCap)
+ {
+ TimerValue& value = p->m_timerValues[p->m_timerValuesSize++];
+ value.m_label = timer.m_label;
+ value.push(timer.m_cpuTime, timer.m_gpuTime);
+ }
+ }
+
+ p->m_state = 0;
+ }
+ return false;
+}
+
+bool appGraphProfilerGet(AppGraphProfiler* p, const char** plabel, float* cpuTime, float* gpuTime, int index)
+{
+ appGraphProfilerFlush(p);
+ {
+ if (index < p->m_timerValuesSize)
+ {
+ TimerValue& timer = p->m_timerValues[index];
+
+ timer.pull(p->m_frameTime);
+
+ if (plabel) *plabel = timer.m_label;
+ if (cpuTime) *cpuTime = timer.m_cpuTime;
+ if (gpuTime) *gpuTime = timer.m_gpuTime;
+
+ return true;
+ }
+ }
+ return false;
+}
+
+size_t AppGraphCtxDedicatedVideoMemory(AppGraphCtx* context)
+{
+ return context->m_dedicatedVideoMemory;
+}
diff --git a/demo/d3d11/appD3D11Ctx.h b/demo/d3d11/appD3D11Ctx.h
new file mode 100644
index 0000000..071952e
--- /dev/null
+++ b/demo/d3d11/appD3D11Ctx.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <windows.h>
+#include <d3d11.h>
+
+
+template <class T>
+void inline COMRelease(T& t)
+{
+ if (t) t->Release();
+ t = nullptr;
+}
+
+template <class T>
+void inline COMRelease(T& t, UINT arraySize)
+{
+ for (UINT i = 0; i < arraySize; i++)
+ {
+ if (t[i]) t[i]->Release();
+ t[i] = nullptr;
+ }
+}
+
+
+
+struct SDL_Window;
+struct AppGraphProfiler;
+
+struct AppGraphCtx
+{
+ HWND m_hWnd = nullptr;
+
+ int m_winW = 0;
+ int m_winH = 0;
+ bool m_fullscreen = false;
+
+ size_t m_dedicatedVideoMemory = 0u;
+
+ // D3D11 objects
+ D3D11_VIEWPORT m_viewport;
+ ID3D11Device* m_device = nullptr;
+ ID3D11DeviceContext* m_deviceContext = nullptr;
+ IDXGISwapChain* m_swapChain = nullptr;
+ ID3D11Texture2D* m_backBuffer = nullptr;
+ ID3D11RenderTargetView* m_rtv = nullptr;
+ ID3D11Texture2D* m_depthStencil = nullptr;
+ ID3D11DepthStencilView* m_dsv = nullptr;
+ ID3D11ShaderResourceView* m_depthSRV = nullptr;
+ ID3D11DepthStencilState* m_depthState = nullptr;
+ ID3D11BlendState* m_blendState = nullptr;
+
+ ID3D11Texture2D* m_resolvedTarget = nullptr;
+ ID3D11ShaderResourceView* m_resolvedTargetSRV = nullptr;
+
+ AppGraphProfiler* m_profiler = nullptr;
+
+ AppGraphCtx();
+ ~AppGraphCtx();
+};
+
+AppGraphCtx* AppGraphCtxCreate(int deviceID);
+
+void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int);
+
+void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context);
+
+void AppGraphCtxRelease(AppGraphCtx* context);
+
+void AppGraphCtxFrameStart(AppGraphCtx* context, float clearColor[4]);
+
+void AppGraphCtxFramePresent(AppGraphCtx* context, bool fullsync);
+
+void AppGraphCtxResolveFrame(AppGraphCtx* context);
+
+void AppGraphCtxProfileEnable(AppGraphCtx* context, bool enabled);
+
+void AppGraphCtxProfileBegin(AppGraphCtx* context, const char* label);
+
+void AppGraphCtxProfileEnd(AppGraphCtx* context, const char* label);
+
+bool AppGraphCtxProfileGet(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index);
+
+size_t AppGraphCtxDedicatedVideoMemory(AppGraphCtx* context); \ No newline at end of file
diff --git a/demo/d3d11/debugLineRender.h b/demo/d3d11/debugLineRender.h
new file mode 100644
index 0000000..6132935
--- /dev/null
+++ b/demo/d3d11/debugLineRender.h
@@ -0,0 +1,199 @@
+#pragma once
+
+
+#include "shaders/debugLineVS.hlsl.h"
+#include "shaders/debugLinePS.hlsl.h"
+
+
+struct DebugVertex
+{
+ Vec3 position;
+ Vec4 color;
+};
+
+struct DebugLineRender
+{
+
+ void Init(ID3D11Device* d, ID3D11DeviceContext* c)
+ {
+ device = d;
+ context = c;
+
+ // create the rasterizer state
+ {
+ D3D11_RASTERIZER_DESC desc = {};
+ desc.FillMode = D3D11_FILL_SOLID;
+ desc.CullMode = D3D11_CULL_BACK;
+ desc.FrontCounterClockwise = TRUE; // This is non-default
+ desc.DepthBias = 0;
+ desc.DepthBiasClamp = 0.f;
+ desc.SlopeScaledDepthBias = 0.f;
+ desc.DepthClipEnable = TRUE;
+ desc.ScissorEnable = FALSE; // This is non-default
+ desc.MultisampleEnable = TRUE;
+ desc.AntialiasedLineEnable = FALSE;
+
+ device->CreateRasterizerState(&desc, &rasterizerState);
+ }
+
+ {
+ D3D11_DEPTH_STENCIL_DESC depthStateDesc = {};
+ depthStateDesc.DepthEnable = FALSE; // disable depth test
+ depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
+
+ device->CreateDepthStencilState(&depthStateDesc, &depthStencilState);
+ }
+
+ // create the input layout
+ {
+ D3D11_INPUT_ELEMENT_DESC inputElementDescs[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ device->CreateInputLayout(inputElementDescs, 2, g_debugLineVS, sizeof(g_debugLineVS), &inputLayout);
+ }
+
+ // create the blend state
+ {
+ D3D11_BLEND_DESC blendDesc = {};
+
+ blendDesc.AlphaToCoverageEnable = false;
+ blendDesc.IndependentBlendEnable = false;
+ blendDesc.RenderTarget[0].BlendEnable = false;
+ blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
+ blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
+ blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
+ blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
+ blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
+ blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
+ blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
+
+ device->CreateBlendState(&blendDesc, &blendState);
+ }
+
+ // create the shaders
+ device->CreateVertexShader(g_debugLineVS, sizeof(g_debugLineVS), nullptr, &vertexShader);
+ device->CreatePixelShader(g_debugLinePS, sizeof(g_debugLinePS), nullptr, &pixelShader);
+
+ // create a constant buffer
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(Matrix44);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ device->CreateBuffer(&bufDesc, NULL, &constantBuffer);
+ }
+ }
+
+ void Destroy()
+ {
+ COMRelease(depthStencilState);
+ COMRelease(rasterizerState);
+ COMRelease(inputLayout);
+ COMRelease(blendState);
+ COMRelease(vertexShader);
+ COMRelease(pixelShader);
+ COMRelease(constantBuffer);
+ COMRelease(vertexBuffer);
+ }
+
+ void AddLine(const Vec3& p, const Vec3& q, const Vec4& color)
+ {
+ DebugVertex v = { p, color };
+ DebugVertex w = { q, color };
+
+ queued.push_back(v);
+ queued.push_back(w);
+ }
+
+ void FlushLines(const Matrix44& viewProj)
+ {
+ if (queued.empty())
+ return;
+
+ // recreate vertex buffer if not big enough for queued lines
+ if (vertexBufferSize < int(queued.size()))
+ {
+ if (vertexBuffer)
+ vertexBuffer->Release();
+
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc.ByteWidth = UINT(sizeof(DebugVertex)*queued.size());
+ bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
+
+ device->CreateBuffer(&bufferDesc, 0, &vertexBuffer);
+
+ vertexBufferSize = int(queued.size());
+ }
+
+ // update vertex buffer
+ D3D11_MAPPED_SUBRESOURCE res;
+ context->Map(vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, &queued[0], sizeof(DebugVertex)*queued.size());
+ context->Unmap(vertexBuffer, 0);
+
+ // update constant buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == context->Map(constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ memcpy(mappedResource.pData, &viewProj, sizeof(viewProj));
+
+ context->Unmap(constantBuffer, 0u);
+ }
+ }
+
+ // configure for line renderering
+ context->VSSetShader(vertexShader, nullptr, 0u);
+ context->GSSetShader(nullptr, nullptr, 0u);
+ context->PSSetShader(pixelShader, nullptr, 0u);
+
+ context->IASetInputLayout(inputLayout);
+ context->OMSetBlendState(blendState, nullptr, 0xFFFFFFFF);
+
+ context->VSSetConstantBuffers(0, 1, &constantBuffer);
+
+ context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
+
+ context->RSSetState(rasterizerState);
+
+ UINT vertexStride = sizeof(DebugVertex);
+ UINT offset = 0u;
+ context->IASetVertexBuffers(0, 1, &vertexBuffer, &vertexStride, &offset);
+
+
+ // kick
+ context->Draw(UINT(queued.size()), 0);
+
+ // empty queue
+ queued.resize(0);
+
+ }
+
+
+ std::vector<DebugVertex> queued;
+
+ ID3D11Buffer* vertexBuffer = nullptr;
+ int vertexBufferSize = 0;
+
+ ID3D11DepthStencilState* depthStencilState = nullptr;
+ ID3D11RasterizerState* rasterizerState = nullptr;
+ ID3D11InputLayout* inputLayout = nullptr;
+ ID3D11BlendState* blendState = nullptr;
+ ID3D11VertexShader* vertexShader = nullptr;
+ ID3D11PixelShader* pixelShader = nullptr;
+ ID3D11Buffer* constantBuffer = nullptr;
+
+ ID3D11Device* device = nullptr;
+ ID3D11DeviceContext* context = nullptr;
+
+}; \ No newline at end of file
diff --git a/demo/d3d11/diffuseRender.cpp b/demo/d3d11/diffuseRender.cpp
new file mode 100644
index 0000000..60ced59
--- /dev/null
+++ b/demo/d3d11/diffuseRender.cpp
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+//direct3d headers
+
+#define NOMINMAX
+
+#include <d3d11.h>
+
+// include the Direct3D Library file
+#pragma comment (lib, "d3d11.lib")
+
+#include <math.h>
+
+#include "appD3D11Ctx.h"
+
+#include "diffuseRender.h"
+
+#include "shaders/diffuseVS.hlsl.h"
+#include "shaders/diffuseGS.hlsl.h"
+#include "shaders/diffusePS.hlsl.h"
+
+#define EXCLUDE_SHADER_STRUCTS 1
+#include "shaders/shaderCommon.h"
+
+
+void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context)
+{
+ m_device = device;
+ m_deviceContext = context;
+
+ // create the input layout
+ {
+ D3D11_INPUT_ELEMENT_DESC inputElementDescs[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "VELOCITY", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ m_device->CreateInputLayout(inputElementDescs, 2, g_diffuseVS, sizeof(g_diffuseVS), &m_inputLayout);
+ }
+
+ // create the shaders
+ m_device->CreateVertexShader(g_diffuseVS, sizeof(g_diffuseVS), nullptr, &m_diffuseVS);
+ m_device->CreateGeometryShader(g_diffuseGS, sizeof(g_diffuseGS), nullptr, &m_diffuseGS);
+ m_device->CreatePixelShader(g_diffusePS, sizeof(g_diffusePS), nullptr, &m_diffusePS);
+
+ {
+ D3D11_BLEND_DESC blendDesc = {};
+ blendDesc.AlphaToCoverageEnable = false;
+ blendDesc.IndependentBlendEnable = false;
+ blendDesc.RenderTarget[0].BlendEnable = true;
+ blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
+ blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
+ blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
+ blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
+ blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
+ blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
+ blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
+
+ m_device->CreateBlendState(&blendDesc, &m_blendState);
+ }
+
+ {
+ D3D11_DEPTH_STENCIL_DESC depthStateDesc = {};
+ depthStateDesc.DepthEnable = TRUE;
+ depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
+ depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
+
+ device->CreateDepthStencilState(&depthStateDesc, &m_depthStencilState);
+ }
+
+ // create a constant buffer
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(DiffuseShaderConst); // 64 * sizeof(float);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer);
+ }
+
+ // create the rastersizer state
+ {
+ D3D11_RASTERIZER_DESC desc = {};
+ desc.FillMode = D3D11_FILL_SOLID;
+ desc.CullMode = D3D11_CULL_NONE;
+ desc.FrontCounterClockwise = TRUE; // This is non-default
+ desc.DepthBias = 0;
+ desc.DepthBiasClamp = 0.f;
+ desc.SlopeScaledDepthBias = 0.f;
+ desc.DepthClipEnable = TRUE;
+ desc.ScissorEnable = FALSE;
+ desc.MultisampleEnable = FALSE;
+ desc.AntialiasedLineEnable = FALSE;
+
+ m_device->CreateRasterizerState(&desc, &m_rasterizerState);
+ }
+}
+
+void DiffuseRenderer::Destroy()
+{
+ COMRelease(m_inputLayout);
+ COMRelease(m_diffuseVS);
+ COMRelease(m_diffuseGS);
+ COMRelease(m_diffusePS);
+ COMRelease(m_constantBuffer);
+ COMRelease(m_rasterizerState);
+ COMRelease(m_blendState);
+ COMRelease(m_depthStencilState);
+}
+
+
+
+void DiffuseRenderer::Draw(const DiffuseDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, ID3D11Buffer* indices, int numParticles)
+{
+ using namespace DirectX;
+
+ ID3D11DeviceContext* deviceContext = m_deviceContext;
+
+ // update constant buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = { 0 };
+ if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ DiffuseShaderConst cParams;
+
+ cParams.modelViewProjection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection));
+ cParams.modelView = (float4x4&)XMMatrixMultiply(params->model, params->view);
+ cParams.projection = (float4x4&)params->projection;
+
+ cParams.motionBlurScale = params->motionScale;
+ cParams.diffuseRadius = params->diffuseRadius;
+ cParams.diffuseScale = params->diffuseScale;
+ cParams.spotMin = params->spotMin;
+ cParams.spotMax = params->spotMax;
+
+ cParams.lightTransform = (float4x4&)params->lightTransform;
+ cParams.lightPos = params->lightPos;
+ cParams.lightDir = params->lightDir;
+ cParams.color = params->color;
+
+
+ memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps));
+
+ memcpy(mappedResource.pData, &cParams, sizeof(DiffuseShaderConst));
+
+ deviceContext->Unmap(m_constantBuffer, 0u);
+ }
+ }
+
+ deviceContext->VSSetShader(m_diffuseVS, nullptr, 0u);
+ deviceContext->GSSetShader(m_diffuseGS, nullptr, 0u);
+ deviceContext->PSSetShader(m_diffusePS, nullptr, 0u);
+
+ if (params->shadowMap)
+ {
+ ShadowMap* shadowMap = (ShadowMap*)params->shadowMap;
+
+ ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() };
+ deviceContext->PSSetShaderResources(0, 1, ppSRV);
+ ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() };
+ deviceContext->PSSetSamplers(0, 1, ppSS);
+ }
+
+ deviceContext->IASetInputLayout(m_inputLayout);
+ deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
+
+ deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer);
+
+ ID3D11Buffer* vertexBuffers[2] =
+ {
+ positions,
+ velocities
+ };
+
+ unsigned int vertexBufferStrides[2] =
+ {
+ sizeof(float4),
+ sizeof(float4),
+ };
+
+ unsigned int vertexBufferOffsets[2] = { 0 };
+
+ deviceContext->IASetVertexBuffers(0, 2, vertexBuffers, vertexBufferStrides, vertexBufferOffsets);
+ deviceContext->IASetIndexBuffer(indices, DXGI_FORMAT_R32_UINT, 0u);
+
+ deviceContext->OMSetBlendState(m_blendState, nullptr, 0xFFFFFFFF);
+ deviceContext->OMSetDepthStencilState(m_depthStencilState, 0u);
+
+ float depthSign = DirectX::XMVectorGetW(params->projection.r[2]);
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(m_rasterizerState);
+ }
+
+ deviceContext->DrawIndexed(numParticles, 0, 0);
+
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(nullptr);
+ }
+
+ deviceContext->OMSetDepthStencilState(nullptr, 0u);
+ deviceContext->OMSetBlendState(nullptr, nullptr, 0xFFFFFFFF);
+}
diff --git a/demo/d3d11/diffuseRender.h b/demo/d3d11/diffuseRender.h
new file mode 100644
index 0000000..69517b2
--- /dev/null
+++ b/demo/d3d11/diffuseRender.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <DirectXMath.h>
+
+#include "shadowMap.h"
+
+
+typedef DirectX::XMFLOAT3 float3;
+typedef DirectX::XMFLOAT4 float4;
+typedef DirectX::XMFLOAT4X4 float4x4;
+
+struct DiffuseDrawParams
+{
+ DirectX::XMMATRIX projection;
+ DirectX::XMMATRIX view;
+ DirectX::XMMATRIX model;
+
+ float diffuseRadius; // point size in world space
+ float diffuseScale; // scale to calculate size in pixels
+ float spotMin;
+ float spotMax;
+ float motionScale;
+
+ DirectX::XMMATRIX lightTransform;
+ float3 lightPos;
+ float3 lightDir;
+
+ float4 color;
+
+ float4 shadowTaps[12];
+ ShadowMap* shadowMap;
+
+ int mode;
+};
+
+
+struct DiffuseRenderer
+{
+ ID3D11Device* m_device = nullptr;
+ ID3D11DeviceContext* m_deviceContext = nullptr;
+
+ ID3D11InputLayout* m_inputLayout = nullptr;
+
+ ID3D11VertexShader* m_diffuseVS = nullptr;
+ ID3D11GeometryShader* m_diffuseGS = nullptr;
+ ID3D11PixelShader* m_diffusePS = nullptr;
+
+ ID3D11Buffer* m_constantBuffer = nullptr;
+ ID3D11RasterizerState* m_rasterizerState = nullptr;
+
+ ID3D11BlendState* m_blendState = nullptr;
+ ID3D11DepthStencilState* m_depthStencilState = nullptr;
+
+ void Init(ID3D11Device* device, ID3D11DeviceContext* deviceContext);
+ void Destroy();
+
+
+ void Draw(const DiffuseDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, ID3D11Buffer* indices, int numParticles);
+};
diff --git a/demo/d3d11/fluidRender.cpp b/demo/d3d11/fluidRender.cpp
new file mode 100644
index 0000000..f9dd767
--- /dev/null
+++ b/demo/d3d11/fluidRender.cpp
@@ -0,0 +1,458 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+//direct3d headers
+
+#define NOMINMAX
+
+#include <d3d11.h>
+
+// include the Direct3D Library file
+#pragma comment (lib, "d3d11.lib")
+
+#include <math.h>
+
+#include "appD3D11Ctx.h"
+
+#include "fluidRender.h"
+
+#include "shaders/ellipsoidDepthVS.hlsl.h"
+#include "shaders/ellipsoidDepthGS.hlsl.h"
+#include "shaders/ellipsoidDepthPS.hlsl.h"
+#include "shaders/passThroughVS.hlsl.h"
+#include "shaders/blurDepthPS.hlsl.h"
+#include "shaders/compositePS.hlsl.h"
+
+#define EXCLUDE_SHADER_STRUCTS 1
+#include "shaders/shaderCommon.h"
+
+#include "renderTarget.h"
+#include "shadowMap.h"
+
+#include "shaders.h"
+
+typedef DirectX::XMFLOAT2 float2;
+
+using namespace DirectX;
+
+
+struct PassthroughVertex
+{
+ float x, y;
+ float u, v;
+};
+
+void FluidRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height)
+{
+ mSceneWidth = width;
+ mSceneHeight = height;
+
+ mDepthTex.Init(device, width, height);
+ mDepthSmoothTex.Init(device, width, height, false);
+
+ m_device = device;
+ m_deviceContext = context;
+
+ // create the input layout
+ {
+ D3D11_INPUT_ELEMENT_DESC inputElementDescs[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "U", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "V", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "W", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ m_device->CreateInputLayout(inputElementDescs, 4, g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), &m_ellipsoidDepthLayout);
+ }
+
+ // create the shaders
+ m_device->CreateVertexShader(g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), nullptr, &m_ellipsoidDepthVS);
+ m_device->CreateGeometryShader(g_ellipsoidDepthGS, sizeof(g_ellipsoidDepthGS), nullptr, &m_ellipsoidDepthGS);
+ m_device->CreatePixelShader(g_ellipsoidDepthPS, sizeof(g_ellipsoidDepthPS), nullptr, &m_ellipsoidDepthPS);
+
+ // create the input layout
+ {
+ D3D11_INPUT_ELEMENT_DESC inputElementDescs[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ m_device->CreateInputLayout(inputElementDescs, 2, g_passThroughVS, sizeof(g_passThroughVS), &m_passThroughLayout);
+ }
+
+ // pass through shader
+ m_device->CreateVertexShader(g_passThroughVS, sizeof(g_passThroughVS), nullptr, &m_passThroughVS);
+
+ // full screen pixel shaders
+ m_device->CreatePixelShader(g_blurDepthPS, sizeof(g_blurDepthPS), nullptr, &m_blurDepthPS);
+ m_device->CreatePixelShader(g_compositePS, sizeof(g_compositePS), nullptr, &m_compositePS);
+
+ // create a constant buffer
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(FluidShaderConst); // 64 * sizeof(float);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer);
+ }
+
+ // create the rastersizer state
+ for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++)
+ {
+ for (int j = 0; j < NUM_FLUID_CULL_MODES; j++)
+
+ {
+ D3D11_RASTERIZER_DESC desc = {};
+ desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i);
+ desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j);
+ desc.FrontCounterClockwise = TRUE; // This is non-default
+ desc.DepthBias = 0;
+ desc.DepthBiasClamp = 0.f;
+ desc.SlopeScaledDepthBias = 0.f;
+ desc.DepthClipEnable = TRUE;
+ desc.ScissorEnable = FALSE;
+ desc.MultisampleEnable = FALSE;
+ desc.AntialiasedLineEnable = FALSE;
+
+ m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]);
+ }
+ }
+
+ CreateScreenQuad();
+}
+
+void FluidRenderer::Destroy()
+{
+ COMRelease(m_ellipsoidDepthLayout);
+ COMRelease(m_ellipsoidDepthVS);
+ COMRelease(m_ellipsoidDepthGS);
+ COMRelease(m_ellipsoidDepthPS);
+
+ COMRelease(m_passThroughLayout);
+ COMRelease(m_passThroughVS);
+
+ COMRelease(m_blurDepthPS);
+ COMRelease(m_compositePS);
+
+ COMRelease(m_constantBuffer);
+
+ for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++)
+ for (int j = 0; j < NUM_FLUID_CULL_MODES; j++)
+ COMRelease(m_rasterizerStateRH[i][j]);
+
+ COMRelease(m_quadVertexBuffer);
+ COMRelease(m_quadIndexBuffer);
+}
+
+void FluidRenderer::CreateScreenQuad()
+{
+ // create an index buffer
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = 4*sizeof(UINT);
+ bufDesc.Usage = D3D11_USAGE_IMMUTABLE;
+ bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE;
+ bufDesc.MiscFlags = 0;
+
+ unsigned int quad_indices[4] = { 0, 1, 3, 2 };
+
+ D3D11_SUBRESOURCE_DATA data = { 0 };
+ data.pSysMem = quad_indices;
+
+ m_device->CreateBuffer(&bufDesc, &data, &m_quadIndexBuffer);
+ }
+
+ // create a vertex buffer
+ {
+
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = 4*sizeof(PassthroughVertex);
+ bufDesc.Usage = D3D11_USAGE_IMMUTABLE;
+ bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE;
+ bufDesc.MiscFlags = 0;
+
+ D3D11_SUBRESOURCE_DATA data = { 0 };
+
+
+ float4 vertices[4] =
+ {
+ float4(-1.0f, -1.0f, 0.0f, 0.0f),
+ float4(1.0f, -1.0f, 1.0f, 0.0f),
+ float4(1.0f, 1.0f, 1.0f, 1.0f),
+ float4(-1.0f, 1.0f, 0.0f, 1.0f),
+ };
+
+ data.pSysMem = vertices;
+
+ m_device->CreateBuffer(&bufDesc, &data, &m_quadVertexBuffer);
+ }
+}
+
+void FluidRenderer::DrawEllipsoids(const FluidDrawParams* params, const FluidRenderBuffers* buffers)
+{
+ ID3D11DeviceContext* deviceContext = m_deviceContext;
+
+ // update constant buffer
+ {
+
+ D3D11_BUFFER_DESC desc;
+ m_constantBuffer->GetDesc(&desc);
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ FluidShaderConst cParams;
+
+ cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection));
+ cParams.projection = (float4x4&)params->projection;
+ cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view));
+ cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection);
+
+ //cParams.invTexScale = invTexScale;
+ //cParams.invProjection = invProjection;
+ cParams.invViewport = params->invViewport;
+
+
+ cParams.blurRadiusWorld = params->blurRadiusWorld;
+ cParams.blurScale = params->blurScale;
+ cParams.blurFalloff = params->blurFalloff;
+ cParams.debug = params->debug;
+
+ memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst));
+
+ deviceContext->Unmap(m_constantBuffer, 0u);
+ }
+ }
+
+ deviceContext->VSSetShader(m_ellipsoidDepthVS, nullptr, 0u);
+ deviceContext->GSSetShader(m_ellipsoidDepthGS, nullptr, 0u);
+ deviceContext->PSSetShader(m_ellipsoidDepthPS, nullptr, 0u);
+
+ deviceContext->IASetInputLayout(m_ellipsoidDepthLayout);
+ deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
+
+ deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer);
+
+ ID3D11Buffer* vertexBuffers[4] =
+ {
+ buffers->mPositionVBO,
+ buffers->mAnisotropyVBO[0],
+ buffers->mAnisotropyVBO[1],
+ buffers->mAnisotropyVBO[2]
+ };
+
+ unsigned int vertexBufferStrides[4] =
+ {
+ sizeof(float4),
+ sizeof(float4),
+ sizeof(float4),
+ sizeof(float4)
+ };
+
+ unsigned int vertexBufferOffsets[4] = { 0 };
+
+ deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets);
+ deviceContext->IASetIndexBuffer(buffers->mIndices, DXGI_FORMAT_R32_UINT, 0u);
+
+ float depthSign = DirectX::XMVectorGetW(params->projection.r[2]);
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]);
+ }
+
+ deviceContext->DrawIndexed(params->n, params->offset, 0);
+
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(nullptr);
+ }
+}
+
+void FluidRenderer::DrawBlurDepth(const FluidDrawParams* params)
+{
+ ID3D11DeviceContext* deviceContext = m_deviceContext;
+
+ // update constant buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ FluidShaderConst cParams;
+
+ cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection));
+ cParams.projection = (float4x4&)params->projection;
+ cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view));
+ cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection);
+
+ //cParams.invTexScale = params->invTexScale;
+ //cParams.invViewport = params->invViewport;
+ //cParams.invProjection = params->invProjection;
+
+ cParams.blurRadiusWorld = params->blurRadiusWorld;
+ cParams.blurScale = params->blurScale;
+ cParams.blurFalloff = params->blurFalloff;
+ cParams.debug = params->debug;
+
+ memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst));
+
+ deviceContext->Unmap(m_constantBuffer, 0u);
+ }
+ }
+
+ deviceContext->VSSetShader(m_passThroughVS, nullptr, 0u);
+ deviceContext->GSSetShader(nullptr, nullptr, 0u);
+ deviceContext->PSSetShader(m_blurDepthPS, nullptr, 0u);
+
+ ID3D11ShaderResourceView* ppSRV[1] = { mDepthTex.m_backSrv.Get() };
+ deviceContext->PSSetShaderResources(0, 1, ppSRV);
+
+ deviceContext->IASetInputLayout(m_passThroughLayout);
+ deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+
+ deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer);
+
+ UINT vertexStride = sizeof(PassthroughVertex);
+ UINT offset = 0u;
+ deviceContext->IASetVertexBuffers(0, 1, &m_quadVertexBuffer, &vertexStride, &offset);
+ deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R32_UINT, 0u);
+
+ float depthSign = DirectX::XMVectorGetW(params->projection.r[2]);
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]);
+ }
+
+ deviceContext->DrawIndexed((UINT)4, 0, 0);
+
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(nullptr);
+ }
+}
+
+void FluidRenderer::DrawComposite(const FluidDrawParams* params, ID3D11ShaderResourceView* sceneMap)
+{
+ ID3D11DeviceContext* deviceContext = m_deviceContext;
+
+ // update constant buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ FluidShaderConst cParams;
+
+ cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection));
+ cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view);
+ cParams.projection = (float4x4&)params->projection;
+ cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view));
+ cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection);
+
+ cParams.lightTransform = (float4x4&)params->lightTransform;
+
+ cParams.invTexScale = params->invTexScale;
+
+ //cParams.invViewport = params->invViewport;
+ //cParams.invProjection = params->invProjection;
+
+ cParams.blurRadiusWorld = params->blurRadiusWorld;
+ cParams.blurScale = params->blurScale;
+ cParams.blurFalloff = params->blurFalloff;
+ cParams.debug = params->debug;
+
+ cParams.clipPosToEye = params->clipPosToEye;
+ cParams.color = params->color;
+ cParams.ior = params->ior;
+ cParams.spotMin = params->spotMin;
+ cParams.spotMax = params->spotMax;
+
+ cParams.lightPos = params->lightPos;
+ cParams.lightDir = params->lightDir;
+
+ memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst));
+
+ deviceContext->Unmap(m_constantBuffer, 0u);
+
+ const float2 taps[] =
+ {
+ float2(-0.326212f,-0.40581f), float2(-0.840144f,-0.07358f),
+ float2(-0.695914f,0.457137f), float2(-0.203345f,0.620716f),
+ float2(0.96234f,-0.194983f), float2(0.473434f,-0.480026f),
+ float2(0.519456f,0.767022f), float2(0.185461f,-0.893124f),
+ float2(0.507431f,0.064425f), float2(0.89642f,0.412458f),
+ float2(-0.32194f,-0.932615f), float2(-0.791559f,-0.59771f)
+ };
+ memcpy(cParams.shadowTaps, taps, sizeof(taps));
+ }
+ }
+
+ deviceContext->VSSetShader(m_passThroughVS, nullptr, 0u);
+ deviceContext->GSSetShader(nullptr, nullptr, 0u);
+ deviceContext->PSSetShader(m_compositePS, nullptr, 0u);
+
+
+ RenderTarget* depthMap = &mDepthSmoothTex;
+ ShadowMap* shadowMap = (ShadowMap*)params->shadowMap;
+
+ ID3D11ShaderResourceView* ppSRV[3] =
+ {
+ depthMap->m_backSrv.Get(),
+ sceneMap,
+ shadowMap->m_depthSrv.Get()
+
+ };
+ deviceContext->PSSetShaderResources(0, 3, ppSRV);
+
+ ID3D11SamplerState* ppSS[2] =
+ {
+ depthMap->m_linearSampler.Get() ,
+ shadowMap->m_linearSampler.Get()
+ };
+ deviceContext->PSSetSamplers(0, 2, ppSS);
+
+
+ deviceContext->IASetInputLayout(m_passThroughLayout);
+ deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+
+ deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer);
+
+ UINT vertexStride = sizeof(PassthroughVertex);
+ UINT offset = 0u;
+ deviceContext->IASetVertexBuffers(0, 1, &m_quadVertexBuffer, &vertexStride, &offset);
+ deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R32_UINT, 0u);
+
+ float depthSign = DirectX::XMVectorGetW(params->projection.r[2]);
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]);
+ }
+
+ deviceContext->DrawIndexed((UINT)4, 0, 0);
+
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(nullptr);
+ }
+
+ // reset srvs
+ ID3D11ShaderResourceView* zero[3] = { NULL, NULL, NULL };
+ deviceContext->PSSetShaderResources(0, 3, zero);
+}
+
diff --git a/demo/d3d11/fluidRender.h b/demo/d3d11/fluidRender.h
new file mode 100644
index 0000000..43fee4b
--- /dev/null
+++ b/demo/d3d11/fluidRender.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <DirectXMath.h>
+
+#include <d3d11.h>
+
+#include "renderTarget.h"
+#include "shadowMap.h"
+
+struct FluidRenderBuffers;
+
+enum FluidRenderMode
+{
+ FLUID_RENDER_WIREFRAME,
+ FLUID_RENDER_SOLID,
+ NUM_FLUID_RENDER_MODES
+};
+
+enum FluidCullMode
+{
+ FLUID_CULL_NONE,
+ FLUID_CULL_FRONT,
+ FLUID_CULL_BACK,
+ NUM_FLUID_CULL_MODES
+};
+
+enum FluidDrawStage
+{
+ FLUID_DRAW_NULL,
+ FLUID_DRAW_SHADOW,
+ FLUID_DRAW_REFLECTION,
+ FLUID_DRAW_LIGHT
+};
+
+typedef DirectX::XMFLOAT3 float3;
+typedef DirectX::XMFLOAT4 float4;
+typedef DirectX::XMFLOAT4X4 float4x4;
+
+struct FluidDrawParams
+{
+ FluidRenderMode renderMode;
+ FluidCullMode cullMode;
+ FluidDrawStage renderStage;
+
+ int offset;
+ int n;
+
+ DirectX::XMMATRIX projection;
+ DirectX::XMMATRIX view;
+ DirectX::XMMATRIX model;
+
+ float4 invTexScale;
+
+ float3 invViewport;
+ float3 invProjection;
+
+ float blurRadiusWorld;
+ float blurScale;
+ float blurFalloff;
+ int debug;
+
+ float3 lightPos;
+ float3 lightDir;
+ DirectX::XMMATRIX lightTransform;
+
+ float4 color;
+ float4 clipPosToEye;
+
+ float spotMin;
+ float spotMax;
+ float ior;
+
+ ShadowMap* shadowMap;
+};
+
+
+struct FluidRenderer
+{
+ ID3D11Device* m_device = nullptr;
+ ID3D11DeviceContext* m_deviceContext = nullptr;
+
+ ID3D11InputLayout* m_ellipsoidDepthLayout = nullptr;
+ ID3D11VertexShader* m_ellipsoidDepthVS = nullptr;
+ ID3D11GeometryShader* m_ellipsoidDepthGS = nullptr;
+ ID3D11PixelShader* m_ellipsoidDepthPS = nullptr;
+
+ ID3D11InputLayout* m_passThroughLayout = nullptr;
+ ID3D11VertexShader* m_passThroughVS = nullptr;
+
+ ID3D11PixelShader* m_blurDepthPS = nullptr;
+ ID3D11PixelShader* m_compositePS = nullptr;
+
+ ID3D11Buffer* m_constantBuffer = nullptr;
+ ID3D11RasterizerState* m_rasterizerStateRH[NUM_FLUID_RENDER_MODES][NUM_FLUID_CULL_MODES];
+
+ ID3D11Buffer* m_quadVertexBuffer;
+ ID3D11Buffer* m_quadIndexBuffer;
+
+ RenderTarget mDepthTex;
+ RenderTarget mDepthSmoothTex;
+ RenderTarget mThicknessTex;
+
+ int mSceneWidth;
+ int mSceneHeight;
+
+ void Init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height);
+ void Destroy();
+
+ void DrawEllipsoids(const FluidDrawParams* params, const FluidRenderBuffers* buffers);
+ void DrawBlurDepth(const FluidDrawParams* params);
+ void DrawComposite(const FluidDrawParams* params, ID3D11ShaderResourceView* sceneMap);
+
+ void CreateScreenQuad();
+};
+
+
diff --git a/demo/d3d11/imguiGraph.cpp b/demo/d3d11/imguiGraph.cpp
new file mode 100644
index 0000000..011e71b
--- /dev/null
+++ b/demo/d3d11/imguiGraph.cpp
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include "imgui.h"
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include "imguiGraph.h"
+#include "imguiGraphD3D11.h"
+
+// Some math headers don't have PI defined.
+static const float PI = 3.14159265f;
+
+void imguifree(void* ptr, void* userptr);
+void* imguimalloc(size_t size, void* userptr);
+
+#define STBTT_malloc(x,y) imguimalloc(x,y)
+#define STBTT_free(x,y) imguifree(x,y)
+#define STB_TRUETYPE_IMPLEMENTATION
+#include "stb_truetype.h"
+
+void imguifree(void* ptr, void* /*userptr*/)
+{
+ free(ptr);
+}
+
+void* imguimalloc(size_t size, void* /*userptr*/)
+{
+ return malloc(size);
+}
+
+static const unsigned TEMP_COORD_COUNT = 100;
+static float g_tempCoords[TEMP_COORD_COUNT * 2];
+static float g_tempNormals[TEMP_COORD_COUNT * 2];
+
+static const int CIRCLE_VERTS = 8 * 4;
+static float g_circleVerts[CIRCLE_VERTS * 2];
+
+static stbtt_bakedchar g_cdata[96]; // ASCII 32..126 is 95 glyphs
+
+inline unsigned int RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
+{
+ return (r) | (g << 8) | (b << 16) | (a << 24);
+}
+
+static void drawPolygon(const float* coords, unsigned numCoords, float r, unsigned int col)
+{
+ if (numCoords > TEMP_COORD_COUNT) numCoords = TEMP_COORD_COUNT;
+
+ for (unsigned i = 0, j = numCoords - 1; i < numCoords; j = i++)
+ {
+ const float* v0 = &coords[j * 2];
+ const float* v1 = &coords[i * 2];
+ float dx = v1[0] - v0[0];
+ float dy = v1[1] - v0[1];
+ float d = sqrtf(dx*dx + dy*dy);
+ if (d > 0)
+ {
+ d = 1.0f / d;
+ dx *= d;
+ dy *= d;
+ }
+ g_tempNormals[j * 2 + 0] = dy;
+ g_tempNormals[j * 2 + 1] = -dx;
+ }
+
+ for (unsigned i = 0, j = numCoords - 1; i < numCoords; j = i++)
+ {
+ float dlx0 = g_tempNormals[j * 2 + 0];
+ float dly0 = g_tempNormals[j * 2 + 1];
+ float dlx1 = g_tempNormals[i * 2 + 0];
+ float dly1 = g_tempNormals[i * 2 + 1];
+ float dmx = (dlx0 + dlx1) * 0.5f;
+ float dmy = (dly0 + dly1) * 0.5f;
+ float dmr2 = dmx*dmx + dmy*dmy;
+ if (dmr2 > 0.000001f)
+ {
+ float scale = 1.0f / dmr2;
+ if (scale > 10.0f) scale = 10.0f;
+ dmx *= scale;
+ dmy *= scale;
+ }
+ g_tempCoords[i * 2 + 0] = coords[i * 2 + 0] + dmx*r;
+ g_tempCoords[i * 2 + 1] = coords[i * 2 + 1] + dmy*r;
+ }
+
+ unsigned int colTrans = RGBA(col & 0xff, (col >> 8) & 0xff, (col >> 16) & 0xff, 0);
+
+ imguiGraphColor4ubv((uint8_t*)&col);
+
+ for (unsigned i = 0, j = numCoords - 1; i < numCoords; j = i++)
+ {
+ imguiGraphVertex2fv(&coords[i * 2]);
+ imguiGraphVertex2fv(&coords[j * 2]);
+ imguiGraphColor4ubv((uint8_t*)&colTrans);
+ imguiGraphVertex2fv(&g_tempCoords[j * 2]);
+
+ imguiGraphVertex2fv(&g_tempCoords[j * 2]);
+ imguiGraphVertex2fv(&g_tempCoords[i * 2]);
+
+ imguiGraphColor4ubv((uint8_t*)&col);
+ imguiGraphVertex2fv(&coords[i * 2]);
+ }
+
+ imguiGraphColor4ubv((uint8_t*)&col);
+ for (unsigned i = 2; i < numCoords; ++i)
+ {
+ imguiGraphVertex2fv(&coords[0]);
+ imguiGraphVertex2fv(&coords[(i - 1) * 2]);
+ imguiGraphVertex2fv(&coords[i * 2]);
+ }
+}
+
+static void drawRect(float x, float y, float w, float h, float fth, unsigned int col)
+{
+ float verts[4 * 2] =
+ {
+ x + 0.5f, y + 0.5f,
+ x + w - 0.5f, y + 0.5f,
+ x + w - 0.5f, y + h - 0.5f,
+ x + 0.5f, y + h - 0.5f,
+ };
+ drawPolygon(verts, 4, fth, col);
+}
+
+/*
+static void drawEllipse(float x, float y, float w, float h, float fth, unsigned int col)
+{
+float verts[CIRCLE_VERTS*2];
+const float* cverts = g_circleVerts;
+float* v = verts;
+
+for (int i = 0; i < CIRCLE_VERTS; ++i)
+{
+*v++ = x + cverts[i*2]*w;
+*v++ = y + cverts[i*2+1]*h;
+}
+
+drawPolygon(verts, CIRCLE_VERTS, fth, col);
+}
+*/
+
+static void drawRoundedRect(float x, float y, float w, float h, float r, float fth, unsigned int col)
+{
+ const unsigned n = CIRCLE_VERTS / 4;
+ float verts[(n + 1) * 4 * 2];
+ const float* cverts = g_circleVerts;
+ float* v = verts;
+
+ for (unsigned i = 0; i <= n; ++i)
+ {
+ *v++ = x + w - r + cverts[i * 2] * r;
+ *v++ = y + h - r + cverts[i * 2 + 1] * r;
+ }
+
+ for (unsigned i = n; i <= n * 2; ++i)
+ {
+ *v++ = x + r + cverts[i * 2] * r;
+ *v++ = y + h - r + cverts[i * 2 + 1] * r;
+ }
+
+ for (unsigned i = n * 2; i <= n * 3; ++i)
+ {
+ *v++ = x + r + cverts[i * 2] * r;
+ *v++ = y + r + cverts[i * 2 + 1] * r;
+ }
+
+ for (unsigned i = n * 3; i < n * 4; ++i)
+ {
+ *v++ = x + w - r + cverts[i * 2] * r;
+ *v++ = y + r + cverts[i * 2 + 1] * r;
+ }
+ *v++ = x + w - r + cverts[0] * r;
+ *v++ = y + r + cverts[1] * r;
+
+ drawPolygon(verts, (n + 1) * 4, fth, col);
+}
+
+
+static void drawLine(float x0, float y0, float x1, float y1, float r, float fth, unsigned int col)
+{
+ float dx = x1 - x0;
+ float dy = y1 - y0;
+ float d = sqrtf(dx*dx + dy*dy);
+ if (d > 0.0001f)
+ {
+ d = 1.0f / d;
+ dx *= d;
+ dy *= d;
+ }
+ float nx = dy;
+ float ny = -dx;
+ float verts[4 * 2];
+ r -= fth;
+ r *= 0.5f;
+ if (r < 0.01f) r = 0.01f;
+ dx *= r;
+ dy *= r;
+ nx *= r;
+ ny *= r;
+
+ verts[0] = x0 - dx - nx;
+ verts[1] = y0 - dy - ny;
+
+ verts[2] = x0 - dx + nx;
+ verts[3] = y0 - dy + ny;
+
+ verts[4] = x1 + dx + nx;
+ verts[5] = y1 + dy + ny;
+
+ verts[6] = x1 + dx - nx;
+ verts[7] = y1 + dy - ny;
+
+ drawPolygon(verts, 4, fth, col);
+}
+
+
+bool imguiGraphInit(const char* fontpath, const ImguiGraphDesc* desc)
+{
+ imguiGraphContextInit(desc);
+
+ for (int i = 0; i < CIRCLE_VERTS; ++i)
+ {
+ float a = (float)i / (float)CIRCLE_VERTS * PI * 2;
+ g_circleVerts[i * 2 + 0] = cosf(a);
+ g_circleVerts[i * 2 + 1] = sinf(a);
+ }
+
+ // Load font.
+ FILE* fp = fopen(fontpath, "rb");
+ if (!fp) return false;
+ fseek(fp, 0, SEEK_END);
+ int size = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+
+ unsigned char* ttfBuffer = (unsigned char*)malloc(size);
+ if (!ttfBuffer)
+ {
+ fclose(fp);
+ return false;
+ }
+
+ size_t len = fread(ttfBuffer, 1, size, fp);
+ (void)len;
+
+ fclose(fp);
+ fp = 0;
+
+ unsigned char* bmap = (unsigned char*)malloc(512 * 512);
+ if (!bmap)
+ {
+ free(ttfBuffer);
+ return false;
+ }
+
+ stbtt_BakeFontBitmap(ttfBuffer, 0, 15.0f, bmap, 512, 512, 32, 96, g_cdata);
+
+ // can free ttf_buffer at this point
+ imguiGraphFontTextureInit(bmap);
+
+ free(ttfBuffer);
+ free(bmap);
+
+ return true;
+}
+
+void imguiGraphUpdate(const ImguiGraphDesc* desc)
+{
+ imguiGraphContextUpdate(desc);
+}
+
+void imguiGraphDestroy()
+{
+ imguiGraphFontTextureRelease();
+
+ imguiGraphContextDestroy();
+}
+
+static void getBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index,
+ float *xpos, float *ypos, stbtt_aligned_quad *q)
+{
+ stbtt_bakedchar *b = chardata + char_index;
+ int round_x = STBTT_ifloor(*xpos + b->xoff);
+ int round_y = STBTT_ifloor(*ypos - b->yoff);
+
+ q->x0 = (float)round_x;
+ q->y0 = (float)round_y;
+ q->x1 = (float)round_x + b->x1 - b->x0;
+ q->y1 = (float)round_y - b->y1 + b->y0;
+
+ q->s0 = b->x0 / (float)pw;
+ q->t0 = b->y0 / (float)pw;
+ q->s1 = b->x1 / (float)ph;
+ q->t1 = b->y1 / (float)ph;
+
+ *xpos += b->xadvance;
+}
+
+static const float g_tabStops[4] = { 150, 210, 270, 330 };
+
+static float getTextLength(stbtt_bakedchar *chardata, const char* text)
+{
+ float xpos = 0;
+ float len = 0;
+ while (*text)
+ {
+ int c = (unsigned char)*text;
+ if (c == '\t')
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ if (xpos < g_tabStops[i])
+ {
+ xpos = g_tabStops[i];
+ break;
+ }
+ }
+ }
+ else if (c >= 32 && c < 128)
+ {
+ stbtt_bakedchar *b = chardata + c - 32;
+ int round_x = STBTT_ifloor((xpos + b->xoff) + 0.5);
+ len = round_x + b->x1 - b->x0 + 0.5f;
+ xpos += b->xadvance;
+ }
+ ++text;
+ }
+ return len;
+}
+
+static void drawText(float x, float y, const char *text, int align, unsigned int col)
+{
+ if (!text) return;
+
+ if (align == IMGUI_ALIGN_CENTER)
+ x -= getTextLength(g_cdata, text) / 2;
+ else if (align == IMGUI_ALIGN_RIGHT)
+ x -= getTextLength(g_cdata, text);
+
+ imguiGraphColor4ub(col & 0xff, (col >> 8) & 0xff, (col >> 16) & 0xff, (col >> 24) & 0xff);
+
+ imguiGraphFontTextureEnable();
+
+ // assume orthographic projection with units = screen pixels, origin at top left
+ const float ox = x;
+
+ while (*text)
+ {
+ int c = (unsigned char)*text;
+ if (c == '\t')
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ if (x < g_tabStops[i] + ox)
+ {
+ x = g_tabStops[i] + ox;
+ break;
+ }
+ }
+ }
+ else if (c >= 32 && c < 128)
+ {
+ stbtt_aligned_quad q;
+ getBakedQuad(g_cdata, 512, 512, c - 32, &x, &y, &q);
+
+ imguiGraphTexCoord2f(q.s0, q.t0);
+ imguiGraphVertex2f(q.x0, q.y0);
+ imguiGraphTexCoord2f(q.s1, q.t1);
+ imguiGraphVertex2f(q.x1, q.y1);
+ imguiGraphTexCoord2f(q.s1, q.t0);
+ imguiGraphVertex2f(q.x1, q.y0);
+
+ imguiGraphTexCoord2f(q.s0, q.t0);
+ imguiGraphVertex2f(q.x0, q.y0);
+ imguiGraphTexCoord2f(q.s0, q.t1);
+ imguiGraphVertex2f(q.x0, q.y1);
+ imguiGraphTexCoord2f(q.s1, q.t1);
+ imguiGraphVertex2f(q.x1, q.y1);
+ }
+ ++text;
+ }
+
+ imguiGraphFontTextureDisable();
+}
+
+
+void imguiGraphDraw()
+{
+ const imguiGfxCmd* q = imguiGetRenderQueue();
+ int nq = imguiGetRenderQueueSize();
+
+ const float s = 1.0f / 8.0f;
+
+ imguiGraphRecordBegin();
+
+ imguiGraphDisableScissor();
+ for (int i = 0; i < nq; ++i)
+ {
+ const imguiGfxCmd& cmd = q[i];
+ if (cmd.type == IMGUI_GFXCMD_RECT)
+ {
+ if (cmd.rect.r == 0)
+ {
+ drawRect((float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f,
+ (float)cmd.rect.w*s - 1, (float)cmd.rect.h*s - 1,
+ 1.0f, cmd.col);
+ }
+ else
+ {
+ drawRoundedRect((float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f,
+ (float)cmd.rect.w*s - 1, (float)cmd.rect.h*s - 1,
+ (float)cmd.rect.r*s, 1.0f, cmd.col);
+ }
+ }
+ else if (cmd.type == IMGUI_GFXCMD_LINE)
+ {
+ drawLine(cmd.line.x0*s, cmd.line.y0*s, cmd.line.x1*s, cmd.line.y1*s, cmd.line.r*s, 1.0f, cmd.col);
+ }
+ else if (cmd.type == IMGUI_GFXCMD_TRIANGLE)
+ {
+ if (cmd.flags == 1)
+ {
+ const float verts[3 * 2] =
+ {
+ (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f,
+ (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s - 1, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s / 2 - 0.5f,
+ (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1,
+ };
+ drawPolygon(verts, 3, 1.0f, cmd.col);
+ }
+ if (cmd.flags == 2)
+ {
+ const float verts[3 * 2] =
+ {
+ (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1,
+ (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s / 2 - 0.5f, (float)cmd.rect.y*s + 0.5f,
+ (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s - 1, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1,
+ };
+ drawPolygon(verts, 3, 1.0f, cmd.col);
+ }
+ }
+ else if (cmd.type == IMGUI_GFXCMD_TEXT)
+ {
+ drawText(cmd.text.x, cmd.text.y, cmd.text.text, cmd.text.align, cmd.col);
+ }
+ else if (cmd.type == IMGUI_GFXCMD_SCISSOR)
+ {
+ if (cmd.flags)
+ {
+ imguiGraphEnableScissor(cmd.rect.x, cmd.rect.y, cmd.rect.w, cmd.rect.h);
+ }
+ else
+ {
+ imguiGraphDisableScissor();
+ }
+ }
+ }
+ imguiGraphDisableScissor();
+
+ imguiGraphRecordEnd();
+}
+
diff --git a/demo/d3d11/imguiGraph.h b/demo/d3d11/imguiGraph.h
new file mode 100644
index 0000000..e6e5eb4
--- /dev/null
+++ b/demo/d3d11/imguiGraph.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+#define IMGUI_GRAPH_API extern "C" __declspec(dllexport)
+
+struct ImguiGraphDesc;
+
+typedef bool (*imguiGraphInit_t)(const char* fontpath, const ImguiGraphDesc* desc);
+
+typedef void (*imguiGraphUpdate_t)(const ImguiGraphDesc* desc);
+
+bool imguiGraphInit(const char* fontpath, const ImguiGraphDesc* desc);
+
+void imguiGraphUpdate(const ImguiGraphDesc* desc);
+
+void imguiGraphDestroy();
+
+void imguiGraphDraw(); \ No newline at end of file
diff --git a/demo/d3d11/imguiGraphD3D11.cpp b/demo/d3d11/imguiGraphD3D11.cpp
new file mode 100644
index 0000000..89c8c91
--- /dev/null
+++ b/demo/d3d11/imguiGraphD3D11.cpp
@@ -0,0 +1,473 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#include "imguiGraphD3D11.h"
+
+//direct3d headers
+#include <d3d11.h>
+
+#include "shaders/imguiVS.hlsl.h"
+#include "shaders/imguiPS.hlsl.h"
+
+namespace
+{
+ template <class T>
+ void inline COMRelease(T& t)
+ {
+ if (t) t->Release();
+ t = nullptr;
+ }
+}
+
+namespace
+{
+ ID3D11Device* m_device = nullptr;
+ ID3D11DeviceContext* m_deviceContext = nullptr;
+ int m_winW = 0;
+ int m_winH = 0;
+
+ uint32_t m_maxVertices = 0;
+
+ struct Vertex
+ {
+ float x, y;
+ float u, v;
+ uint8_t rgba[4];
+ };
+
+ ID3D11RasterizerState* m_rasterizerState = nullptr;
+ ID3D11SamplerState* m_samplerState = nullptr;
+ ID3D11InputLayout* m_inputLayout = nullptr;
+ ID3D11BlendState* m_blendState = nullptr;
+ ID3D11VertexShader* m_imguiVS = nullptr;
+ ID3D11PixelShader* m_imguiPS = nullptr;
+ ID3D11Buffer* m_constantBuffer = nullptr;
+ ID3D11Buffer* m_vertexBuffer = nullptr;
+ Vertex* m_vertexBufferData = nullptr;
+
+ struct Scissor
+ {
+ int beginIdx;
+ int stopIdx;
+ int x;
+ int y;
+ int width;
+ int height;
+ };
+ Scissor m_stateScissor = {};
+
+ ID3D11Texture2D* m_texture = nullptr;
+ ID3D11ShaderResourceView* m_textureSRV = nullptr;
+
+ Vertex m_stateVert;
+ uint32_t m_stateVertIdx = 0u;
+
+ struct Params
+ {
+ float projection[16];
+
+ float padding[64 - 16];
+ };
+}
+
+void imguiGraphContextDestroy()
+{
+ COMRelease(m_rasterizerState);
+ COMRelease(m_samplerState);
+ COMRelease(m_inputLayout);
+ COMRelease(m_blendState);
+ COMRelease(m_imguiVS);
+ COMRelease(m_imguiPS);
+ COMRelease(m_constantBuffer);
+ COMRelease(m_vertexBuffer);
+}
+
+void imguiGraphContextInit(const ImguiGraphDesc* desc)
+{
+ m_device = desc->device;
+ m_deviceContext = desc->deviceContext;
+ m_winW = desc->winW;
+ m_winH = desc->winH;
+
+ m_maxVertices = desc->maxVertices;
+
+ // create the rastersizer state
+ {
+ D3D11_RASTERIZER_DESC desc = {};
+ desc.FillMode = D3D11_FILL_SOLID;
+ desc.CullMode = D3D11_CULL_BACK;
+ desc.FrontCounterClockwise = TRUE; // This is non-default
+ desc.DepthBias = 0;
+ desc.DepthBiasClamp = 0.f;
+ desc.SlopeScaledDepthBias = 0.f;
+ desc.DepthClipEnable = TRUE;
+ desc.ScissorEnable = TRUE; // This is non-default
+ desc.MultisampleEnable = FALSE;
+ desc.AntialiasedLineEnable = FALSE;
+
+ m_device->CreateRasterizerState(&desc, &m_rasterizerState);
+ }
+
+ // create the sampler state
+ {
+ D3D11_SAMPLER_DESC sampler = {};
+ sampler.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
+ sampler.AddressU = D3D11_TEXTURE_ADDRESS_BORDER;
+ sampler.AddressV = D3D11_TEXTURE_ADDRESS_BORDER;
+ sampler.AddressW = D3D11_TEXTURE_ADDRESS_BORDER;
+ sampler.MipLODBias = 0;
+ sampler.MaxAnisotropy = 0;
+ sampler.ComparisonFunc = D3D11_COMPARISON_NEVER;
+ //sampler.BorderColor = D3D11_BORDER_COLOR_TRANSPARENT_BLACK;
+ sampler.MinLOD = 0.f;
+ sampler.MaxLOD = D3D11_FLOAT32_MAX;
+
+ m_device->CreateSamplerState(&sampler, &m_samplerState);
+ }
+
+ // create the input layout
+ {
+ D3D11_INPUT_ELEMENT_DESC inputElementDescs[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ m_device->CreateInputLayout(inputElementDescs, 3, g_imguiVS, sizeof(g_imguiVS), &m_inputLayout);
+ }
+
+ // create the blend state
+ {
+ D3D11_BLEND_DESC blendDesc = {};
+ blendDesc.AlphaToCoverageEnable = false;
+ blendDesc.IndependentBlendEnable = false;
+ blendDesc.RenderTarget[0].BlendEnable = true;
+ blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
+ blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
+ blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
+ blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
+ blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
+ blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
+ blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
+
+ m_device->CreateBlendState(&blendDesc, &m_blendState);
+ }
+
+ // create the shaders
+ m_device->CreateVertexShader(g_imguiVS, sizeof(g_imguiVS), nullptr, &m_imguiVS);
+ m_device->CreatePixelShader(g_imguiPS, sizeof(g_imguiPS), nullptr, &m_imguiPS);
+
+ // create a constant buffer
+ {
+ Params params = {
+ 1.f, 0.f, 0.f, 0.f,
+ 0.f, 1.f, 0.f, 0.f,
+ 0.f, 0.f, 1.f, 0.f,
+ 0.f, 0.f, 0.f, 1.f
+ };
+
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(params);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ D3D11_SUBRESOURCE_DATA data = {};
+ data.pSysMem = &params;
+
+ m_device->CreateBuffer(&bufDesc, &data, &m_constantBuffer);
+ }
+
+ // create a vertex buffer
+ {
+ UINT bufferSize = (UINT)(m_maxVertices) * sizeof(Vertex);
+
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = bufferSize;
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ m_device->CreateBuffer(&bufDesc, nullptr, &m_vertexBuffer);
+ }
+}
+
+void imguiGraphContextUpdate(const ImguiGraphDesc* desc)
+{
+ m_device = desc->device;
+ m_deviceContext = desc->deviceContext;
+ m_winW = desc->winW;
+ m_winH = desc->winH;
+}
+
+void imguiGraphRecordBegin()
+{
+ Params params = {
+ 2.f / float(m_winW), 0.f, 0.f, -1.f,
+ 0.f, 2.f / float(m_winH), 0.f, -1.f,
+ 0.f, 0.f, 1.f, 0.f,
+ 0.f, 0.f, 0.f, 1.f
+ };
+
+ ID3D11DeviceContext* context = m_deviceContext;
+
+ // update constant buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == context->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ memcpy(mappedResource.pData, &params, sizeof(Params));
+
+ context->Unmap(m_constantBuffer, 0u);
+ }
+ }
+
+ // clear state
+ m_stateVert = Vertex{ 0.f, 0.f, -1.f, -1.f, 0,0,0,0 };
+ m_stateVertIdx = 0u;
+
+ m_stateScissor = Scissor { 0, 0, 0, 0, m_winW, m_winH };
+
+ // configure for triangle renderering
+ context->VSSetShader(m_imguiVS, nullptr, 0u);
+ context->GSSetShader(nullptr, nullptr, 0u);
+ context->PSSetShader(m_imguiPS, nullptr, 0u);
+
+ context->IASetInputLayout(m_inputLayout);
+ context->OMSetBlendState(m_blendState, nullptr, 0xFFFFFFFF);
+ context->PSSetSamplers(0, 1, &m_samplerState);
+
+ context->VSSetConstantBuffers(0, 1, &m_constantBuffer);
+
+ context->PSSetShaderResources(0, 1, &m_textureSRV);
+
+ context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+
+ context->RSSetState(m_rasterizerState);
+
+ // trigger allocation of new vertex buffer as needed
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == context->Map(m_vertexBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ context->Unmap(m_vertexBuffer, 0u);
+ }
+ }
+
+ UINT vertexStride = sizeof(Vertex);
+ UINT offset = 0u;
+ context->IASetVertexBuffers(0, 1, &m_vertexBuffer, &vertexStride, &offset);
+
+ // map allocated vertex buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == context->Map(m_vertexBuffer, 0u, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource))
+ {
+ m_vertexBufferData = (Vertex*)mappedResource.pData;
+ }
+ else
+ {
+ m_vertexBufferData = nullptr;
+ }
+ }
+}
+
+static void imguiGraphFlush()
+{
+ ID3D11DeviceContext* context = m_deviceContext;
+
+ // unmap vertex buffer
+ context->Unmap(m_vertexBuffer, 0u);
+
+ Scissor& p = m_stateScissor;
+ if (p.beginIdx < p.stopIdx)
+ {
+ int winH = m_winH;
+ D3D11_RECT rect;
+ rect.left = p.x;
+ rect.right = p.x + p.width;
+ rect.top = (winH) - (p.y + p.height);
+ rect.bottom = (winH) - (p.y);
+ context->RSSetScissorRects(1, &rect);
+
+ UINT vertexCount = (p.stopIdx - p.beginIdx);
+ UINT startIndex = p.beginIdx;
+ context->DrawInstanced(vertexCount, 1, startIndex, 0);
+ }
+
+ // map allocated vertex buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == context->Map(m_vertexBuffer, 0u, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource))
+ {
+ m_vertexBufferData = (Vertex*)mappedResource.pData;
+ }
+ else
+ {
+ m_vertexBufferData = nullptr;
+ }
+ }
+}
+
+void imguiGraphRecordEnd()
+{
+ ID3D11DeviceContext* context = m_deviceContext;
+
+ context->OMSetBlendState(nullptr,nullptr,0xFFFFFFFF);
+
+ // unmap vertex buffer
+ context->Unmap(m_vertexBuffer, 0u);
+
+ // restore scissor
+ Scissor& p = m_stateScissor;
+ int winH = m_winH;
+ D3D11_RECT rect;
+ rect.left = p.x;
+ rect.right = p.x + p.width;
+ rect.top = (winH) - (p.y + p.height);
+ rect.bottom = (winH) - (p.y);
+ context->RSSetScissorRects(1, &rect);
+
+ context->RSSetState(nullptr);
+}
+
+void imguiGraphEnableScissor(int x, int y, int width, int height)
+{
+ // mark end of last region
+ m_stateScissor.stopIdx = m_stateVertIdx;
+
+ imguiGraphFlush();
+
+ m_stateScissor.beginIdx = m_stateVertIdx;
+ m_stateScissor.stopIdx = m_stateVertIdx;
+ m_stateScissor.x = x;
+ m_stateScissor.y = y;
+ m_stateScissor.width = width;
+ m_stateScissor.height = height;
+}
+
+void imguiGraphDisableScissor()
+{
+ if (m_stateVertIdx == 0) return;
+
+ // mark end of last region
+ m_stateScissor.stopIdx = m_stateVertIdx;
+
+ imguiGraphFlush();
+
+ m_stateScissor.beginIdx = m_stateVertIdx;
+ m_stateScissor.stopIdx = m_stateVertIdx;
+ m_stateScissor.x = 0;
+ m_stateScissor.y = 0;
+ m_stateScissor.width = m_winW;
+ m_stateScissor.height = m_winH;
+}
+
+void imguiGraphVertex2f(float x, float y)
+{
+ float v[2] = { x,y };
+ imguiGraphVertex2fv(v);
+}
+
+void imguiGraphVertex2fv(const float* v)
+{
+ // update state
+ m_stateVert.x = v[0];
+ m_stateVert.y = v[1];
+
+ Vertex* vdata = m_vertexBufferData;
+
+ // push vertex
+ if ((m_stateVertIdx) < m_maxVertices)
+ {
+ vdata[m_stateVertIdx++] = m_stateVert;
+ }
+}
+
+void imguiGraphTexCoord2f(float u, float v)
+{
+ m_stateVert.u = u;
+ m_stateVert.v = v;
+}
+
+void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
+{
+ m_stateVert.rgba[0] = red;
+ m_stateVert.rgba[1] = green;
+ m_stateVert.rgba[2] = blue;
+ m_stateVert.rgba[3] = alpha;
+}
+
+void imguiGraphColor4ubv(const uint8_t* v)
+{
+ m_stateVert.rgba[0] = v[0];
+ m_stateVert.rgba[1] = v[1];
+ m_stateVert.rgba[2] = v[2];
+ m_stateVert.rgba[3] = v[3];
+}
+
+void imguiGraphFontTextureEnable()
+{
+
+}
+
+void imguiGraphFontTextureDisable()
+{
+ m_stateVert.u = -1.f;
+ m_stateVert.v = -1.f;
+}
+
+void imguiGraphFontTextureInit(unsigned char* data)
+{
+ ID3D11DeviceContext* context = m_deviceContext;
+
+ // create texture
+ {
+ UINT width = 512;
+ UINT height = 512;
+
+ D3D11_TEXTURE2D_DESC texDesc = {};
+ texDesc.Width = width;
+ texDesc.Height = height;
+ texDesc.MipLevels = 1;
+ texDesc.ArraySize = 1;
+ texDesc.Format = DXGI_FORMAT_R8_UNORM;
+ texDesc.SampleDesc.Count = 1;
+ texDesc.SampleDesc.Quality = 0u;
+ texDesc.Usage = D3D11_USAGE_IMMUTABLE;
+ texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ texDesc.CPUAccessFlags = 0;
+ texDesc.MiscFlags = 0;
+
+ D3D11_SUBRESOURCE_DATA initData = {};
+ initData.pSysMem = data;
+ initData.SysMemPitch = width;
+
+ if (m_device->CreateTexture2D(&texDesc, &initData, &m_texture))
+ {
+ return;
+ }
+
+ if (m_device->CreateShaderResourceView(m_texture, nullptr, &m_textureSRV))
+ {
+ return;
+ }
+ }
+
+}
+
+void imguiGraphFontTextureRelease()
+{
+ COMRelease(m_texture);
+ COMRelease(m_textureSRV);
+} \ No newline at end of file
diff --git a/demo/d3d11/imguiGraphD3D11.h b/demo/d3d11/imguiGraphD3D11.h
new file mode 100644
index 0000000..be9c88b
--- /dev/null
+++ b/demo/d3d11/imguiGraphD3D11.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#ifndef IMGUI_GRAPH_D3D11_H
+#define IMGUI_GRAPH_D3D11_H
+
+#include <stdint.h>
+
+#include "imguiGraph.h"
+
+struct ID3D11Device;
+struct ID3D11DeviceContext;
+
+struct ImguiGraphDesc
+{
+ ID3D11Device* device = nullptr;
+ ID3D11DeviceContext* deviceContext = nullptr;
+ int winW;
+ int winH;
+
+ uint32_t maxVertices = 64 * 4096u;
+
+ ImguiGraphDesc() {}
+};
+
+// Below are the functions that must be implemented per graphics API
+
+void imguiGraphContextInit(const ImguiGraphDesc* desc);
+
+void imguiGraphContextUpdate(const ImguiGraphDesc* desc);
+
+void imguiGraphContextDestroy();
+
+void imguiGraphRecordBegin();
+
+void imguiGraphRecordEnd();
+
+void imguiGraphVertex2f(float x, float y);
+
+void imguiGraphVertex2fv(const float* v);
+
+void imguiGraphTexCoord2f(float u, float v);
+
+void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
+
+void imguiGraphColor4ubv(const uint8_t* v);
+
+void imguiGraphFontTextureEnable();
+
+void imguiGraphFontTextureDisable();
+
+void imguiGraphEnableScissor(int x, int y, int width, int height);
+
+void imguiGraphDisableScissor();
+
+void imguiGraphFontTextureInit(unsigned char* data);
+
+void imguiGraphFontTextureRelease();
+
+#endif \ No newline at end of file
diff --git a/demo/d3d11/meshRender.cpp b/demo/d3d11/meshRender.cpp
new file mode 100644
index 0000000..b07397b
--- /dev/null
+++ b/demo/d3d11/meshRender.cpp
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+//direct3d headers
+
+#define NOMINMAX
+
+#include <d3d11.h>
+
+// include the Direct3D Library file
+#pragma comment (lib, "d3d11.lib")
+
+#include <math.h>
+
+#include "meshRender.h"
+#include "appD3d11Ctx.h"
+
+
+#include "shaders/meshVS.hlsl.h"
+#include "shaders/meshPS.hlsl.h"
+#include "shaders/meshShadowPS.hlsl.h"
+
+#define EXCLUDE_SHADER_STRUCTS 1
+#include "shaders/shaderCommon.h"
+
+#include "shadowMap.h"
+
+
+void MeshRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context)
+{
+ for (int i = 0; i < NUM_MESH_RENDER_MODES; i++)
+ for (int j = 0; j < NUM_MESH_CULL_MODES; j++)
+ m_rasterizerStateRH[i][j] = nullptr;
+
+ m_device = device;
+ m_deviceContext = context;
+
+ // create the input layout
+ {
+ D3D11_INPUT_ELEMENT_DESC inputElementDescs[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ m_device->CreateInputLayout(inputElementDescs, 4, g_meshVS, sizeof(g_meshVS), &m_inputLayout);
+ }
+
+ // create the shaders
+ m_device->CreateVertexShader(g_meshVS, sizeof(g_meshVS), nullptr, &m_meshVS);
+ m_device->CreatePixelShader(g_meshPS, sizeof(g_meshPS), nullptr, &m_meshPS);
+ m_device->CreatePixelShader(g_meshPS_Shadow, sizeof(g_meshPS_Shadow), nullptr, &m_meshPS_Shadow);
+
+ // create a constant buffer
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(MeshShaderConst);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer);
+ }
+
+ // create the rastersizer state
+ for (int i = 0; i < NUM_MESH_RENDER_MODES; i++)
+ {
+ for (int j = 0; j < NUM_MESH_CULL_MODES; j++)
+
+ {
+ D3D11_RASTERIZER_DESC desc = {};
+ desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i);
+ desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j);
+ desc.FrontCounterClockwise = TRUE; // This is non-default
+ desc.DepthBias = 0;
+ desc.DepthBiasClamp = 0.f;
+ desc.SlopeScaledDepthBias = 0.f;
+ desc.DepthClipEnable = TRUE;
+ desc.ScissorEnable = FALSE;
+ desc.MultisampleEnable = FALSE;
+ desc.AntialiasedLineEnable = FALSE;
+
+ m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]);
+ }
+ }
+
+}
+
+void MeshRenderer::Destroy()
+{
+ COMRelease(m_inputLayout);
+ COMRelease(m_meshVS);
+ COMRelease(m_meshPS);
+ COMRelease(m_meshPS_Shadow);
+ COMRelease(m_constantBuffer);
+
+ for (int i = 0; i < NUM_MESH_RENDER_MODES; i++)
+ for (int j = 0; j < NUM_MESH_CULL_MODES; j++)
+ COMRelease(m_rasterizerStateRH[i][j]);
+}
+
+
+void MeshRenderer::Draw(const GpuMesh* mesh, const MeshDrawParams* params)
+{
+ using namespace DirectX;
+
+ // update constant buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == m_deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ MeshShaderConst cParams;
+
+ cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection));
+
+ cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view);
+
+ cParams.objectTransform = (float4x4&)params->objectTransform;
+ cParams.lightTransform = (float4x4&)params->lightTransform;
+
+ cParams.clipPlane = params->clipPlane;
+ cParams.fogColor = params->fogColor;
+ cParams.color = params->color;
+ cParams.secondaryColor = params->secondaryColor;
+
+ cParams.lightPos = params->lightPos;
+ cParams.lightDir = params->lightDir;
+
+ cParams.bias = params->bias;
+ cParams.expand = params->expand;
+ cParams.spotMin = params->spotMin;
+ cParams.spotMax = params->spotMax;
+
+ cParams.grid = params->grid;
+ cParams.tex = params->tex;
+ cParams.colorArray = params->colorArray;
+
+ memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps));
+
+ memcpy(mappedResource.pData, &cParams, sizeof(MeshShaderConst));
+
+ m_deviceContext->Unmap(m_constantBuffer, 0u);
+ }
+ }
+
+ m_deviceContext->VSSetShader(m_meshVS, nullptr, 0u);
+ m_deviceContext->GSSetShader(nullptr, nullptr, 0u);
+
+ switch (params->renderStage)
+ {
+ case MESH_DRAW_SHADOW:
+ {
+ m_deviceContext->PSSetShader(m_meshPS_Shadow, nullptr, 0u);
+ break;
+ }
+ case MESH_DRAW_LIGHT:
+ {
+ m_deviceContext->PSSetShader(m_meshPS, nullptr, 0u);
+
+ ShadowMap* shadowMap = (ShadowMap*)params->shadowMap;
+ ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() };
+ m_deviceContext->PSSetShaderResources(0, 1, ppSRV);
+ ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() };
+ m_deviceContext->PSSetSamplers(0, 1, ppSS);
+ break;
+ }
+ default:
+ assert(false);
+ break;
+ }
+
+ m_deviceContext->IASetInputLayout(m_inputLayout);
+ m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+
+ m_deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer);
+ m_deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer);
+
+ ID3D11Buffer* vertexBuffers[4] =
+ {
+ mesh->positionBuffer,
+ mesh->normalBuffer,
+ mesh->texcoordBuffer,
+ mesh->colorBuffer,
+ };
+
+ unsigned int vertexBufferStrides[4] =
+ {
+ sizeof(Vec3),
+ sizeof(Vec3),
+ sizeof(Vec2),
+ sizeof(Vec4)
+ };
+
+ unsigned int vertexBufferOffsets[4] = { 0, 0, 0, 0 };
+
+ m_deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets);
+ m_deviceContext->IASetIndexBuffer(mesh->indexBuffer, DXGI_FORMAT_R32_UINT, 0u);
+
+ float depthSign = DirectX::XMVectorGetW(params->projection.r[2]);
+ if (depthSign < 0.f)
+ {
+ m_deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]);
+ }
+
+ m_deviceContext->DrawIndexed((UINT)mesh->mNumFaces*3, 0, 0);
+
+ if (depthSign < 0.f)
+ {
+ m_deviceContext->RSSetState(nullptr);
+ }
+}
diff --git a/demo/d3d11/meshRender.h b/demo/d3d11/meshRender.h
new file mode 100644
index 0000000..01ad181
--- /dev/null
+++ b/demo/d3d11/meshRender.h
@@ -0,0 +1,297 @@
+
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <DirectXMath.h>
+
+#include "appD3D11Ctx.h"
+
+#include "core/maths.h"
+
+struct ShadowMap;
+
+struct GpuMesh
+{
+ ID3D11Buffer* positionBuffer;
+ ID3D11Buffer* normalBuffer;
+ ID3D11Buffer* texcoordBuffer;
+ ID3D11Buffer* colorBuffer;
+
+ ID3D11Buffer* indexBuffer;
+
+ GpuMesh(ID3D11Device* device, ID3D11DeviceContext* deviceContext)
+ : positionBuffer(NULL)
+ , normalBuffer(NULL)
+ , texcoordBuffer(NULL)
+ , colorBuffer(NULL)
+ , indexBuffer(NULL)
+ , mDevice(device)
+ , mDeviceContext(deviceContext)
+ , mNumFaces(0)
+ , mNumVertices(0)
+ {}
+
+ ~GpuMesh()
+ {
+ Release();
+ }
+
+ void Release()
+ {
+ COMRelease(positionBuffer);
+ COMRelease(normalBuffer);
+ COMRelease(texcoordBuffer);
+ COMRelease(colorBuffer);
+ COMRelease(indexBuffer);
+ }
+
+ void Resize(int numVertices, int numFaces)
+ {
+ Release();
+
+ {
+ // vertex buffers
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(Vec3)*numVertices;
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ mDevice->CreateBuffer(&bufDesc, NULL, &positionBuffer);
+ mDevice->CreateBuffer(&bufDesc, NULL, &normalBuffer);
+
+ bufDesc.ByteWidth = sizeof(Vec2)*numVertices;
+ mDevice->CreateBuffer(&bufDesc, NULL, &texcoordBuffer);
+
+ bufDesc.ByteWidth = sizeof(Vec4)*numVertices;
+ mDevice->CreateBuffer(&bufDesc, NULL, &colorBuffer);
+ }
+
+ {
+ // index buffer
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(int)*numFaces*3;
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ mDevice->CreateBuffer(&bufDesc, NULL, &indexBuffer);
+ }
+
+ mMaxVertices = numVertices;
+ mMaxFaces = numFaces;
+ }
+
+ void UpdateData(const Vec3* positions, const Vec3* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces)
+ {
+ if (numVertices > mMaxVertices || numFaces > mMaxFaces)
+ {
+ Resize(numVertices, numFaces);
+ }
+
+ D3D11_MAPPED_SUBRESOURCE res;
+
+ // vertices
+ if (positions)
+ {
+ mDeviceContext->Map(positionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, positions, sizeof(Vec3)*numVertices);
+ mDeviceContext->Unmap(positionBuffer, 0);
+ }
+
+ if (normals)
+ {
+ mDeviceContext->Map(normalBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, normals, sizeof(Vec3)*numVertices);
+ mDeviceContext->Unmap(normalBuffer, 0);
+ }
+
+ if (texcoords)
+ {
+ mDeviceContext->Map(texcoordBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices);
+ mDeviceContext->Unmap(texcoordBuffer, 0);
+ }
+
+ if (colors)
+ {
+ mDeviceContext->Map(colorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, colors, sizeof(Vec4)*numVertices);
+ mDeviceContext->Unmap(colorBuffer, 0);
+ }
+
+ // indices
+ if (indices)
+ {
+ mDeviceContext->Map(indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, indices, sizeof(int)*numFaces*3);
+ mDeviceContext->Unmap(indexBuffer, 0);
+ }
+
+ mNumVertices = numVertices;
+ mNumFaces = numFaces;
+ }
+
+ // duplicate method to handle conversion from vec4 to vec3 positions / normals
+ void UpdateData(const Vec4* positions, const Vec4* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces)
+ {
+ if (numVertices > mMaxVertices || numFaces > mMaxFaces)
+ {
+ Resize(numVertices, numFaces);
+ }
+
+ D3D11_MAPPED_SUBRESOURCE res;
+
+ // vertices
+ if (positions)
+ {
+ mDeviceContext->Map(positionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ for (int i=0; i < numVertices; ++i)
+ ((Vec3*)res.pData)[i] = Vec3(positions[i]);
+ mDeviceContext->Unmap(positionBuffer, 0);
+ }
+
+ if (normals)
+ {
+ mDeviceContext->Map(normalBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ for (int i=0; i < numVertices; ++i)
+ ((Vec3*)res.pData)[i] = Vec3(normals[i]);
+ mDeviceContext->Unmap(normalBuffer, 0);
+ }
+
+ if (texcoords)
+ {
+ mDeviceContext->Map(texcoordBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices);
+ mDeviceContext->Unmap(texcoordBuffer, 0);
+ }
+
+ if (colors)
+ {
+ mDeviceContext->Map(colorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, colors, sizeof(Vec4)*numVertices);
+ mDeviceContext->Unmap(colorBuffer, 0);
+ }
+
+ // indices
+ if (indices)
+ {
+ mDeviceContext->Map(indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, indices, sizeof(int)*numFaces*3);
+ mDeviceContext->Unmap(indexBuffer, 0);
+ }
+
+ mNumVertices = numVertices;
+ mNumFaces = numFaces;
+ }
+
+ int mNumVertices = 0;
+ int mNumFaces = 0;
+
+ int mMaxVertices = 0;
+ int mMaxFaces = 0;
+
+ ID3D11Device* mDevice;
+ ID3D11DeviceContext* mDeviceContext;
+};
+
+
+
+enum MeshRenderMode
+{
+ MESH_RENDER_WIREFRAME,
+ MESH_RENDER_SOLID,
+ NUM_MESH_RENDER_MODES
+};
+
+enum MeshCullMode
+{
+ MESH_CULL_NONE,
+ MESH_CULL_FRONT,
+ MESH_CULL_BACK,
+ NUM_MESH_CULL_MODES
+};
+
+enum MeshDrawStage
+{
+ MESH_DRAW_NULL,
+ MESH_DRAW_SHADOW,
+ MESH_DRAW_REFLECTION,
+ MESH_DRAW_LIGHT
+};
+
+typedef DirectX::XMFLOAT3 float3;
+typedef DirectX::XMFLOAT4 float4;
+typedef DirectX::XMFLOAT4X4 float4x4;
+
+struct MeshDrawParams
+{
+ MeshRenderMode renderMode;
+ MeshCullMode cullMode;
+ MeshDrawStage renderStage;
+
+ DirectX::XMMATRIX projection;
+ DirectX::XMMATRIX view;
+ DirectX::XMMATRIX model;
+
+ float4x4 objectTransform;
+
+ DirectX::XMMATRIX lightTransform;
+ float3 lightPos;
+ float3 lightDir;
+
+ float4 clipPlane;
+ float4 fogColor;
+ float4 color;
+ float4 secondaryColor;
+
+ float bias;
+ float expand;
+ float spotMin;
+ float spotMax;
+
+ int grid;
+ int tex;
+ int colorArray;
+
+ float4 shadowTaps[12];
+ ShadowMap* shadowMap;
+};
+
+struct MeshRenderer
+{
+ ID3D11Device* m_device = nullptr;
+ ID3D11DeviceContext* m_deviceContext = nullptr;
+
+ ID3D11InputLayout* m_inputLayout = nullptr;
+ ID3D11VertexShader* m_meshVS = nullptr;
+ ID3D11PixelShader* m_meshPS = nullptr;
+ ID3D11PixelShader* m_meshPS_Shadow = nullptr;
+ ID3D11Buffer* m_constantBuffer = nullptr;
+ ID3D11RasterizerState* m_rasterizerStateRH[NUM_MESH_RENDER_MODES][NUM_MESH_CULL_MODES];
+
+ ~MeshRenderer()
+ {
+ Destroy();
+ }
+
+ void Init(ID3D11Device* device, ID3D11DeviceContext* context);
+ void Destroy();
+
+ void Draw(const GpuMesh* mesh, const MeshDrawParams* params);
+
+};
+
+
+
diff --git a/demo/d3d11/pointRender.cpp b/demo/d3d11/pointRender.cpp
new file mode 100644
index 0000000..1d3a8b0
--- /dev/null
+++ b/demo/d3d11/pointRender.cpp
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+//direct3d headers
+
+#define NOMINMAX
+
+#include <d3d11.h>
+
+// include the Direct3D Library file
+#pragma comment (lib, "d3d11.lib")
+
+#include <math.h>
+
+#include "appD3D11Ctx.h"
+
+#include "pointRender.h"
+
+#include "shaders/pointVS.hlsl.h"
+#include "shaders/pointGS.hlsl.h"
+#include "shaders/pointPS.hlsl.h"
+
+#define EXCLUDE_SHADER_STRUCTS 1
+#include "shaders/shaderCommon.h"
+
+
+void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context)
+{
+ m_device = device;
+ m_deviceContext = context;
+
+ // create the input layout
+ {
+ D3D11_INPUT_ELEMENT_DESC inputElementDescs[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "DENSITY", 0, DXGI_FORMAT_R32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "PHASE", 0, DXGI_FORMAT_R32_SINT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ };
+
+ m_device->CreateInputLayout(inputElementDescs, 3, g_pointVS, sizeof(g_pointVS), &m_inputLayout);
+ }
+
+ // create the shaders
+ m_device->CreateVertexShader(g_pointVS, sizeof(g_pointVS), nullptr, &m_pointVS);
+ m_device->CreateGeometryShader(g_pointGS, sizeof(g_pointGS), nullptr, &m_pointGS);
+ m_device->CreatePixelShader(g_pointPS, sizeof(g_pointPS), nullptr, &m_pointPS);
+
+ // create a constant buffer
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = sizeof(PointShaderConst); // 64 * sizeof(float);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+
+ m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer);
+ }
+
+ // create the rastersizer state
+ for (int i = 0; i < NUM_POINT_RENDER_MODES; i++)
+ {
+ for (int j = 0; j < NUM_POINT_CULL_MODES; j++)
+
+ {
+ D3D11_RASTERIZER_DESC desc = {};
+ desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i);
+ desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j);
+ desc.FrontCounterClockwise = TRUE; // This is non-default
+ desc.DepthBias = 0;
+ desc.DepthBiasClamp = 0.f;
+ desc.SlopeScaledDepthBias = 0.f;
+ desc.DepthClipEnable = TRUE;
+ desc.ScissorEnable = FALSE;
+ desc.MultisampleEnable = FALSE;
+ desc.AntialiasedLineEnable = FALSE;
+
+ m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]);
+ }
+ }
+}
+
+void PointRenderer::Destroy()
+{
+ COMRelease(m_inputLayout);
+ COMRelease(m_pointVS);
+ COMRelease(m_pointGS);
+ COMRelease(m_pointPS);
+ COMRelease(m_constantBuffer);
+
+ for (int i = 0; i < NUM_POINT_RENDER_MODES; i++)
+ for (int j = 0; j < NUM_POINT_CULL_MODES; j++)
+ COMRelease(m_rasterizerStateRH[i][j]);
+}
+
+
+
+void PointRenderer::Draw(const PointDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset)
+{
+ using namespace DirectX;
+
+ ID3D11DeviceContext* deviceContext = m_deviceContext;
+
+ // update constant buffer
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))
+ {
+ PointShaderConst cParams;
+
+ cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view);
+ cParams.projection = (float4x4&)params->projection;
+
+ cParams.pointRadius = params->pointRadius;
+ cParams.pointScale = params->pointScale;
+ cParams.spotMin = params->spotMin;
+ cParams.spotMax = params->spotMax;
+
+ cParams.lightTransform = (float4x4&)params->lightTransform;
+ cParams.lightPos = params->lightPos;
+ cParams.lightDir = params->lightDir;
+
+ for (int i = 0; i < 8; i++)
+ cParams.colors[i] = params->colors[i];
+
+ memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps));
+
+ cParams.mode = params->mode;
+
+ memcpy(mappedResource.pData, &cParams, sizeof(PointShaderConst));
+
+ deviceContext->Unmap(m_constantBuffer, 0u);
+ }
+ }
+
+ deviceContext->VSSetShader(m_pointVS, nullptr, 0u);
+ deviceContext->GSSetShader(m_pointGS, nullptr, 0u);
+ deviceContext->PSSetShader(m_pointPS, nullptr, 0u);
+
+ if (params->shadowMap)
+ {
+ ShadowMap* shadowMap = (ShadowMap*)params->shadowMap;
+ if (params->renderStage == POINT_DRAW_SHADOW)
+ {
+ ID3D11ShaderResourceView* ppSRV[1] = { nullptr };
+ deviceContext->PSSetShaderResources(0, 1, ppSRV);
+ ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() };
+ deviceContext->PSSetSamplers(0, 1, ppSS);
+ }
+ else
+ {
+ ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() };
+ deviceContext->PSSetShaderResources(0, 1, ppSRV);
+ ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() };
+ deviceContext->PSSetSamplers(0, 1, ppSS);
+ }
+ }
+
+ deviceContext->IASetInputLayout(m_inputLayout);
+ deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
+
+ deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer);
+ deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer);
+
+ ID3D11Buffer* vertexBuffers[3] =
+ {
+ positions,
+ colors, // will be interpreted as density
+ colors, // will be interpreted as phase
+ };
+
+ unsigned int vertexBufferStrides[3] =
+ {
+ sizeof(float4),
+ sizeof(float),
+ sizeof(int)
+ };
+
+ unsigned int vertexBufferOffsets[3] = { 0 };
+
+ deviceContext->IASetVertexBuffers(0, 3, vertexBuffers, vertexBufferStrides, vertexBufferOffsets);
+ deviceContext->IASetIndexBuffer(indices, DXGI_FORMAT_R32_UINT, 0u);
+
+
+ float depthSign = DirectX::XMVectorGetW(params->projection.r[2]);
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]);
+ }
+
+ deviceContext->DrawIndexed(numParticles, offset, 0);
+
+ if (depthSign < 0.f)
+ {
+ deviceContext->RSSetState(nullptr);
+ }
+}
diff --git a/demo/d3d11/pointRender.h b/demo/d3d11/pointRender.h
new file mode 100644
index 0000000..9631287
--- /dev/null
+++ b/demo/d3d11/pointRender.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <DirectXMath.h>
+
+#include "shadowMap.h"
+
+enum PointRenderMode
+{
+ POINT_RENDER_WIREFRAME,
+ POINT_RENDER_SOLID,
+ NUM_POINT_RENDER_MODES
+};
+
+enum PointCullMode
+{
+ POINT_CULL_NONE,
+ POINT_CULL_FRONT,
+ POINT_CULL_BACK,
+ NUM_POINT_CULL_MODES
+};
+
+enum PointDrawStage
+{
+ POINT_DRAW_NULL,
+ POINT_DRAW_SHADOW,
+ POINT_DRAW_REFLECTION,
+ POINT_DRAW_LIGHT
+};
+
+typedef DirectX::XMFLOAT3 float3;
+typedef DirectX::XMFLOAT4 float4;
+typedef DirectX::XMFLOAT4X4 float4x4;
+
+struct PointDrawParams
+{
+ PointRenderMode renderMode;
+ PointCullMode cullMode;
+ PointDrawStage renderStage;
+
+ DirectX::XMMATRIX projection;
+ DirectX::XMMATRIX view;
+ DirectX::XMMATRIX model;
+
+ float pointRadius; // point size in world space
+ float pointScale; // scale to calculate size in pixels
+ float spotMin;
+ float spotMax;
+
+ DirectX::XMMATRIX lightTransform;
+ float3 lightPos;
+ float3 lightDir;
+
+ float4 colors[8];
+
+ float4 shadowTaps[12];
+ ShadowMap* shadowMap;
+
+ int mode;
+};
+
+
+struct PointRenderer
+{
+ ID3D11Device* m_device = nullptr;
+ ID3D11DeviceContext* m_deviceContext = nullptr;
+
+ ID3D11InputLayout* m_inputLayout = nullptr;
+ ID3D11VertexShader* m_pointVS = nullptr;
+ ID3D11GeometryShader* m_pointGS = nullptr;
+ ID3D11PixelShader* m_pointPS = nullptr;
+ ID3D11Buffer* m_constantBuffer = nullptr;
+ ID3D11RasterizerState* m_rasterizerStateRH[NUM_POINT_RENDER_MODES][NUM_POINT_CULL_MODES];
+
+ void Init(ID3D11Device* device, ID3D11DeviceContext* deviceContext);
+ void Destroy();
+
+ void Draw(const PointDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset);
+};
diff --git a/demo/d3d11/renderTarget.cpp b/demo/d3d11/renderTarget.cpp
new file mode 100644
index 0000000..da71e4f
--- /dev/null
+++ b/demo/d3d11/renderTarget.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#include "renderTarget.h"
+
+RenderTarget::RenderTarget()
+{
+}
+
+static D3D11_TEXTURE2D_DESC _getTextureDesc(DXGI_FORMAT format, UINT width, UINT height,
+ UINT bindFlags, UINT sampleCount = 1, D3D11_USAGE usage = D3D11_USAGE_DEFAULT, UINT cpuAccessFlags = 0,
+ UINT miscFlags = 0, UINT arraySize = 1, UINT mipLevels = 1)
+{
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Format = format;
+ desc.Width = width;
+ desc.Height = height;
+
+ desc.ArraySize = arraySize;
+ desc.MiscFlags = miscFlags;
+ desc.MipLevels = mipLevels;
+
+ desc.SampleDesc.Count = sampleCount;
+ desc.SampleDesc.Quality = 0;
+ desc.BindFlags = bindFlags;
+ desc.Usage = usage;
+ desc.CPUAccessFlags = cpuAccessFlags;
+ return desc;
+}
+
+static D3D11_DEPTH_STENCIL_VIEW_DESC _getDsvDesc(DXGI_FORMAT format, D3D11_DSV_DIMENSION viewDimension, UINT flags = 0, UINT mipSlice = 0)
+{
+ D3D11_DEPTH_STENCIL_VIEW_DESC desc;
+ desc.Format = format;
+ desc.ViewDimension = viewDimension;
+ desc.Flags = flags;
+ desc.Texture2D.MipSlice = mipSlice;
+ return desc;
+}
+
+static D3D11_SHADER_RESOURCE_VIEW_DESC _getSrvDesc(DXGI_FORMAT format)
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC desc;
+ desc.Format = format;
+ desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ desc.Texture2D.MostDetailedMip = 0;
+ desc.Texture2D.MipLevels = -1;
+
+ return desc;
+}
+
+HRESULT RenderTarget::Init(ID3D11Device* device, int width, int height, bool depthTest)
+{
+ // set viewport
+ {
+ m_viewport.Width = float(width);
+ m_viewport.Height = float(height);
+ m_viewport.MinDepth = 0;
+ m_viewport.MaxDepth = 1;
+ m_viewport.TopLeftX = 0;
+ m_viewport.TopLeftY = 0;
+ }
+
+ // create shadow render target
+ {
+ D3D11_TEXTURE2D_DESC texDesc = _getTextureDesc(DXGI_FORMAT_R32_FLOAT, UINT(width), UINT(height),
+ D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE);
+
+ NV_RETURN_ON_FAIL(device->CreateTexture2D(&texDesc, NV_NULL, m_backTexture.ReleaseAndGetAddressOf()));
+ NV_RETURN_ON_FAIL(device->CreateShaderResourceView(m_backTexture.Get(), NV_NULL, m_backSrv.ReleaseAndGetAddressOf()));
+ NV_RETURN_ON_FAIL(device->CreateRenderTargetView(m_backTexture.Get(), NV_NULL, m_backRtv.ReleaseAndGetAddressOf()));
+ }
+
+ // create shadow depth stencil
+ {
+ D3D11_TEXTURE2D_DESC texDesc = _getTextureDesc(DXGI_FORMAT_R32_TYPELESS, UINT(width), UINT(height),
+ D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE);
+ NV_RETURN_ON_FAIL(device->CreateTexture2D(&texDesc, NV_NULL, m_depthTexture.ReleaseAndGetAddressOf()));
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc = _getDsvDesc(DXGI_FORMAT_D32_FLOAT, D3D11_DSV_DIMENSION_TEXTURE2D);
+ NV_RETURN_ON_FAIL(device->CreateDepthStencilView(m_depthTexture.Get(), &dsvDesc, m_depthDsv.ReleaseAndGetAddressOf()));
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = _getSrvDesc(DXGI_FORMAT_R32_FLOAT);
+ NV_RETURN_ON_FAIL(device->CreateShaderResourceView(m_depthTexture.Get(), &srvDesc, m_depthSrv.ReleaseAndGetAddressOf()));
+ }
+
+ {
+ D3D11_SAMPLER_DESC samplerDesc =
+ {
+ D3D11_FILTER_MIN_MAG_MIP_LINEAR,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ 0.0, 0, D3D11_COMPARISON_NEVER,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, D3D11_FLOAT32_MAX,
+ };
+ NV_RETURN_ON_FAIL(device->CreateSamplerState(&samplerDesc, m_linearSampler.ReleaseAndGetAddressOf()));
+ }
+ {
+ D3D11_SAMPLER_DESC samplerDesc =
+ {
+ D3D11_FILTER_MIN_MAG_MIP_POINT,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ 0.0, 0, D3D11_COMPARISON_NEVER,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, D3D11_FLOAT32_MAX,
+ };
+ NV_RETURN_ON_FAIL(device->CreateSamplerState(&samplerDesc, m_pointSampler.ReleaseAndGetAddressOf()));
+ }
+
+ {
+ D3D11_DEPTH_STENCIL_DESC depthStateDesc = {};
+ depthStateDesc.DepthEnable = depthTest;
+ depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
+
+ NV_RETURN_ON_FAIL(device->CreateDepthStencilState(&depthStateDesc, m_depthStencilState.ReleaseAndGetAddressOf()));
+ }
+
+ return S_OK;
+}
+
+void RenderTarget::BindAndClear(ID3D11DeviceContext* context)
+{
+ ID3D11RenderTargetView* ppRtv[1] = { m_backRtv.Get() };
+ context->OMSetRenderTargets(1, ppRtv, m_depthDsv.Get());
+ context->OMSetDepthStencilState(m_depthStencilState.Get(), 0u);
+
+ context->RSSetViewports(1, &m_viewport);
+
+ float clearDepth = 0.0f;
+ float clearColor[4] = { clearDepth, clearDepth, clearDepth, clearDepth };
+
+ context->ClearRenderTargetView(m_backRtv.Get(), clearColor);
+ context->ClearDepthStencilView(m_depthDsv.Get(), D3D11_CLEAR_DEPTH, 1.0, 0);
+}
diff --git a/demo/d3d11/renderTarget.h b/demo/d3d11/renderTarget.h
new file mode 100644
index 0000000..ae5ff40
--- /dev/null
+++ b/demo/d3d11/renderTarget.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <d3d11.h>
+#include <DirectXMath.h>
+#include <wrl.h>
+
+using namespace DirectX;
+using namespace Microsoft::WRL;
+
+#define NV_NULL nullptr
+#define NV_RETURN_ON_FAIL(x) { HRESULT _res = (x); if (FAILED(_res)) { return _res; } }
+
+struct RenderTarget
+{
+public:
+
+ RenderTarget();
+
+ HRESULT Init(ID3D11Device* device, int width, int height, bool depthTest = true);
+
+ void BindAndClear(ID3D11DeviceContext* context);
+
+ XMMATRIX m_lightView;
+ XMMATRIX m_lightProjection;
+ XMMATRIX m_lightWorldToTex;
+
+ ComPtr<ID3D11Texture2D> m_backTexture;
+ ComPtr<ID3D11RenderTargetView> m_backRtv;
+ ComPtr<ID3D11ShaderResourceView> m_backSrv;
+
+ ComPtr<ID3D11Texture2D> m_depthTexture;
+ ComPtr<ID3D11DepthStencilView> m_depthDsv;
+ ComPtr<ID3D11ShaderResourceView> m_depthSrv;
+
+ ComPtr<ID3D11SamplerState> m_linearSampler;
+ ComPtr<ID3D11SamplerState> m_pointSampler;
+
+ ComPtr<ID3D11DepthStencilState> m_depthStencilState;
+
+ D3D11_VIEWPORT m_viewport;
+};
diff --git a/demo/d3d11/shaders/blurDepthPS.hlsl b/demo/d3d11/shaders/blurDepthPS.hlsl
new file mode 100644
index 0000000..a2eee0a
--- /dev/null
+++ b/demo/d3d11/shaders/blurDepthPS.hlsl
@@ -0,0 +1,91 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ FluidShaderConst gParams;
+};
+
+Texture2D<float> depthTex : register(t0);
+
+float sqr(float x) { return x*x; }
+
+float4 blurDepthPS(PassthroughVertexOut input) : SV_TARGET
+{
+ float4 gl_FragColor = float4(0.0, 0.0, 0.0, 0.0);
+ float4 gl_FragCoord = input.position;
+
+ // debug: return the center depth sample
+ //float d = depthTex.Load(int3(gl_FragCoord.xy, 0)).x;
+ //return d;
+
+ const float blurRadiusWorld = gParams.blurRadiusWorld;
+ const float blurScale = gParams.blurScale;
+ const float blurFalloff = gParams.blurFalloff;
+
+ // eye-space depth of center sample
+ float depth = depthTex.Load(int3(gl_FragCoord.xy, 0)).x;
+ float thickness = 0.0f; //texture2D(thicknessTex, gl_TexCoord[0].xy).x;
+
+ /*
+ // threshold on thickness to create nice smooth silhouettes
+ if (depth == 0.0)
+ {
+ gl_FragColor.x = 0.0;
+ return gl_FragColor;
+ }
+ */
+
+ float blurDepthFalloff = 5.5;
+ float maxBlurRadius = 5.0;
+
+ //discontinuities between different tap counts are visible. to avoid this we
+ //use fractional contributions between #taps = ceil(radius) and floor(radius)
+ float radius = min(maxBlurRadius, blurScale * (blurRadiusWorld / -depth));
+ float radiusInv = 1.0 / radius;
+ float taps = ceil(radius);
+ float frac = taps - radius;
+
+ float sum = 0.0;
+ float wsum = 0.0;
+ float count = 0.0;
+
+ for (float y = -taps; y <= taps; y += 1.0)
+ {
+ for (float x = -taps; x <= taps; x += 1.0)
+ {
+ float2 offset = float2(x, y);
+
+ //float sample = texture2DRect(depthTex, gl_FragCoord.xy + offset).x;
+ float sample = depthTex.Load(int3(gl_FragCoord.xy + offset, 0)).x;
+
+ //if (sample < -10000.0 * 0.5)
+ //continue;
+
+ // spatial domain
+ float r1 = length(float2(x, y))*radiusInv;
+ float w = exp(-(r1*r1));
+
+ // range domain (based on depth difference)
+ float r2 = (sample - depth) * blurDepthFalloff;
+ float g = exp(-(r2*r2));
+
+ //fractional radius contributions
+ float wBoundary = step(radius, max(abs(x), abs(y)));
+ float wFrac = 1.0 - wBoundary*frac;
+
+ sum += sample * w * g * wFrac;
+ wsum += w * g * wFrac;
+ count += g * wFrac;
+ }
+ }
+
+ if (wsum > 0.0)
+ {
+ sum /= wsum;
+ }
+
+ float blend = count / sqr(2.0 * radius + 1.0);
+ gl_FragColor.x = lerp(depth, sum, blend);
+
+ return gl_FragColor;
+}
diff --git a/demo/d3d11/shaders/blurDepthPS.hlsl.h b/demo/d3d11/shaders/blurDepthPS.hlsl.h
new file mode 100644
index 0000000..ff191f8
--- /dev/null
+++ b/demo/d3d11/shaders/blurDepthPS.hlsl.h
@@ -0,0 +1,664 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct FluidShaderConst
+// {
+//
+// float4x4 modelviewprojection; // Offset: 0
+// float4x4 modelview; // Offset: 64
+// float4x4 projection; // Offset: 128
+// float4x4 modelview_inverse; // Offset: 192
+// float4x4 projection_inverse; // Offset: 256
+// float4 invTexScale; // Offset: 320
+// float3 invViewport; // Offset: 336
+// float _pad0; // Offset: 348
+// float blurRadiusWorld; // Offset: 352
+// float blurScale; // Offset: 356
+// float blurFalloff; // Offset: 360
+// int debug; // Offset: 364
+// float3 lightPos; // Offset: 368
+// float _pad1; // Offset: 380
+// float3 lightDir; // Offset: 384
+// float _pad2; // Offset: 396
+// float4x4 lightTransform; // Offset: 400
+// float4 color; // Offset: 464
+// float4 clipPosToEye; // Offset: 480
+// float spotMin; // Offset: 496
+// float spotMax; // Offset: 500
+// float ior; // Offset: 504
+// float _pad3; // Offset: 508
+// float4 shadowTaps[12]; // Offset: 512
+//
+// } gParams; // Offset: 0 Size: 704
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// depthTex texture float 2d 0 1
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xy
+// TEXCOORD 0 xy 1 NONE float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[23], immediateIndexed
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps_siv linear noperspective v0.xy, position
+dcl_output o0.xyzw
+dcl_temps 5
+ftoi r0.xy, v0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld_indexable(texture2d)(float,float,float,float) r0.x, r0.xyzw, t0.xyzw
+div r0.y, cb0[22].x, -r0.x
+mul r0.y, r0.y, cb0[22].y
+min r0.y, r0.y, l(5.000000)
+div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
+round_pi r0.w, r0.y
+add r1.x, -r0.y, r0.w
+mov r2.zw, l(0,0,0,0)
+mov r1.yzw, l(0,0,0,0)
+mov r3.y, -r0.w
+loop
+ lt r3.z, r0.w, r3.y
+ breakc_nz r3.z
+ mov r4.xyz, r1.yzwy
+ mov r4.w, -r0.w
+ loop
+ lt r3.z, r0.w, r4.w
+ breakc_nz r3.z
+ mov r3.x, r4.w
+ add r3.zw, r3.xxxy, v0.xxxy
+ ftoi r2.xy, r3.zwzz
+ ld_indexable(texture2d)(float,float,float,float) r2.x, r2.xyzw, t0.xyzw
+ dp2 r2.y, r3.xyxx, r3.xyxx
+ sqrt r2.y, r2.y
+ mul r2.y, r0.z, r2.y
+ mul r2.y, r2.y, r2.y
+ mul r2.y, r2.y, l(-1.442695)
+ exp r2.y, r2.y
+ add r3.x, -r0.x, r2.x
+ mul r3.x, r3.x, l(5.500000)
+ mul r3.x, r3.x, r3.x
+ mul r3.x, r3.x, l(-1.442695)
+ exp r3.x, r3.x
+ max r3.z, |r3.y|, |r4.w|
+ ge r3.z, r3.z, r0.y
+ and r3.z, r3.z, l(0x3f800000)
+ mad r3.z, -r3.z, r1.x, l(1.000000)
+ mul r2.x, r2.y, r2.x
+ mul r2.x, r3.x, r2.x
+ mad r4.x, r2.x, r3.z, r4.x
+ mul r2.x, r2.y, r3.x
+ mad r4.y, r2.x, r3.z, r4.y
+ mad r4.z, r3.x, r3.z, r4.z
+ add r4.w, r4.w, l(1.000000)
+ endloop
+ mov r1.yzw, r4.xxyz
+ add r3.y, r3.y, l(1.000000)
+endloop
+lt r0.z, l(0.000000), r1.z
+div r0.w, r1.y, r1.z
+movc r0.z, r0.z, r0.w, r1.y
+mad r0.y, r0.y, l(2.000000), l(1.000000)
+mul r0.y, r0.y, r0.y
+div r0.y, r1.w, r0.y
+add r0.z, -r0.x, r0.z
+mad o0.x, r0.y, r0.z, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 60 instruction slots used
+#endif
+
+const BYTE g_blurDepthPS[] =
+{
+ 68, 88, 66, 67, 244, 233,
+ 190, 43, 161, 207, 241, 98,
+ 173, 248, 128, 15, 40, 190,
+ 66, 70, 1, 0, 0, 0,
+ 76, 12, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 156, 4, 0, 0, 244, 4,
+ 0, 0, 40, 5, 0, 0,
+ 176, 11, 0, 0, 82, 68,
+ 69, 70, 96, 4, 0, 0,
+ 1, 0, 0, 0, 144, 0,
+ 0, 0, 2, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 44, 4, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 124, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0,
+ 4, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 133, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 100, 101,
+ 112, 116, 104, 84, 101, 120,
+ 0, 99, 111, 110, 115, 116,
+ 66, 117, 102, 0, 171, 171,
+ 133, 0, 0, 0, 1, 0,
+ 0, 0, 168, 0, 0, 0,
+ 192, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 208, 0, 0, 0, 0, 0,
+ 0, 0, 192, 2, 0, 0,
+ 2, 0, 0, 0, 8, 4,
+ 0, 0, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 103, 80,
+ 97, 114, 97, 109, 115, 0,
+ 70, 108, 117, 105, 100, 83,
+ 104, 97, 100, 101, 114, 67,
+ 111, 110, 115, 116, 0, 109,
+ 111, 100, 101, 108, 118, 105,
+ 101, 119, 112, 114, 111, 106,
+ 101, 99, 116, 105, 111, 110,
+ 0, 102, 108, 111, 97, 116,
+ 52, 120, 52, 0, 171, 171,
+ 3, 0, 3, 0, 4, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 253, 0, 0, 0,
+ 109, 111, 100, 101, 108, 118,
+ 105, 101, 119, 0, 112, 114,
+ 111, 106, 101, 99, 116, 105,
+ 111, 110, 0, 109, 111, 100,
+ 101, 108, 118, 105, 101, 119,
+ 95, 105, 110, 118, 101, 114,
+ 115, 101, 0, 112, 114, 111,
+ 106, 101, 99, 116, 105, 111,
+ 110, 95, 105, 110, 118, 101,
+ 114, 115, 101, 0, 105, 110,
+ 118, 84, 101, 120, 83, 99,
+ 97, 108, 101, 0, 102, 108,
+ 111, 97, 116, 52, 0, 171,
+ 171, 171, 1, 0, 3, 0,
+ 1, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 114, 1,
+ 0, 0, 105, 110, 118, 86,
+ 105, 101, 119, 112, 111, 114,
+ 116, 0, 102, 108, 111, 97,
+ 116, 51, 0, 171, 1, 0,
+ 3, 0, 1, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 172, 1, 0, 0, 95, 112,
+ 97, 100, 48, 0, 102, 108,
+ 111, 97, 116, 0, 0, 0,
+ 3, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 222, 1, 0, 0, 98, 108,
+ 117, 114, 82, 97, 100, 105,
+ 117, 115, 87, 111, 114, 108,
+ 100, 0, 98, 108, 117, 114,
+ 83, 99, 97, 108, 101, 0,
+ 98, 108, 117, 114, 70, 97,
+ 108, 108, 111, 102, 102, 0,
+ 100, 101, 98, 117, 103, 0,
+ 105, 110, 116, 0, 0, 0,
+ 2, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 52, 2, 0, 0, 108, 105,
+ 103, 104, 116, 80, 111, 115,
+ 0, 95, 112, 97, 100, 49,
+ 0, 108, 105, 103, 104, 116,
+ 68, 105, 114, 0, 95, 112,
+ 97, 100, 50, 0, 108, 105,
+ 103, 104, 116, 84, 114, 97,
+ 110, 115, 102, 111, 114, 109,
+ 0, 99, 111, 108, 111, 114,
+ 0, 99, 108, 105, 112, 80,
+ 111, 115, 84, 111, 69, 121,
+ 101, 0, 115, 112, 111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 0, 124, 1,
+ 0, 0, 224, 1, 0, 0,
+ 156, 2, 0, 0, 228, 1,
+ 0, 0, 240, 1, 0, 0,
+ 164, 2, 0, 0, 228, 1,
+ 0, 0, 244, 1, 0, 0,
+ 172, 2, 0, 0, 228, 1,
+ 0, 0, 248, 1, 0, 0,
+ 176, 2, 0, 0, 228, 1,
+ 0, 0, 252, 1, 0, 0,
+ 182, 2, 0, 0, 196, 2,
+ 0, 0, 0, 2, 0, 0,
+ 5, 0, 0, 0, 1, 0,
+ 176, 0, 0, 0, 24, 0,
+ 232, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 216, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 54,
+ 46, 51, 46, 57, 54, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52, 0, 171, 171, 73, 83,
+ 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 3,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 83, 86, 95, 80,
+ 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 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0,
+ 0, 0, 0, 0, 9, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/compositePS.hlsl b/demo/d3d11/shaders/compositePS.hlsl
new file mode 100644
index 0000000..b082aa6
--- /dev/null
+++ b/demo/d3d11/shaders/compositePS.hlsl
@@ -0,0 +1,194 @@
+#include "shaderCommon.h"
+
+#define ENABLE_SIMPLE_FLUID 1
+
+cbuffer constBuf : register(b0)
+{
+ FluidShaderConst gParams;
+};
+
+Texture2D<float> depthTex : register(t0);
+Texture2D<float3> sceneTex : register(t1);
+Texture2D<float> shadowTex : register(t2); // shadow map
+
+SamplerState texSampler : register(s0);
+SamplerComparisonState shadowSampler : register(s1); // texture sample used to sample depth from shadow texture in this sample
+
+// sample shadow map
+float shadowSample(float3 worldPos, out float attenuation)
+{
+#if 0
+ attenuation = 0.0f;
+ return 0.5;
+#else
+
+ float4 pos = mul(gParams.lightTransform, float4(worldPos + gParams.lightDir*0.15, 1.0));
+ pos /= pos.w;
+ float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0);
+
+ attenuation = 1.0;//max(smoothstep(spotMax, spotMin, dot(pos.xy, pos.xy)), 0.05);
+
+ // user clip
+ if (uvw.x < 0.0 || uvw.x > 1.0)
+ return 1.0;
+ if (uvw.y < 0.0 || uvw.y > 1.0)
+ return 1.0;
+
+ float s = 0.0;
+ float radius = 0.002;
+
+ uvw.y = 1.0f - uvw.y;
+
+ [unroll]
+ for (int i = 0; i < 8; i++)
+ {
+ float2 shadowTaps = gParams.shadowTaps[i].xy;
+ shadowTaps.y = 1.0f - shadowTaps.y;
+ s += shadowTex.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z);
+
+ //s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i] * radius, uvw.z)).r;
+ }
+
+ s /= 8.0;
+ return s;
+#endif
+}
+
+float3 viewportToEyeSpace(float2 coord, float eyeZ)
+{
+ float2 clipPosToEye = gParams.clipPosToEye.xy;
+
+ // find position at z=1 plane
+ //float2 uv = (coord * 2.0 - float2(1.0, 1.0)) * clipPosToEye;
+ float2 uv = float2(coord.x*2.0f-1.0f, (1.0f-coord.y)*2.0f - 1.0f)*clipPosToEye;
+
+ return float3(-uv * eyeZ, eyeZ);
+}
+
+float3 srgbToLinear(float3 c) { const float v = 2.2; return pow(c, float3(v, v, v)); }
+float3 linearToSrgb(float3 c) { const float v = 1.0 / 2.2; return pow(c, float3(v, v, v)); }
+
+float sqr(float x) { return x*x; }
+float cube(float x) { return x*x*x; }
+
+float4 compositePS(PassthroughVertexOut input
+ , out float gl_FragDepth : SV_DEPTH
+) : SV_TARGET
+{
+
+ float4 gl_FragColor;
+
+ const float4x4 gl_ProjectionMatrix = gParams.projection;
+ const float4x4 gl_ModelViewMatrix = gParams.modelview;
+ const float4x4 gl_ModelViewMatrixInverse = gParams.modelview_inverse;
+
+ const float2 invTexScale = gParams.invTexScale.xy;
+
+ const float3 lightDir = gParams.lightDir;
+ const float3 lightPos = gParams.lightPos;
+ const float spotMin = gParams.spotMin;
+ const float spotMax = gParams.spotMax;
+ const float ior = gParams.ior;
+ const float4 color = gParams.color;
+
+ // flip uv y-coordinate
+ float2 uvCoord = float2(input.texCoord[0].x, 1.0f-input.texCoord[0].y);
+
+ float eyeZ = depthTex.Sample(texSampler, uvCoord).x;
+
+ if (eyeZ == 0.0)
+ discard;
+
+ // reconstruct eye space pos from depth
+ float3 eyePos = viewportToEyeSpace(uvCoord, eyeZ);
+
+
+ // finite difference approx for normals, can't take dFdx because
+ // the one-sided difference is incorrect at shape boundaries
+ float3 zl = eyePos - viewportToEyeSpace(uvCoord - float2(invTexScale.x, 0.0), depthTex.Sample(texSampler, uvCoord - float2(invTexScale.x, 0.0)).x);
+ float3 zr = viewportToEyeSpace(uvCoord + float2(invTexScale.x, 0.0), depthTex.Sample(texSampler, uvCoord + float2(invTexScale.x, 0.0)).x) - eyePos;
+ float3 zt = viewportToEyeSpace(uvCoord + float2(0.0, invTexScale.y), depthTex.Sample(texSampler, uvCoord + float2(0.0, invTexScale.y)).x) - eyePos;
+ float3 zb = eyePos - viewportToEyeSpace(uvCoord - float2(0.0, invTexScale.y), depthTex.Sample(texSampler, uvCoord - float2(0.0, invTexScale.y)).x);
+
+ float3 dx = zl;
+ float3 dy = zt;
+
+ if (abs(zr.z) < abs(zl.z))
+ dx = zr;
+
+ if (abs(zb.z) < abs(zt.z))
+ dy = zb;
+
+
+ //float3 dx = ddx(eyePos.xyz);
+ //float3 dy = -ddy(eyePos.xyz);
+
+ float4 worldPos = mul(gl_ModelViewMatrixInverse, float4(eyePos, 1.0));
+
+ float attenuation;
+ float shadow = shadowSample(worldPos.xyz, attenuation);
+
+ float3 l = mul(gl_ModelViewMatrix, float4(lightDir, 0.0)).xyz;
+ float3 v = -normalize(eyePos);
+
+ float3 n = -normalize(cross(dx, dy)); // sign difference from texcoord coordinate difference between OpenGL
+ float3 h = normalize(v + l);
+
+ float3 skyColor = float3(0.1, 0.2, 0.4)*1.2;
+ float3 groundColor = float3(0.1, 0.1, 0.2);
+
+ float fresnel = 0.1 + (1.0 - 0.1)*cube(1.0 - max(dot(n, v), 0.0));
+
+ float3 lVec = normalize(worldPos.xyz - lightPos);
+
+ float ln = dot(l, n)*attenuation;
+
+ float3 rEye = reflect(-v, n).xyz;
+ float3 rWorld = mul(gl_ModelViewMatrixInverse, float4(rEye, 0.0)).xyz;
+
+ float2 texScale = float2(0.75, 1.0); // to account for backbuffer aspect ratio (todo: pass in)
+
+ float refractScale = ior*0.025;
+ float reflectScale = ior*0.1;
+
+ // attenuate refraction near ground (hack)
+ refractScale *= smoothstep(0.1, 0.4, worldPos.y);
+
+ float2 refractCoord = uvCoord + n.xy*refractScale*texScale;
+
+ // read thickness from refracted coordinate otherwise we get halos around objectsw
+ float thickness = 0.8f;//max(texture2D(thicknessTex, refractCoord).x, 0.3);
+
+ //vec3 transmission = exp(-(vec3(1.0)-color.xyz)*thickness);
+ float3 transmission = (1.0 - (1.0 - color.xyz)*thickness*0.8)*color.w;
+ float3 refract = sceneTex.Sample(texSampler, refractCoord).xyz*transmission;
+
+ float2 sceneReflectCoord = uvCoord - rEye.xy*texScale*reflectScale / eyePos.z;
+ float3 sceneReflect = sceneTex.Sample(texSampler, sceneReflectCoord).xyz*shadow;
+ //vec3 planarReflect = texture2D(reflectTex, gl_TexCoord[0].xy).xyz;
+ float3 planarReflect = float3(0.0, 0.0, 0.0);
+
+ // fade out planar reflections above the ground
+ //float3 reflect = lerp(planarReflect, sceneReflect, smoothstep(0.05, 0.3, worldPos.y)) + lerp(groundColor, skyColor, smoothstep(0.15, 0.25, rWorld.y)*shadow);
+ float3 reflect = sceneReflect + lerp(groundColor, skyColor, smoothstep(0.15, 0.25, rWorld.y)*shadow);
+
+ // lighting
+ float3 diffuse = color.xyz * lerp(float3(0.29, 0.379, 0.59), float3(1.0, 1.0, 1.0), (ln*0.5 + 0.5)*max(shadow, 0.4))*(1.0 - color.w);
+ float specular = 1.2*pow(max(dot(h, n), 0.0), 400.0);
+
+ gl_FragColor.xyz = diffuse + (lerp(refract, reflect, fresnel) + specular)*color.w;
+ gl_FragColor.w = 1.0;
+
+ // visualize normals
+ //gl_FragColor = float4(n*0.5 + 0.5, 1.0);
+ //gl_FragColor.xyz = float3(fresnel, fresnel, fresnel);
+ //gl_FragColor.xyz = n;
+
+ // write valid z
+ float4 clipPos = mul(gl_ProjectionMatrix, float4(0.0, 0.0, eyeZ, 1.0));
+ clipPos.z /= clipPos.w;
+ gl_FragDepth = clipPos.z;
+
+ return gl_FragColor;
+
+}
diff --git a/demo/d3d11/shaders/compositePS.hlsl.h b/demo/d3d11/shaders/compositePS.hlsl.h
new file mode 100644
index 0000000..77d3814
--- /dev/null
+++ b/demo/d3d11/shaders/compositePS.hlsl.h
@@ -0,0 +1,1643 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct FluidShaderConst
+// {
+//
+// float4x4 modelviewprojection; // Offset: 0
+// float4x4 modelview; // Offset: 64
+// float4x4 projection; // Offset: 128
+// float4x4 modelview_inverse; // Offset: 192
+// float4x4 projection_inverse; // Offset: 256
+// float4 invTexScale; // Offset: 320
+// float3 invViewport; // Offset: 336
+// float _pad0; // Offset: 348
+// float blurRadiusWorld; // Offset: 352
+// float blurScale; // Offset: 356
+// float blurFalloff; // Offset: 360
+// int debug; // Offset: 364
+// float3 lightPos; // Offset: 368
+// float _pad1; // Offset: 380
+// float3 lightDir; // Offset: 384
+// float _pad2; // Offset: 396
+// float4x4 lightTransform; // Offset: 400
+// float4 color; // Offset: 464
+// float4 clipPosToEye; // Offset: 480
+// float spotMin; // Offset: 496
+// float spotMax; // Offset: 500
+// float ior; // Offset: 504
+// float _pad3; // Offset: 508
+// float4 shadowTaps[12]; // Offset: 512
+//
+// } gParams; // Offset: 0 Size: 704
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// texSampler sampler NA NA 0 1
+// shadowSampler sampler_c NA NA 1 1
+// depthTex texture float 2d 0 1
+// sceneTex texture float3 2d 1 1
+// shadowTex texture float 2d 2 1
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[40], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_sampler s1, mode_comparison
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_resource_texture2d (float,float,float,float) t1
+dcl_resource_texture2d (float,float,float,float) t2
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_output oDepth
+dcl_temps 8
+mad r0.xy, v1.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000)
+sample_indexable(texture2d)(float,float,float,float) r1.z, r0.xyxx, t0.yzxw, s0
+eq r0.z, r1.z, l(0.000000)
+discard_nz r0.z
+mad r0.zw, v1.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
+mul r0.zw, r0.zzzw, cb0[30].xxxy
+mul r1.xy, r1.zzzz, -r0.zwzz
+mov r2.y, cb0[20].x
+mov r2.z, l(0)
+add r0.zw, r0.xxxy, -r2.yyyz
+sample_indexable(texture2d)(float,float,float,float) r2.x, r0.zwzz, t0.xyzw, s0
+mad r0.zw, r0.zzzw, l(0.000000, 0.000000, 2.000000, -2.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
+mul r0.zw, r0.zzzw, cb0[30].xxxy
+mul r2.yz, r2.xxxx, -r0.zzwz
+add r2.xyz, r1.zxyz, -r2.xyzx
+mov r3.y, cb0[20].x
+mov r3.z, l(1.000000)
+mad r0.zw, v1.xxxy, l(0.000000, 0.000000, 1.000000, -1.000000), r3.yyyz
+sample_indexable(texture2d)(float,float,float,float) r3.x, r0.zwzz, t0.xyzw, s0
+mad r0.zw, r0.zzzw, l(0.000000, 0.000000, 2.000000, -2.000000), l(0.000000, 0.000000, -1.000000, 1.000000)
+mul r0.zw, r0.zzzw, cb0[30].xxxy
+mul r3.yz, r3.xxxx, -r0.zzwz
+add r3.xyz, -r1.zxyz, r3.xyzx
+mov r4.z, l(0)
+mov r4.x, cb0[20].y
+add r0.zw, r0.yyyx, r4.xxxz
+sample_indexable(texture2d)(float,float,float,float) r5.y, r0.wzww, t0.yxzw, s0
+mad r0.zw, r0.zzzw, l(0.000000, 0.000000, -2.000000, 2.000000), l(0.000000, 0.000000, 1.000000, -1.000000)
+mul r0.zw, r0.zzzw, cb0[30].yyyx
+mul r5.xz, r5.yyyy, -r0.zzwz
+add r5.xyz, -r1.yzxy, r5.xyzx
+add r0.zw, r0.yyyx, -r4.xxxz
+sample_indexable(texture2d)(float,float,float,float) r4.y, r0.wzww, t0.yxzw, s0
+mad r0.zw, r0.zzzw, l(0.000000, 0.000000, -2.000000, 2.000000), l(0.000000, 0.000000, 1.000000, -1.000000)
+mul r0.zw, r0.zzzw, cb0[30].yyyx
+mul r4.xz, r4.yyyy, -r0.zzwz
+add r4.xyz, r1.yzxy, -r4.xyzx
+lt r0.z, |r3.x|, |r2.x|
+movc r2.xyz, r0.zzzz, r3.xyzx, r2.xyzx
+lt r0.z, |r4.y|, |r5.y|
+movc r3.xyz, r0.zzzz, r4.xyzx, r5.xyzx
+mul r4.xyz, r1.yyyy, cb0[13].xyzx
+mad r4.xyz, cb0[12].xyzx, r1.xxxx, r4.xyzx
+mad r4.xyz, cb0[14].xyzx, r1.zzzz, r4.xyzx
+add r4.xyz, r4.xyzx, cb0[15].xyzx
+mad r4.xzw, cb0[24].xxyz, l(0.150000, 0.000000, 0.150000, 0.150000), r4.xxyz
+mul r5.xyzw, r4.zzzz, cb0[26].xyzw
+mad r5.xyzw, cb0[25].xyzw, r4.xxxx, r5.xyzw
+mad r5.xyzw, cb0[27].xyzw, r4.wwww, r5.xyzw
+add r5.xyzw, r5.xyzw, cb0[28].xyzw
+div r4.xzw, r5.xxyz, r5.wwww
+mad r5.xyz, r4.xzwx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
+lt r0.z, r5.x, l(0.000000)
+lt r0.w, l(1.000000), r5.x
+or r0.z, r0.w, r0.z
+if_z r0.z
+ lt r0.z, r5.y, l(0.000000)
+ lt r0.w, l(1.000000), r5.y
+ or r0.z, r0.w, r0.z
+ if_z r0.z
+ add r0.z, -cb0[32].y, l(1.000000)
+ mul r6.x, cb0[32].x, l(0.002000)
+ mul r6.y, r0.z, l(0.002000)
+ add r5.w, -r5.y, l(1.000000)
+ add r0.zw, r5.xxxw, r6.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t2.xxxx, s1, r5.z
+ add r0.w, -cb0[33].y, l(1.000000)
+ mul r6.x, cb0[33].x, l(0.002000)
+ mul r6.y, r0.w, l(0.002000)
+ add r4.xz, r5.xxwx, r6.xxyx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[34].y, l(1.000000)
+ mul r6.x, cb0[34].x, l(0.002000)
+ mul r6.y, r0.w, l(0.002000)
+ add r4.xz, r5.xxwx, r6.xxyx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[35].y, l(1.000000)
+ mul r6.x, cb0[35].x, l(0.002000)
+ mul r6.y, r0.w, l(0.002000)
+ add r4.xz, r5.xxwx, r6.xxyx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[36].y, l(1.000000)
+ mul r6.x, cb0[36].x, l(0.002000)
+ mul r6.y, r0.w, l(0.002000)
+ add r4.xz, r5.xxwx, r6.xxyx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[37].y, l(1.000000)
+ mul r6.x, cb0[37].x, l(0.002000)
+ mul r6.y, r0.w, l(0.002000)
+ add r4.xz, r5.xxwx, r6.xxyx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[38].y, l(1.000000)
+ mul r6.x, cb0[38].x, l(0.002000)
+ mul r6.y, r0.w, l(0.002000)
+ add r4.xz, r5.xxwx, r6.xxyx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[39].y, l(1.000000)
+ mul r6.x, cb0[39].x, l(0.002000)
+ mul r6.y, r0.w, l(0.002000)
+ add r4.xz, r5.xxwx, r6.xxyx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z
+ add r0.z, r0.w, r0.z
+ mul r0.z, r0.z, l(0.125000)
+ else
+ mov r0.z, l(1.000000)
+ endif
+else
+ mov r0.z, l(1.000000)
+endif
+mul r4.xzw, cb0[5].xxyz, cb0[24].yyyy
+mad r4.xzw, cb0[4].xxyz, cb0[24].xxxx, r4.xxzw
+mad r4.xzw, cb0[6].xxyz, cb0[24].zzzz, r4.xxzw
+dp3 r0.w, r1.xyzx, r1.xyzx
+rsq r0.w, r0.w
+mul r5.xyz, r0.wwww, r1.xyzx
+mul r6.xyz, r2.xyzx, r3.xyzx
+mad r2.xyz, r2.zxyz, r3.yzxy, -r6.xyzx
+dp3 r1.w, r2.xyzx, r2.xyzx
+rsq r1.w, r1.w
+mul r2.xyz, r1.wwww, r2.xyzx
+mad r1.xyw, -r1.xyxz, r0.wwww, r4.xzxw
+dp3 r0.w, r1.xywx, r1.xywx
+rsq r0.w, r0.w
+mul r1.xyw, r0.wwww, r1.xyxw
+dp3 r0.w, -r2.xyzx, -r5.xyzx
+max r0.w, r0.w, l(0.000000)
+add r0.w, -r0.w, l(1.000000)
+mul r2.w, r0.w, r0.w
+mul r0.w, r0.w, r2.w
+mad r0.w, r0.w, l(0.900000), l(0.100000)
+dp3 r2.w, r4.xzwx, -r2.xyzx
+dp3 r3.x, r5.xyzx, -r2.xyzx
+add r3.x, r3.x, r3.x
+mad r3.xyz, r2.xyzx, r3.xxxx, r5.xyzx
+mul r3.w, r3.y, cb0[13].y
+mad r3.w, cb0[12].y, r3.x, r3.w
+mad r3.z, cb0[14].y, r3.z, r3.w
+mul r5.xy, cb0[31].zzzz, l(0.025000, 0.100000, 0.000000, 0.000000)
+add r3.w, r4.y, l(-0.100000)
+mul_sat r3.w, r3.w, l(3.333333)
+mad r4.x, r3.w, l(-2.000000), l(3.000000)
+mul r3.w, r3.w, r3.w
+mul r3.w, r3.w, r4.x
+mul r3.w, r3.w, r5.x
+mul r4.xy, -r2.xyxx, r3.wwww
+mad r4.xy, r4.xyxx, l(0.750000, 1.000000, 0.000000, 0.000000), r0.xyxx
+add r6.xyzw, -cb0[29].xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
+mad r6.xyz, -r6.xyzx, l(0.640000, 0.640000, 0.640000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000)
+mul r6.xyz, r6.xyzx, cb0[29].wwww
+sample_indexable(texture2d)(float,float,float,float) r4.xyz, r4.xyxx, t1.xyzw, s0
+mul r7.xyz, r6.xyzx, r4.xyzx
+mov r5.xz, l(0.750000,0,1.000000,0)
+mul r3.xy, r3.xyxx, r5.yzyy
+mul r5.y, cb0[31].z, l(0.100000)
+mul r3.xy, r3.xyxx, r5.xyxx
+div r3.xy, r3.xyxx, r1.zzzz
+add r0.xy, r0.xyxx, -r3.xyxx
+sample_indexable(texture2d)(float,float,float,float) r3.xyw, r0.xyxx, t1.xywz, s0
+add r0.x, r3.z, l(-0.150000)
+mul_sat r0.x, r0.x, l(10.000001)
+mad r0.y, r0.x, l(-2.000000), l(3.000000)
+mul r0.x, r0.x, r0.x
+mul r0.x, r0.x, r0.y
+mul r0.x, r0.z, r0.x
+mul r5.xyz, r0.xxxx, l(0.020000, 0.140000, 0.280000, 0.000000)
+mad r3.xyz, r3.xywx, r0.zzzz, r5.xyzx
+add r3.xyz, r3.xyzx, l(0.100000, 0.100000, 0.200000, 0.000000)
+mad r0.x, r2.w, l(0.500000), l(0.500000)
+max r0.y, r0.z, l(0.400000)
+mul r0.x, r0.y, r0.x
+mad r0.xyz, r0.xxxx, l(0.710000, 0.621000, 0.410000, 0.000000), l(0.290000, 0.379000, 0.590000, 0.000000)
+mul r0.xyz, r0.xyzx, cb0[29].xyzx
+dp3 r1.x, r1.xywx, -r2.xyzx
+max r1.x, r1.x, l(0.000000)
+log r1.x, r1.x
+mul r1.x, r1.x, l(400.000000)
+exp r1.x, r1.x
+mad r2.xyz, -r4.xyzx, r6.xyzx, r3.xyzx
+mad r2.xyz, r0.wwww, r2.xyzx, r7.xyzx
+mad r1.xyw, r1.xxxx, l(1.200000, 1.200000, 0.000000, 1.200000), r2.xyxz
+mul r1.xyw, r1.xyxw, cb0[29].wwww
+mad o0.xyz, r0.xyzx, r6.wwww, r1.xywx
+mad r0.xy, cb0[10].zwzz, r1.zzzz, cb0[11].zwzz
+div oDepth, r0.x, r0.y
+mov o0.w, l(1.000000)
+ret
+// Approximately 192 instruction slots used
+#endif
+
+const BYTE g_compositePS[] =
+{
+ 68, 88, 66, 67, 223, 79,
+ 142, 103, 26, 30, 227, 152,
+ 95, 75, 188, 26, 149, 14,
+ 233, 77, 1, 0, 0, 0,
+ 232, 31, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 72, 5, 0, 0, 160, 5,
+ 0, 0, 244, 5, 0, 0,
+ 76, 31, 0, 0, 82, 68,
+ 69, 70, 12, 5, 0, 0,
+ 1, 0, 0, 0, 60, 1,
+ 0, 0, 6, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+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117,
+ 102, 0, 171, 171, 49, 1,
+ 0, 0, 1, 0, 0, 0,
+ 84, 1, 0, 0, 192, 2,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 124, 1,
+ 0, 0, 0, 0, 0, 0,
+ 192, 2, 0, 0, 2, 0,
+ 0, 0, 180, 4, 0, 0,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 103, 80, 97, 114,
+ 97, 109, 115, 0, 70, 108,
+ 117, 105, 100, 83, 104, 97,
+ 100, 101, 114, 67, 111, 110,
+ 115, 116, 0, 109, 111, 100,
+ 101, 108, 118, 105, 101, 119,
+ 112, 114, 111, 106, 101, 99,
+ 116, 105, 111, 110, 0, 102,
+ 108, 111, 97, 116, 52, 120,
+ 52, 0, 171, 171, 3, 0,
+ 3, 0, 4, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 169, 1, 0, 0, 109, 111,
+ 100, 101, 108, 118, 105, 101,
+ 119, 0, 112, 114, 111, 106,
+ 101, 99, 116, 105, 111, 110,
+ 0, 109, 111, 100, 101, 108,
+ 118, 105, 101, 119, 95, 105,
+ 110, 118, 101, 114, 115, 101,
+ 0, 112, 114, 111, 106, 101,
+ 99, 116, 105, 111, 110, 95,
+ 105, 110, 118, 101, 114, 115,
+ 101, 0, 105, 110, 118, 84,
+ 101, 120, 83, 99, 97, 108,
+ 101, 0, 102, 108, 111, 97,
+ 116, 52, 0, 171, 171, 171,
+ 1, 0, 3, 0, 1, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 30, 2, 0, 0,
+ 105, 110, 118, 86, 105, 101,
+ 119, 112, 111, 114, 116, 0,
+ 102, 108, 111, 97, 116, 51,
+ 0, 171, 1, 0, 3, 0,
+ 1, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 88, 2,
+ 0, 0, 95, 112, 97, 100,
+ 48, 0, 102, 108, 111, 97,
+ 116, 0, 0, 0, 3, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 138, 2,
+ 0, 0, 98, 108, 117, 114,
+ 82, 97, 100, 105, 117, 115,
+ 87, 111, 114, 108, 100, 0,
+ 98, 108, 117, 114, 83, 99,
+ 97, 108, 101, 0, 98, 108,
+ 117, 114, 70, 97, 108, 108,
+ 111, 102, 102, 0, 100, 101,
+ 98, 117, 103, 0, 105, 110,
+ 116, 0, 0, 0, 2, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 224, 2,
+ 0, 0, 108, 105, 103, 104,
+ 116, 80, 111, 115, 0, 95,
+ 112, 97, 100, 49, 0, 108,
+ 105, 103, 104, 116, 68, 105,
+ 114, 0, 95, 112, 97, 100,
+ 50, 0, 108, 105, 103, 104,
+ 116, 84, 114, 97, 110, 115,
+ 102, 111, 114, 109, 0, 99,
+ 111, 108, 111, 114, 0, 99,
+ 108, 105, 112, 80, 111, 115,
+ 84, 111, 69, 121, 101, 0,
+ 115, 112, 111, 116, 77, 105,
+ 110, 0, 115, 112, 111, 116,
+ 77, 97, 120, 0, 105, 111,
+ 114, 0, 95, 112, 97, 100,
+ 51, 0, 115, 104, 97, 100,
+ 111, 119, 84, 97, 112, 115,
+ 0, 171, 171, 171, 1, 0,
+ 3, 0, 1, 0, 4, 0,
+ 12, 0, 0, 0, 0, 0,
+ 0, 0,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252, 1, 0, 0, 98, 3,
+ 0, 0, 112, 3, 0, 0,
+ 0, 2, 0, 0, 5, 0,
+ 0, 0, 1, 0, 176, 0,
+ 0, 0, 24, 0, 148, 3,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 132, 1, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 54, 46, 51,
+ 46, 57, 54, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 171, 171, 73, 83, 71, 78,
+ 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 3, 3, 0, 0,
+ 83, 86, 95, 80, 79, 83,
+ 73, 84, 73, 79, 78, 0,
+ 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 171, 171,
+ 79, 83, 71, 78, 76, 0,
+ 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 66, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 255, 255, 255, 255,
+ 1, 14, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69,
+ 84, 0, 83, 86, 95, 68,
+ 69, 80, 84, 72, 0, 171,
+ 83, 72, 69, 88, 80, 25,
+ 0, 0, 80, 0, 0, 0,
+ 84, 6, 0, 0, 106, 8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 0, 0,
+ 26, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5,
+ 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0,
+ 0, 0, 128, 63, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 148, 0, 0, 0, 192, 0,
+ 0, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 155, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0,
+ 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 7, 0, 0, 0, 0, 0,
+ 0, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/demo/d3d11/shaders/debugLinePS.hlsl b/demo/d3d11/shaders/debugLinePS.hlsl
new file mode 100644
index 0000000..d01847b
--- /dev/null
+++ b/demo/d3d11/shaders/debugLinePS.hlsl
@@ -0,0 +1,10 @@
+struct Input
+{
+ float4 position : SV_POSITION;
+ float4 color : COLOR;
+};
+
+float4 debugLinePS(Input input) : SV_TARGET
+{
+ return input.color;
+}
diff --git a/demo/d3d11/shaders/debugLinePS.hlsl.h b/demo/d3d11/shaders/debugLinePS.hlsl.h
new file mode 100644
index 0000000..6243104
--- /dev/null
+++ b/demo/d3d11/shaders/debugLinePS.hlsl.h
@@ -0,0 +1,121 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// COLOR 0 xyzw 1 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_input_ps linear v1.xyzw
+dcl_output o0.xyzw
+mov o0.xyzw, v1.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_debugLinePS[] =
+{
+ 68, 88, 66, 67, 51, 80,
+ 148, 24, 206, 189, 182, 148,
+ 220, 111, 88, 236, 138, 6,
+ 146, 179, 1, 0, 0, 0,
+ 20, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 172, 0, 0, 0, 0, 1,
+ 0, 0, 52, 1, 0, 0,
+ 120, 1, 0, 0, 82, 68,
+ 69, 70, 112, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 60, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 54,
+ 46, 51, 46, 57, 54, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52, 0, 171, 171, 73, 83,
+ 71, 78, 76, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/debugLineVS.hlsl b/demo/d3d11/shaders/debugLineVS.hlsl
new file mode 100644
index 0000000..1033b35
--- /dev/null
+++ b/demo/d3d11/shaders/debugLineVS.hlsl
@@ -0,0 +1,26 @@
+
+cbuffer params : register(b0)
+{
+ float4x4 projectionViewWorld;
+};
+
+struct Input
+{
+ float3 position : POSITION;
+ float4 color : COLOR;
+};
+
+struct Output
+{
+ float4 position : SV_POSITION;
+ float4 color : COLOR;
+};
+
+Output debugLineVS(Input input)
+{
+ Output output;
+ output.position = mul(projectionViewWorld, float4(input.position, 1.0f));
+ output.color = input.color;
+
+ return output;
+}
diff --git a/demo/d3d11/shaders/debugLineVS.hlsl.h b/demo/d3d11/shaders/debugLineVS.hlsl.h
new file mode 100644
index 0000000..cdf7e4b
--- /dev/null
+++ b/demo/d3d11/shaders/debugLineVS.hlsl.h
@@ -0,0 +1,213 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer params
+// {
+//
+// float4x4 projectionViewWorld; // Offset: 0 Size: 64
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// params cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyz 0 NONE float xyz
+// COLOR 0 xyzw 1 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// COLOR 0 xyzw 1 NONE float xyzw
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[4], immediateIndexed
+dcl_input v0.xyz
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+dcl_temps 1
+mul r0.xyzw, v0.yyyy, cb0[1].xyzw
+mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw
+mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
+add o0.xyzw, r0.xyzw, cb0[3].xyzw
+mov o1.xyzw, v1.xyzw
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_debugLineVS[] =
+{
+ 68, 88, 66, 67, 240, 24,
+ 40, 204, 192, 159, 63, 125,
+ 158, 223, 41, 237, 85, 39,
+ 230, 54, 1, 0, 0, 0,
+ 160, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 88, 1, 0, 0, 168, 1,
+ 0, 0, 252, 1, 0, 0,
+ 4, 3, 0, 0, 82, 68,
+ 69, 70, 28, 1, 0, 0,
+ 1, 0, 0, 0, 100, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 232, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 112, 97, 114, 97,
+ 109, 115, 0, 171, 92, 0,
+ 0, 0, 1, 0, 0, 0,
+ 124, 0, 0, 0, 64, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 164, 0,
+ 0, 0, 0, 0, 0, 0,
+ 64, 0, 0, 0, 2, 0,
+ 0, 0, 196, 0, 0, 0,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 112, 114, 111, 106,
+ 101, 99, 116, 105, 111, 110,
+ 86, 105, 101, 119, 87, 111,
+ 114, 108, 100, 0, 102, 108,
+ 111, 97, 116, 52, 120, 52,
+ 0, 171, 171, 171, 3, 0,
+ 3, 0, 4, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 184, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 54, 46, 51,
+ 46, 57, 54, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 171, 171, 73, 83, 71, 78,
+ 72, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 7, 7, 0, 0,
+ 65, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0,
+ 0, 0, 15, 15, 0, 0,
+ 80, 79, 83, 73, 84, 73,
+ 79, 78, 0, 67, 79, 76,
+ 79, 82, 0, 171, 79, 83,
+ 71, 78, 76, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 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, 0, 1, 83, 84,
+ 65, 84, 148, 0, 0, 0,
+ 6, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/diffuseGS.hlsl b/demo/d3d11/shaders/diffuseGS.hlsl
new file mode 100644
index 0000000..e7a92db
--- /dev/null
+++ b/demo/d3d11/shaders/diffuseGS.hlsl
@@ -0,0 +1,176 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ DiffuseShaderConst gParams;
+};
+
+static const float2 corners[4] =
+{
+ float2(0.0, 1.0),
+ float2(0.0, 0.0),
+ float2(1.0, 1.0),
+ float2(1.0, 0.0)
+};
+
+[maxvertexcount(4)]
+void diffuseGS(point DiffuseVertexOut input[1], inout TriangleStream<DiffuseGeometryOut> triStream)
+{
+ float4 ndcPos = input[0].ndcPos;
+
+ // frustrum culling
+ const float ndcBound = 1.0;
+ if (ndcPos.x < -ndcBound) return;
+ if (ndcPos.x > ndcBound) return;
+ if (ndcPos.y < -ndcBound) return;
+ if (ndcPos.y > ndcBound) return;
+
+ float pointScale = gParams.diffuseScale;
+ float velocityScale = 1.0;
+
+ float3 v = input[0].viewVel.xyz;
+ float3 p = input[0].viewPos.xyz;
+
+ // billboard in eye space
+ float3 u = float3(0.0, pointScale, 0.0);
+ float3 l = float3(pointScale, 0.0, 0.0);
+
+ // increase size based on life
+ float lifeTime = input[0].worldPos.w;
+
+ float lifeFade = lerp(1.0f + gParams.diffusion, 1.0, min(1.0, lifeTime*0.25f));
+ u *= lifeFade;
+ l *= lifeFade;
+
+ float fade = 1.0/(lifeFade*lifeFade);
+ float vlen = length(v)*gParams.motionBlurScale;
+
+ if (vlen > 0.5)
+ {
+ float len = max(pointScale, vlen*0.016);
+ fade = min(1.0, 2.0/(len/pointScale));
+
+ u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz
+ l = normalize(cross(u, float3(0.0, 0.0, -1.0)))*pointScale;
+ }
+
+
+ {
+
+ DiffuseGeometryOut output;
+
+ output.worldPos = input[0].worldPos; // vertex world pos (life in w)
+ output.viewPos = input[0].viewPos; // vertex eye pos
+ output.viewVel.xyz = input[0].viewVel.xyz; // vertex velocity in view space
+ output.viewVel.w = fade;
+ output.lightDir = mul(gParams.modelView, float4(gParams.lightDir, 0.0));
+ output.color = input[0].color;
+
+ output.uv = float4(0.0, 1.0, 0.0, 0.0);
+ output.clipPos = mul(gParams.projection, float4(p + u - l, 1.0));
+ triStream.Append(output);
+
+ output.uv = float4(0.0, 0.0, 0.0, 0.0);
+ output.clipPos = mul(gParams.projection, float4(p - u - l, 1.0));
+ triStream.Append(output);
+
+ output.uv = float4(1.0, 1.0, 0.0, 0.0);
+ output.clipPos = mul(gParams.projection, float4(p + u + l, 1.0));
+ triStream.Append(output);
+
+ output.uv = float4(1.0, 0.0, 0.0, 0.0);
+ output.clipPos = mul(gParams.projection, float4(p - u + l, 1.0));
+ triStream.Append(output);
+ }
+
+}
+
+#if 0
+
+
+const char *geometryDiffuseShader =
+"#version 120\n"
+"#extension GL_EXT_geometry_shader4 : enable\n"
+STRINGIFY(
+
+uniform float pointScale; // point size in world space
+uniform float motionBlurScale;
+uniform float diffusion;
+uniform vec3 lightDir;
+
+void main()
+{
+ vec4 ndcPos = gl_TexCoordIn[0][5];
+
+ // frustrum culling
+ const float ndcBound = 1.0;
+ if (ndcPos.x < -ndcBound) return;
+ if (ndcPos.x > ndcBound) return;
+ if (ndcPos.y < -ndcBound) return;
+ if (ndcPos.y > ndcBound) return;
+
+ float velocityScale = 1.0;
+
+ vec3 v = gl_TexCoordIn[0][3].xyz*velocityScale;
+ vec3 p = gl_TexCoordIn[0][2].xyz;
+
+ // billboard in eye space
+ vec3 u = vec3(0.0, pointScale, 0.0);
+ vec3 l = vec3(pointScale, 0.0, 0.0);
+
+ // increase size based on life
+ float lifeFade = mix(1.0f+diffusion, 1.0, min(1.0, gl_TexCoordIn[0][1].w*0.25f));
+ u *= lifeFade;
+ l *= lifeFade;
+
+ //lifeFade = 1.0;
+
+ float fade = 1.0/(lifeFade*lifeFade);
+ float vlen = length(v)*motionBlurScale;
+
+ if (vlen > 0.5)
+ {
+ float len = max(pointScale, vlen*0.016);
+ fade = min(1.0, 2.0/(len/pointScale));
+
+ u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz
+ l = normalize(cross(u, vec3(0.0, 0.0, -1.0)))*pointScale;
+ }
+
+ {
+
+ gl_TexCoord[1] = gl_TexCoordIn[0][1]; // vertex world pos (life in w)
+ gl_TexCoord[2] = gl_TexCoordIn[0][2]; // vertex eye pos
+ gl_TexCoord[3] = gl_TexCoordIn[0][3]; // vertex velocity in view space
+ gl_TexCoord[3].w = fade;
+ gl_TexCoord[4] = gl_ModelViewMatrix*vec4(lightDir, 0.0);
+ gl_TexCoord[4].w = gl_TexCoordIn[0][3].w; // attenuation
+ gl_TexCoord[5].xyzw = gl_TexCoordIn[0][4].xyzw; // color
+
+ float zbias = 0.0f;//0.00125*2.0;
+
+ gl_TexCoord[0] = vec4(0.0, 1.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p + u - l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(0.0, 0.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p - u - l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1.0, 1.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p + u + l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1.0, 0.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p - u + l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+ }
+}
+);
+
+
+#endif \ No newline at end of file
diff --git a/demo/d3d11/shaders/diffuseGS.hlsl.h b/demo/d3d11/shaders/diffuseGS.hlsl.h
new file mode 100644
index 0000000..1f71735
--- /dev/null
+++ b/demo/d3d11/shaders/diffuseGS.hlsl.h
@@ -0,0 +1,973 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct DiffuseShaderConst
+// {
+//
+// float3 lightPos; // Offset: 0
+// float pad0; // Offset: 12
+// float3 lightDir; // Offset: 16
+// float pad1; // Offset: 28
+// float4x4 lightTransform; // Offset: 32
+// float4 color; // Offset: 96
+// float4x4 modelView; // Offset: 112
+// float4x4 modelViewProjection; // Offset: 176
+// float4x4 projection; // Offset: 240
+// float4 shadowTaps[12]; // Offset: 304
+// float diffusion; // Offset: 496
+// float diffuseRadius; // Offset: 500
+// float diffuseScale; // Offset: 504
+// float spotMin; // Offset: 508
+// float spotMax; // Offset: 512
+// float motionBlurScale; // Offset: 516
+// float pad3; // Offset: 520
+// float pad4; // Offset: 524
+//
+// } gParams; // Offset: 0 Size: 528
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyzw
+// NCDPOS 0 xyzw 1 NONE float xy
+// VIEWPOS 0 xyzw 2 NONE float xyzw
+// VIEWVEL 0 xyzw 3 NONE float xyz
+// COLOR 0 xyzw 4 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// POSITION 0 xyzw 1 NONE float xyzw
+// VIEWPOS 0 xyzw 2 NONE float xyzw
+// VIEWVEL 0 xyzw 3 NONE float xyzw
+// LIGHTDIR 0 xyzw 4 NONE float xyzw
+// COLOR 0 xyzw 5 NONE float xyzw
+// UV 0 xyzw 6 NONE float xyzw
+//
+gs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[33], immediateIndexed
+dcl_input v[1][0].xyzw
+dcl_input v[1][1].xyzw
+dcl_input v[1][2].xyzw
+dcl_input v[1][3].xyzw
+dcl_input v[1][4].xyzw
+dcl_temps 6
+dcl_inputprimitive point
+dcl_stream m0
+dcl_outputtopology trianglestrip
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_maxout 4
+lt r0.x, v[0][1].x, l(-1.000000)
+if_nz r0.x
+ ret
+endif
+lt r0.x, l(1.000000), v[0][1].x
+if_nz r0.x
+ ret
+endif
+lt r0.x, v[0][1].y, l(-1.000000)
+if_nz r0.x
+ ret
+endif
+lt r0.x, l(1.000000), v[0][1].y
+if_nz r0.x
+ ret
+endif
+add r0.x, cb0[31].x, l(1.000000)
+mul r0.y, l(0.250000), v[0][0].w
+min r0.y, r0.y, l(1.000000)
+add r0.z, -r0.x, l(1.000000)
+mad r0.x, r0.y, r0.z, r0.x
+mov r1.x, cb0[31].z
+mov r1.yz, l(0,0,0,0)
+mul r1.xyz, r0.xxxx, r1.xyzx
+mul r0.x, r0.x, r0.x
+div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
+dp3 r0.x, v[0][3].xyzx, v[0][3].xyzx
+sqrt r0.y, r0.x
+mul r0.y, r0.y, cb0[32].y
+lt r0.z, l(0.500000), r0.y
+mul r0.y, r0.y, l(0.016000)
+max r0.y, r0.y, cb0[31].z
+div r0.w, r0.y, cb0[31].z
+div r0.w, l(2.000000), r0.w
+min r2.w, r0.w, l(1.000000)
+rsq r0.x, r0.x
+mul r3.xyz, r0.xxxx, v[0][3].xyzx
+mul r0.xyw, r0.yyyy, r3.xyxz
+mul r3.xyz, r0.wxyw, l(0.000000, -1.000000, 0.000000, 0.000000)
+mad r3.xyz, r0.ywxy, l(-1.000000, 0.000000, 0.000000, 0.000000), -r3.xyzx
+dp2 r3.w, r3.xyxx, r3.xyxx
+rsq r3.w, r3.w
+mul r3.xyz, r3.wwww, r3.xyzx
+mul r2.xyz, r3.xyzx, cb0[31].zzzz
+movc r0.xyw, r0.zzzz, r0.xyxw, r1.zxzz
+movc r1.xyzw, r0.zzzz, r2.xyzw, r1.xyzw
+mul r2.xyzw, cb0[1].yyyy, cb0[8].xyzw
+mad r2.xyzw, cb0[7].xyzw, cb0[1].xxxx, r2.xyzw
+mad r2.xyzw, cb0[9].xyzw, cb0[1].zzzz, r2.xyzw
+add r3.xyz, r0.xywx, v[0][2].xyzx
+add r4.xyz, -r1.xyzx, r3.xyzx
+mul r5.xyzw, r4.yyyy, cb0[16].xyzw
+mad r5.xyzw, cb0[15].xyzw, r4.xxxx, r5.xyzw
+mad r4.xyzw, cb0[17].xyzw, r4.zzzz, r5.xyzw
+add r4.xyzw, r4.xyzw, cb0[18].xyzw
+mov o0.xyzw, r4.xyzw
+mov o1.xyzw, v[0][0].xyzw
+mov o2.xyzw, v[0][2].xyzw
+mov o3.xyz, v[0][3].xyzx
+mov o3.w, r1.w
+mov o4.xyzw, r2.xyzw
+mov o5.xyzw, v[0][4].xyzw
+mov o6.xyzw, l(0,1.000000,0,0)
+emit_stream m0
+add r0.xyz, -r0.xywx, v[0][2].xyzx
+add r4.xyz, -r1.xyzx, r0.xyzx
+mul r5.xyzw, r4.yyyy, cb0[16].xyzw
+mad r5.xyzw, cb0[15].xyzw, r4.xxxx, r5.xyzw
+mad r4.xyzw, cb0[17].xyzw, r4.zzzz, r5.xyzw
+add r4.xyzw, r4.xyzw, cb0[18].xyzw
+mov o0.xyzw, r4.xyzw
+mov o1.xyzw, v[0][0].xyzw
+mov o2.xyzw, v[0][2].xyzw
+mov o3.xyz, v[0][3].xyzx
+mov o3.w, r1.w
+mov o4.xyzw, r2.xyzw
+mov o5.xyzw, v[0][4].xyzw
+mov o6.xyzw, l(0,0,0,0)
+emit_stream m0
+add r3.xyz, r1.xyzx, r3.xyzx
+mul r4.xyzw, r3.yyyy, cb0[16].xyzw
+mad r4.xyzw, cb0[15].xyzw, r3.xxxx, r4.xyzw
+mad r3.xyzw, cb0[17].xyzw, r3.zzzz, r4.xyzw
+add r3.xyzw, r3.xyzw, cb0[18].xyzw
+mov o0.xyzw, r3.xyzw
+mov o1.xyzw, v[0][0].xyzw
+mov o2.xyzw, v[0][2].xyzw
+mov o3.xyz, v[0][3].xyzx
+mov o3.w, r1.w
+mov o4.xyzw, r2.xyzw
+mov o5.xyzw, v[0][4].xyzw
+mov o6.xyzw, l(1.000000,1.000000,0,0)
+emit_stream m0
+add r0.xyz, r1.xyzx, r0.xyzx
+mul r3.xyzw, r0.yyyy, cb0[16].xyzw
+mad r3.xyzw, cb0[15].xyzw, r0.xxxx, r3.xyzw
+mad r0.xyzw, cb0[17].xyzw, r0.zzzz, r3.xyzw
+add r0.xyzw, r0.xyzw, cb0[18].xyzw
+mov o0.xyzw, r0.xyzw
+mov o1.xyzw, v[0][0].xyzw
+mov o2.xyzw, v[0][2].xyzw
+mov o3.xyz, v[0][3].xyzx
+mov o3.w, r1.w
+mov o4.xyzw, r2.xyzw
+mov o5.xyzw, v[0][4].xyzw
+mov o6.xyzw, l(1.000000,0,0,0)
+emit_stream m0
+ret
+// Approximately 108 instruction slots used
+#endif
+
+const BYTE g_diffuseGS[] =
+{
+ 68, 88, 66, 67, 206, 113,
+ 108, 237, 96, 228, 115, 111,
+ 205, 11, 177, 210, 155, 123,
+ 232, 125, 1, 0, 0, 0,
+ 16, 18, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 188, 3, 0, 0, 108, 4,
+ 0, 0, 120, 5, 0, 0,
+ 116, 17, 0, 0, 82, 68,
+ 69, 70, 128, 3, 0, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 83, 71, 0, 1, 0, 0,
+ 76, 3, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 99, 111, 110, 115,
+ 116, 66, 117, 102, 0, 171,
+ 171, 171, 92, 0, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 16, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 0, 0, 0,
+ 0, 0, 0, 0, 16, 2,
+ 0, 0, 2, 0, 0, 0,
+ 40, 3, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 103, 80, 97, 114, 97, 109,
+ 115, 0, 68, 105, 102, 102,
+ 117, 115, 101, 83, 104, 97,
+ 100, 101, 114, 67, 111, 110,
+ 115, 116, 0, 108, 105, 103,
+ 104, 116, 80, 111, 115, 0,
+ 102, 108, 111, 97, 116, 51,
+ 0, 171, 1, 0, 3, 0,
+ 1, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 204, 0,
+ 0, 0, 112, 97, 100, 48,
+ 0, 102, 108, 111, 97, 116,
+ 0, 171, 0, 0, 3, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 253, 0,
+ 0, 0, 108, 105, 103, 104,
+ 116, 68, 105, 114, 0, 112,
+ 97, 100, 49, 0, 108, 105,
+ 103, 104, 116, 84, 114, 97,
+ 110, 115, 102, 111, 114, 109,
+ 0, 102, 108, 111, 97, 116,
+ 52, 120, 52, 0, 171, 171,
+ 3, 0, 3, 0, 4, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 69, 1, 0, 0,
+ 99, 111, 108, 111, 114, 0,
+ 102, 108, 111, 97, 116, 52,
+ 0, 171, 171, 171, 1, 0,
+ 3, 0, 1, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 122, 1, 0, 0, 109, 111,
+ 100, 101, 108, 86, 105, 101,
+ 119, 0, 109, 111, 100, 101,
+ 108, 86, 105, 101, 119, 80,
+ 114, 111, 106, 101, 99, 116,
+ 105, 111, 110, 0, 112, 114,
+ 111, 106, 101, 99, 116, 105,
+ 111, 110, 0, 115, 104, 97,
+ 100, 111, 119, 84, 97, 112,
+ 115, 0, 1, 0, 3, 0,
+ 1, 0, 4, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 122, 1,
+ 0, 0, 100, 105, 102, 102,
+ 117, 115, 105, 111, 110, 0,
+ 100, 105, 102, 102, 117, 115,
+ 101, 82, 97, 100, 105, 117,
+ 115, 0, 100, 105, 102, 102,
+ 117, 115, 101, 83, 99, 97,
+ 108, 101, 0, 115, 112, 111,
+ 116, 77, 105, 110, 0, 115,
+ 112, 111, 116, 77, 97, 120,
+ 0, 109, 111, 116, 105, 111,
+ 110, 66, 108, 117, 114, 83,
+ 99, 97, 108, 101, 0, 112,
+ 97, 100, 51, 0, 112, 97,
+ 100, 52, 0, 171, 195, 0,
+ 0, 0, 212, 0, 0, 0,
+ 0, 0, 0, 0, 248, 0,
+ 0, 0, 4, 1, 0, 0,
+ 12, 0, 0, 0, 40, 1,
+ 0, 0, 212, 0, 0, 0,
+ 16, 0, 0, 0, 49, 1,
+ 0, 0, 4, 1, 0, 0,
+ 28, 0, 0, 0, 54, 1,
+ 0, 0, 80, 1, 0, 0,
+ 32, 0, 0, 0, 116, 1,
+ 0, 0, 132, 1, 0, 0,
+ 96, 0, 0, 0, 168, 1,
+ 0, 0, 80, 1, 0, 0,
+ 112, 0, 0, 0, 178, 1,
+ 0, 0, 80, 1, 0, 0,
+ 176, 0, 0, 0, 198, 1,
+ 0, 0, 80, 1, 0, 0,
+ 240, 0, 0, 0, 209, 1,
+ 0, 0, 220, 1, 0, 0,
+ 48, 1, 0, 0, 0, 2,
+ 0, 0, 4, 1, 0, 0,
+ 240, 1, 0, 0, 10, 2,
+ 0, 0, 4, 1, 0, 0,
+ 244, 1, 0, 0, 24, 2,
+ 0, 0, 4, 1, 0, 0,
+ 248, 1, 0, 0, 37, 2,
+ 0, 0, 4, 1, 0, 0,
+ 252, 1, 0, 0, 45, 2,
+ 0, 0, 4, 1, 0, 0,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S.hlsl b/demo/d3d11/shaders/diffusePS.hlsl
new file mode 100644
index 0000000..c6e474e
--- /dev/null
+++ b/demo/d3d11/shaders/diffusePS.hlsl
@@ -0,0 +1,37 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ DiffuseShaderConst gParams;
+};
+
+float sqr(float x) { return x * x; }
+
+
+float4 diffusePS(DiffuseGeometryOut input
+ //, out float gl_FragDepth : SV_DEPTH
+) : SV_TARGET
+{
+ //return float4(1.0f, 0.0f, 0.0f, 1.0f);
+
+ float attenuation = 1.0f;
+ float lifeTime = input.worldPos.w;
+ float lifeFade = min(1.0, lifeTime*0.125);
+ float velocityFade = input.viewVel.w;
+
+ // calculate normal from texture coordinates
+ float3 normal;
+ normal.xy = input.uv.xy*float2(2.0, 2.0) + float2(-1.0, -1.0);
+ float mag = dot(normal.xy, normal.xy);
+
+ // kill pixels outside circle
+ if (mag > 1.0)
+ discard;
+
+ normal.z = 1.0-mag;
+
+ float alpha = lifeFade*velocityFade*sqr(normal.z);
+
+ return float4(alpha, alpha, alpha, alpha);
+
+}
diff --git a/demo/d3d11/shaders/diffusePS.hlsl.h b/demo/d3d11/shaders/diffusePS.hlsl.h
new file mode 100644
index 0000000..b77dc1c
--- /dev/null
+++ b/demo/d3d11/shaders/diffusePS.hlsl.h
@@ -0,0 +1,216 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// POSITION 0 xyzw 1 NONE float w
+// VIEWPOS 0 xyzw 2 NONE float
+// VIEWVEL 0 xyzw 3 NONE float w
+// LIGHTDIR 0 xyzw 4 NONE float
+// COLOR 0 xyzw 5 NONE float
+// UV 0 xyzw 6 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_input_ps linear v1.w
+dcl_input_ps linear v3.w
+dcl_input_ps linear v6.xy
+dcl_output o0.xyzw
+dcl_temps 1
+mad r0.xy, v6.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
+dp2 r0.x, r0.xyxx, r0.xyxx
+lt r0.y, l(1.000000), r0.x
+discard_nz r0.y
+mul r0.y, v1.w, l(0.125000)
+min r0.y, r0.y, l(1.000000)
+add r0.x, -r0.x, l(1.000000)
+mul r0.y, r0.y, v3.w
+mul r0.x, r0.x, r0.x
+mul o0.xyzw, r0.xxxx, r0.yyyy
+ret
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_diffusePS[] =
+{
+ 68, 88, 66, 67, 142, 84,
+ 94, 27, 80, 231, 240, 136,
+ 237, 253, 148, 77, 42, 64,
+ 90, 183, 1, 0, 0, 0,
+ 232, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 172, 0, 0, 0, 156, 1,
+ 0, 0, 208, 1, 0, 0,
+ 76, 3, 0, 0, 82, 68,
+ 69, 70, 112, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 60, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 54,
+ 46, 51, 46, 57, 54, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52,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+ DiffuseShaderConst gParams;
+};
+
+DiffuseVertexOut diffuseVS(DiffuseVertexIn input)
+{
+ float3 worldPos = input.position.xyz;
+ float4 eyePos = mul(gParams.modelView, float4(worldPos, 1.0));
+
+ DiffuseVertexOut output;
+
+ output.worldPos = input.position; // lifetime in w
+ output.viewPos = eyePos;
+ output.viewVel = mul(gParams.modelView, float4(input.velocity.xyz, 0.0));
+ output.color = gParams.color;
+
+ // compute ndc pos for frustrum culling in GS
+ float4 ndcPos = mul(gParams.modelViewProjection, float4(worldPos.xyz, 1.0));
+ output.ndcPos = ndcPos / ndcPos.w;
+
+ return output;
+
+}
diff --git a/demo/d3d11/shaders/diffuseVS.hlsl.h b/demo/d3d11/shaders/diffuseVS.hlsl.h
new file mode 100644
index 0000000..7db0a8c
--- /dev/null
+++ b/demo/d3d11/shaders/diffuseVS.hlsl.h
@@ -0,0 +1,425 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct DiffuseShaderConst
+// {
+//
+// float3 lightPos; // Offset: 0
+// float pad0; // Offset: 12
+// float3 lightDir; // Offset: 16
+// float pad1; // Offset: 28
+// float4x4 lightTransform; // Offset: 32
+// float4 color; // Offset: 96
+// float4x4 modelView; // Offset: 112
+// float4x4 modelViewProjection; // Offset: 176
+// float4x4 projection; // Offset: 240
+// float4 shadowTaps[12]; // Offset: 304
+// float diffusion; // Offset: 496
+// float diffuseRadius; // Offset: 500
+// float diffuseScale; // Offset: 504
+// float spotMin; // Offset: 508
+// float spotMax; // Offset: 512
+// float motionBlurScale; // Offset: 516
+// float pad3; // Offset: 520
+// float pad4; // Offset: 524
+//
+// } gParams; // Offset: 0 Size: 528
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyzw
+// VELOCITY 0 xyzw 1 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyzw
+// NCDPOS 0 xyzw 1 NONE float xyzw
+// VIEWPOS 0 xyzw 2 NONE float xyzw
+// VIEWVEL 0 xyzw 3 NONE float xyzw
+// COLOR 0 xyzw 4 NONE float xyzw
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[15], immediateIndexed
+dcl_input v0.xyzw
+dcl_input v1.xyz
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_temps 1
+mov o0.xyzw, v0.xyzw
+mul r0.xyzw, v0.yyyy, cb0[12].xyzw
+mad r0.xyzw, cb0[11].xyzw, v0.xxxx, r0.xyzw
+mad r0.xyzw, cb0[13].xyzw, v0.zzzz, r0.xyzw
+add r0.xyzw, r0.xyzw, cb0[14].xyzw
+div o1.xyzw, r0.xyzw, r0.wwww
+mul r0.xyzw, v0.yyyy, cb0[8].xyzw
+mad r0.xyzw, cb0[7].xyzw, v0.xxxx, r0.xyzw
+mad r0.xyzw, cb0[9].xyzw, v0.zzzz, r0.xyzw
+add o2.xyzw, r0.xyzw, cb0[10].xyzw
+mul r0.xyzw, v1.yyyy, cb0[8].xyzw
+mad r0.xyzw, cb0[7].xyzw, v1.xxxx, r0.xyzw
+mad o3.xyzw, cb0[9].xyzw, v1.zzzz, r0.xyzw
+mov o4.xyzw, cb0[6].xyzw
+ret
+// Approximately 15 instruction slots used
+#endif
+
+const BYTE g_diffuseVS[] =
+{
+ 68, 88, 66, 67, 169, 46,
+ 39, 192, 132, 15, 181, 233,
+ 181, 235, 144, 49, 232, 212,
+ 251, 135, 1, 0, 0, 0,
+ 184, 7, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 188, 3, 0, 0, 16, 4,
+ 0, 0, 192, 4, 0, 0,
+ 28, 7, 0, 0, 82, 68,
+ 69, 70, 128, 3, 0, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 76, 3, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 99, 111, 110, 115,
+ 116, 66, 117, 102, 0, 171,
+ 171, 171, 92, 0, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 16, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 0, 0, 0,
+ 0, 0, 0, 0, 16, 2,
+ 0, 0, 2, 0, 0, 0,
+ 40, 3, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 103, 80, 97, 114, 97, 109,
+ 115, 0, 68, 105, 102, 102,
+ 117, 115, 101, 83, 104, 97,
+ 100, 101, 114, 67, 111, 110,
+ 115, 116, 0, 108, 105, 103,
+ 104, 116, 80, 111, 115, 0,
+ 102, 108, 111, 97, 116, 51,
+ 0, 171, 1, 0, 3, 0,
+ 1, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 204, 0,
+ 0, 0, 112, 97, 100, 48,
+ 0, 102, 108, 111, 97, 116,
+ 0, 171, 0, 0, 3, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 253, 0,
+ 0, 0, 108, 105, 103, 104,
+ 116, 68, 105, 114, 0, 112,
+ 97, 100, 49, 0, 108, 105,
+ 103, 104, 116, 84, 114, 97,
+ 110, 115, 102, 111, 114, 109,
+ 0, 102, 108, 111, 97, 116,
+ 52, 120, 52, 0, 171, 171,
+ 3, 0, 3, 0, 4, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 69, 1, 0, 0,
+ 99, 111, 108, 111, 114, 0,
+ 102, 108, 111, 97, 116, 52,
+ 0, 171, 171, 171, 1, 0,
+ 3, 0, 1, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 122, 1, 0, 0, 109, 111,
+ 100, 101, 108, 86, 105, 101,
+ 119, 0, 109, 111, 100, 101,
+ 108, 86, 105, 101, 119, 80,
+ 114, 111, 106, 101, 99, 116,
+ 105, 111, 110, 0, 112, 114,
+ 111, 106, 101, 99, 116, 105,
+ 111, 110, 0, 115, 104, 97,
+ 100, 111, 119, 84, 97, 112,
+ 115, 0, 1, 0, 3, 0,
+ 1, 0, 4, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 122, 1,
+ 0, 0, 100, 105, 102, 102,
+ 117, 115, 105, 111, 110, 0,
+ 100, 105, 102, 102, 117, 115,
+ 101, 82, 97, 100, 105, 117,
+ 115, 0, 100, 105, 102, 102,
+ 117, 115, 101, 83, 99, 97,
+ 108, 101, 0, 115,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1, 0,
+ 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 54, 0,
+ 0, 6, 242, 32, 16, 0,
+ 4, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 148, 0, 0, 0, 15, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 7, 0,
+ 0, 0, 12, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl b/demo/d3d11/shaders/ellipsoidDepthGS.hlsl
new file mode 100644
index 0000000..8c892e4
--- /dev/null
+++ b/demo/d3d11/shaders/ellipsoidDepthGS.hlsl
@@ -0,0 +1,127 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ FluidShaderConst gParams;
+};
+
+static const float2 corners[4] =
+{
+ float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0)
+};
+
+[maxvertexcount(4)]
+void ellipsoidDepthGS(point FluidVertexOut input[1], inout TriangleStream<FluidGeoOut> triStream)
+{
+ float4 gl_Position;
+ float4 gl_TexCoord[6];
+
+ float4 gl_PositionIn[1];
+ float4 gl_TexCoordIn[1][6];
+
+ gl_PositionIn[0] = input[0].position;
+ {
+ [unroll]
+ for (int i = 0; i < 6; i++)
+ gl_TexCoordIn[0][i] = input[0].texCoord[i];
+ }
+
+ float3 pos = gl_PositionIn[0].xyz;
+ float4 bounds = gl_TexCoordIn[0][0];
+ float4 ndcPos = gl_TexCoordIn[0][5];
+
+ if (ndcPos.w < 0.0)
+ return;
+
+ // frustrum culling
+ const float ndcBound = 1.0;
+ if (ndcPos.x < -ndcBound) return;
+ if (ndcPos.x > ndcBound) return;
+ if (ndcPos.y < -ndcBound) return;
+ if (ndcPos.y > ndcBound) return;
+
+ float xmin = bounds.x;
+ float xmax = bounds.y;
+ float ymin = bounds.z;
+ float ymax = bounds.w;
+
+
+ // inv quadric transform
+ gl_TexCoord[0] = gl_TexCoordIn[0][1];
+ gl_TexCoord[1] = gl_TexCoordIn[0][2];
+ gl_TexCoord[2] = gl_TexCoordIn[0][3];
+ gl_TexCoord[3] = gl_TexCoordIn[0][4];
+
+ FluidGeoOut output;
+
+ gl_Position = float4(xmin, ymax, 0.5, 1.0);
+ output.position = gl_Position;
+ output.texCoord[0] = gl_TexCoord[0];
+ output.texCoord[1] = gl_TexCoord[1];
+ output.texCoord[2] = gl_TexCoord[2];
+ output.texCoord[3] = gl_TexCoord[3];
+ triStream.Append(output);
+
+ gl_Position = float4(xmin, ymin, 0.5, 1.0);
+ output.position = gl_Position;
+ output.texCoord[0] = gl_TexCoord[0];
+ output.texCoord[1] = gl_TexCoord[1];
+ output.texCoord[2] = gl_TexCoord[2];
+ output.texCoord[3] = gl_TexCoord[3];
+ triStream.Append(output);
+
+ gl_Position = float4(xmax, ymax, 0.5, 1.0);
+ output.position = gl_Position;
+ output.texCoord[0] = gl_TexCoord[0];
+ output.texCoord[1] = gl_TexCoord[1];
+ output.texCoord[2] = gl_TexCoord[2];
+ output.texCoord[3] = gl_TexCoord[3];
+ triStream.Append(output);
+
+ gl_Position = float4(xmax, ymin, 0.5, 1.0);
+ output.position = gl_Position;
+ output.texCoord[0] = gl_TexCoord[0];
+ output.texCoord[1] = gl_TexCoord[1];
+ output.texCoord[2] = gl_TexCoord[2];
+ output.texCoord[3] = gl_TexCoord[3];
+ triStream.Append(output);
+
+ /*
+ void main()
+ {
+ vec3 pos = gl_PositionIn[0].xyz;
+ vec4 bounds = gl_TexCoordIn[0][0];
+ vec4 ndcPos = gl_TexCoordIn[0][5];
+
+ // frustrum culling
+ const float ndcBound = 1.0;
+ if (ndcPos.x < -ndcBound) return;
+ if (ndcPos.x > ndcBound) return;
+ if (ndcPos.y < -ndcBound) return;
+ if (ndcPos.y > ndcBound) return;
+
+ float xmin = bounds.x;
+ float xmax = bounds.y;
+ float ymin = bounds.z;
+ float ymax = bounds.w;
+
+ // inv quadric transform
+ gl_TexCoord[0] = gl_TexCoordIn[0][1];
+ gl_TexCoord[1] = gl_TexCoordIn[0][2];
+ gl_TexCoord[2] = gl_TexCoordIn[0][3];
+ gl_TexCoord[3] = gl_TexCoordIn[0][4];
+
+ gl_Position = vec4(xmin, ymax, 0.0, 1.0);
+ EmitVertex();
+
+ gl_Position = vec4(xmin, ymin, 0.0, 1.0);
+ EmitVertex();
+
+ gl_Position = vec4(xmax, ymax, 0.0, 1.0);
+ EmitVertex();
+
+ gl_Position = vec4(xmax, ymin, 0.0, 1.0);
+ EmitVertex();
+ }
+ */
+}
diff --git a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h b/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h
new file mode 100644
index 0000000..c82cc89
--- /dev/null
+++ b/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h
@@ -0,0 +1,414 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float
+// TEXCOORD 0 xyzw 1 NONE float xyzw
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float xyzw
+// TEXCOORD 3 xyzw 4 NONE float xyzw
+// TEXCOORD 4 xyzw 5 NONE float xyzw
+// TEXCOORD 5 xyzw 6 NONE float xy w
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xyzw 1 NONE float xyzw
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float xyzw
+// TEXCOORD 3 xyzw 4 NONE float xyzw
+//
+gs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_input v[1][0].xyzw
+dcl_input v[1][1].xyzw
+dcl_input v[1][2].xyzw
+dcl_input v[1][3].xyzw
+dcl_input v[1][4].xyzw
+dcl_input v[1][5].xyzw
+dcl_input v[1][6].xyzw
+dcl_temps 1
+dcl_inputprimitive point
+dcl_stream m0
+dcl_outputtopology trianglestrip
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_maxout 4
+lt r0.x, v[0][6].w, l(0.000000)
+if_nz r0.x
+ ret
+endif
+lt r0.x, v[0][6].x, l(-1.000000)
+if_nz r0.x
+ ret
+endif
+lt r0.x, l(1.000000), v[0][6].x
+if_nz r0.x
+ ret
+endif
+lt r0.x, v[0][6].y, l(-1.000000)
+if_nz r0.x
+ ret
+endif
+lt r0.x, l(1.000000), v[0][6].y
+if_nz r0.x
+ ret
+endif
+mov o0.xy, v[0][1].xwxx
+mov o0.zw, l(0,0,0.500000,1.000000)
+mov o1.xyzw, v[0][2].xyzw
+mov o2.xyzw, v[0][3].xyzw
+mov o3.xyzw, v[0][4].xyzw
+mov o4.xyzw, v[0][5].xyzw
+emit_stream m0
+mov o0.xy, v[0][1].xzxx
+mov o0.zw, l(0,0,0.500000,1.000000)
+mov o1.xyzw, v[0][2].xyzw
+mov o2.xyzw, v[0][3].xyzw
+mov o3.xyzw, v[0][4].xyzw
+mov o4.xyzw, v[0][5].xyzw
+emit_stream m0
+mov o0.xy, v[0][1].ywyy
+mov o0.zw, l(0,0,0.500000,1.000000)
+mov o1.xyzw, v[0][2].xyzw
+mov o2.xyzw, v[0][3].xyzw
+mov o3.xyzw, v[0][4].xyzw
+mov o4.xyzw, v[0][5].xyzw
+emit_stream m0
+mov o0.xy, v[0][1].yzyy
+mov o0.zw, l(0,0,0.500000,1.000000)
+mov o1.xyzw, v[0][2].xyzw
+mov o2.xyzw, v[0][3].xyzw
+mov o3.xyzw, v[0][4].xyzw
+mov o4.xyzw, v[0][5].xyzw
+emit_stream m0
+ret
+// Approximately 49 instruction slots used
+#endif
+
+const BYTE g_ellipsoidDepthGS[] =
+{
+ 68, 88, 66, 67, 121, 233,
+ 112, 246, 66, 190, 203, 227,
+ 242, 237, 242, 197, 75, 158,
+ 125, 123, 1, 0, 0, 0,
+ 72, 7, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 172, 0, 0, 0, 120, 1,
+ 0, 0, 44, 2, 0, 0,
+ 172, 6, 0, 0, 82, 68,
+ 69, 70, 112, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 83, 71, 0, 1, 0, 0,
+ 60, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32,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+cbuffer constBuf : register(b0)
+{
+ FluidShaderConst gParams;
+};
+
+float Sign(float x) { return x < 0.0 ? -1.0 : 1.0; }
+
+bool solveQuadratic(float a, float b, float c, out float minT, out float maxT)
+{
+#if 0
+ minT = 0.0f;
+ maxT = 0.0f;
+#endif
+
+ if (a == 0.0 && b == 0.0)
+ {
+ minT = maxT = 0.0;
+ return true;
+ }
+
+ float discriminant = b*b - 4.0*a*c;
+
+ if (discriminant < 0.0)
+ {
+ return false;
+ }
+
+ float t = -0.5*(b + Sign(b)*sqrt(discriminant));
+ minT = t / a;
+ maxT = c / t;
+
+ if (minT > maxT)
+ {
+ float tmp = minT;
+ minT = maxT;
+ maxT = tmp;
+ }
+
+ return true;
+}
+
+float sqr(float x) { return x * x; }
+
+
+float4 ellipsoidDepthPS(FluidGeoOut input
+ , out float gl_FragDepth : SV_DEPTH
+) : SV_TARGET
+{
+ const float4x4 gl_ProjectionMatrix = gParams.projection;
+ const float4x4 gl_ProjectionMatrixInverse = gParams.projection_inverse;
+ const float3 invViewport = gParams.invViewport;
+
+ float4 gl_FragColor;
+ float4 gl_FragCoord;
+ float4 gl_TexCoord[6];
+
+ gl_FragCoord = input.position;
+ [unroll]
+ for (int i = 0; i < 4; i++)
+ gl_TexCoord[i] = input.texCoord[i];
+
+ // transform from view space to parameter space
+ //column_major
+ float4x4 invQuadric;
+ invQuadric._m00_m10_m20_m30 = gl_TexCoord[0];
+ invQuadric._m01_m11_m21_m31 = gl_TexCoord[1];
+ invQuadric._m02_m12_m22_m32 = gl_TexCoord[2];
+ invQuadric._m03_m13_m23_m33 = gl_TexCoord[3];
+
+ //float4 ndcPos = float4(gl_FragCoord.xy * invViewport.xy * float2(2.0, 2.0) - float2(1.0, 1.0), -1.0, 1.0);
+ float4 ndcPos = float4(gl_FragCoord.x*invViewport.x*2.0f-1.0f, (1.0f-gl_FragCoord.y*invViewport.y)*2.0 - 1.0, 0.0f, 1.0);
+ float4 viewDir = mul(gl_ProjectionMatrixInverse, ndcPos);
+
+ // ray to parameter space
+ float4 dir = mul(invQuadric, float4(viewDir.xyz, 0.0));
+ float4 origin = invQuadric._m03_m13_m23_m33;
+
+ // set up quadratric equation
+ float a = sqr(dir.x) + sqr(dir.y) + sqr(dir.z);
+ float b = dir.x*origin.x + dir.y*origin.y + dir.z*origin.z - dir.w*origin.w;
+ float c = sqr(origin.x) + sqr(origin.y) + sqr(origin.z) - sqr(origin.w);
+
+ float minT;
+ float maxT;
+
+ if (solveQuadratic(a, 2.0 * b, c, minT, maxT))
+ {
+ float3 eyePos = viewDir.xyz*minT;
+ float4 ndcPos = mul(gl_ProjectionMatrix, float4(eyePos, 1.0));
+ ndcPos.z /= ndcPos.w;
+
+ gl_FragColor = float4(eyePos.z, 1.0, 1.0, 1.0);
+ gl_FragDepth = ndcPos.z;
+
+ return gl_FragColor;
+ }
+
+ // kill pixels outside of ellipsoid
+ discard;
+
+
+ gl_FragColor = 0.0f;
+ gl_FragDepth = 1.0f;
+
+ return gl_FragColor;
+}
diff --git a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h b/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h
new file mode 100644
index 0000000..d21d446
--- /dev/null
+++ b/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h
@@ -0,0 +1,662 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct FluidShaderConst
+// {
+//
+// float4x4 modelviewprojection; // Offset: 0
+// float4x4 modelview; // Offset: 64
+// float4x4 projection; // Offset: 128
+// float4x4 modelview_inverse; // Offset: 192
+// float4x4 projection_inverse; // Offset: 256
+// float4 invTexScale; // Offset: 320
+// float3 invViewport; // Offset: 336
+// float _pad0; // Offset: 348
+// float blurRadiusWorld; // Offset: 352
+// float blurScale; // Offset: 356
+// float blurFalloff; // Offset: 360
+// int debug; // Offset: 364
+// float3 lightPos; // Offset: 368
+// float _pad1; // Offset: 380
+// float3 lightDir; // Offset: 384
+// float _pad2; // Offset: 396
+// float4x4 lightTransform; // Offset: 400
+// float4 color; // Offset: 464
+// float4 clipPosToEye; // Offset: 480
+// float spotMin; // Offset: 496
+// float spotMax; // Offset: 500
+// float ior; // Offset: 504
+// float _pad3; // Offset: 508
+// float4 shadowTaps[12]; // Offset: 512
+//
+// } gParams; // Offset: 0 Size: 704
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xy
+// TEXCOORD 0 xyzw 1 NONE float xyzw
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float xyzw
+// TEXCOORD 3 xyzw 4 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[22], immediateIndexed
+dcl_input_ps_siv linear noperspective v0.xy, position
+dcl_input_ps linear v1.xyzw
+dcl_input_ps linear v2.xyzw
+dcl_input_ps linear v3.xyzw
+dcl_input_ps linear v4.xyzw
+dcl_output o0.xyzw
+dcl_output oDepth
+dcl_temps 4
+dp2 r0.x, v0.xxxx, cb0[21].xxxx
+add r0.x, r0.x, l(-1.000000)
+mad r0.y, -v0.y, cb0[21].y, l(1.000000)
+mad r0.y, r0.y, l(2.000000), l(-1.000000)
+mul r0.yzw, r0.yyyy, cb0[17].xxyz
+mad r0.xyz, cb0[16].xyzx, r0.xxxx, r0.yzwy
+add r0.xyz, r0.xyzx, cb0[19].xyzx
+mul r1.xyzw, r0.yyyy, v2.xyzw
+mad r1.xyzw, v1.xyzw, r0.xxxx, r1.xyzw
+mad r1.xyzw, v3.xyzw, r0.zzzz, r1.xyzw
+dp3 r0.w, r1.xyzx, r1.xyzx
+dp3 r1.x, r1.xyzx, v4.xyzx
+mad r1.x, -r1.w, v4.w, r1.x
+dp3 r1.y, v4.xyzx, v4.xyzx
+mad r1.y, -v4.w, v4.w, r1.y
+add r1.z, r1.x, r1.x
+eq r1.w, r0.w, l(0.000000)
+eq r2.x, r1.x, l(0.000000)
+and r1.w, r1.w, r2.x
+mul r2.x, r0.w, r1.y
+mul r2.x, r2.x, l(4.000000)
+mad r2.x, r1.z, r1.z, -r2.x
+lt r2.y, r2.x, l(0.000000)
+not r3.y, r2.y
+lt r1.x, r1.x, l(0.000000)
+movc r1.x, r1.x, l(-1.000000), l(1.000000)
+sqrt r2.x, r2.x
+mad r1.x, r1.x, r2.x, r1.z
+mul r1.x, r1.x, l(-0.500000)
+div r0.w, r1.x, r0.w
+div r1.x, r1.y, r1.x
+lt r1.y, r1.x, r0.w
+movc r3.z, r1.y, r1.x, r0.w
+mov r3.xw, l(0,0,0,-1)
+movc r1.xy, r2.yyyy, r3.xyxx, r3.zwzz
+movc r1.xy, r1.wwww, l(0,-1,0,0), r1.xyxx
+if_nz r1.y
+ mul r0.xyz, r0.xyzx, r1.xxxx
+ mul r0.yw, r0.yyyy, cb0[9].zzzw
+ mad r0.xy, cb0[8].zwzz, r0.xxxx, r0.ywyy
+ mad r0.xy, cb0[10].zwzz, r0.zzzz, r0.xyxx
+ add r0.xy, r0.xyxx, cb0[11].zwzz
+ div oDepth, r0.x, r0.y
+ mov o0.x, r0.z
+ mov o0.yzw, l(0,1.000000,1.000000,1.000000)
+ ret
+endif
+discard_nz l(-1)
+mov o0.xyzw, l(0,0,0,0)
+mov oDepth, l(1.000000)
+ret
+// Approximately 51 instruction slots used
+#endif
+
+const BYTE g_ellipsoidDepthPS[] =
+{
+ 68, 88, 66, 67, 67, 187,
+ 249, 247, 27, 80, 204, 105,
+ 148, 238, 87, 239, 162, 120,
+ 35, 255, 1, 0, 0, 0,
+ 76, 12, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 116, 4, 0, 0, 20, 5,
+ 0, 0, 104, 5, 0, 0,
+ 176, 11, 0, 0, 82, 68,
+ 69, 70, 56, 4, 0, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 4, 4, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 99, 111, 110, 115,
+ 116, 66, 117, 102, 0, 171,
+ 171, 171, 92, 0, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 192, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 0, 0, 0,
+ 0, 0, 0, 0, 192, 2,
+ 0, 0, 2, 0, 0, 0,
+ 224, 3, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 103, 80, 97, 114, 97, 109,
+ 115, 0, 70, 108, 117, 105,
+ 100, 83, 104, 97, 100, 101,
+ 114, 67, 111, 110, 115, 116,
+ 0, 109, 111, 100, 101, 108,
+ 118, 105, 101, 119, 112, 114,
+ 111, 106, 101, 99, 116, 105,
+ 111, 110, 0, 102, 108, 111,
+ 97, 116, 52, 120, 52, 0,
+ 171, 171, 3, 0, 3, 0,
+ 4, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 213, 0,
+ 0, 0, 109, 111, 100, 101,
+ 108, 118, 105, 101, 119, 0,
+ 112, 114, 111, 106, 101, 99,
+ 116, 105, 111, 110, 0, 109,
+ 111, 100, 101, 108, 118, 105,
+ 101, 119, 95, 105, 110, 118,
+ 101, 114, 115, 101, 0, 112,
+ 114, 111, 106, 101, 99, 116,
+ 105, 111, 110, 95, 105, 110,
+ 118, 101, 114, 115, 101, 0,
+ 105, 110, 118, 84, 101, 120,
+ 83, 99, 97, 108, 101, 0,
+ 102, 108, 111, 97, 116, 52,
+ 0, 171, 171, 171, 1, 0,
+ 3, 0, 1, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 74, 1, 0, 0, 105, 110,
+ 118, 86, 105, 101, 119, 112,
+ 111, 114, 116, 0, 102, 108,
+ 111, 97, 116, 51, 0, 171,
+ 1, 0, 3, 0, 1, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 132, 1, 0, 0,
+ 95, 112, 97, 100, 48, 0,
+ 102, 108, 111, 97, 116, 0,
+ 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 182, 1, 0, 0,
+ 98, 108, 117, 114, 82, 97,
+ 100, 105, 117, 115, 87, 111,
+ 114, 108, 100, 0, 98, 108,
+ 117, 114, 83, 99, 97, 108,
+ 101, 0, 98, 108, 117, 114,
+ 70, 97, 108, 108, 111, 102,
+ 102, 0, 100, 101, 98, 117,
+ 103, 0, 105, 110, 116, 0,
+ 0, 0, 2, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 12, 2, 0, 0,
+ 108, 105, 103, 104, 116, 80,
+ 111, 115, 0, 95, 112, 97,
+ 100, 49, 0, 108, 105, 103,
+ 104, 116, 68, 105, 114, 0,
+ 95, 112, 97, 100, 50, 0,
+ 108, 105, 103, 104, 116, 84,
+ 114, 97, 110, 115, 102, 111,
+ 114, 109, 0, 99, 111, 108,
+ 111, 114, 0, 99, 108, 105,
+ 112, 80, 111, 115, 84, 111,
+ 69, 121, 101, 0, 115, 112,
+ 111, 116, 77, 105, 110, 0,
+ 115, 112, 111, 116, 77, 97,
+ 120, 0, 105, 111, 114, 0,
+ 95, 112, 97, 100, 51, 0,
+ 115, 104, 97, 100, 111, 119,
+ 84, 97, 112, 115, 0, 171,
+ 171, 171, 1, 0, 3, 0,
+ 1, 0, 4, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 74, 1,
+ 0, 0, 193, 0, 0, 0,
+ 224, 0, 0, 0, 0, 0,
+ 0, 0, 4, 1, 0, 0,
+ 224, 0, 0, 0, 64, 0,
+ 0, 0, 14, 1, 0, 0,
+ 224, 0, 0, 0, 128, 0,
+ 0, 0, 25, 1, 0, 0,
+ 224, 0, 0, 0, 192, 0,
+ 0, 0, 43, 1, 0, 0,
+ 224, 0, 0, 0, 0, 1,
+ 0, 0, 62, 1, 0, 0,
+ 84, 1, 0, 0, 64, 1,
+ 0, 0, 120, 1, 0, 0,
+ 140, 1, 0, 0, 80, 1,
+ 0, 0, 176, 1, 0, 0,
+ 188, 1, 0, 0, 92, 1,
+ 0, 0, 224, 1, 0, 0,
+ 188, 1, 0, 0, 96, 1,
+ 0, 0, 240, 1, 0, 0,
+ 188, 1, 0, 0, 100, 1,
+ 0, 0, 250, 1, 0, 0,
+ 188, 1, 0, 0, 104, 1,
+ 0, 0, 6, 2, 0, 0,
+ 16, 2, 0, 0, 108, 1,
+ 0, 0, 52, 2, 0, 0,
+ 140, 1, 0, 0, 112, 1,
+ 0, 0, 61, 2, 0, 0,
+ 188, 1, 0, 0, 124, 1,
+ 0, 0, 67, 2, 0, 0,
+ 140, 1, 0, 0, 128, 1,
+ 0, 0, 76, 2, 0, 0,
+ 188, 1, 0, 0, 140, 1,
+ 0, 0, 82, 2, 0, 0,
+ 224, 0, 0, 0, 144, 1,
+ 0, 0, 97, 2, 0, 0,
+ 84, 1, 0, 0, 208, 1,
+ 0, 0, 103, 2, 0, 0,
+ 84, 1, 0, 0, 224, 1,
+ 0, 0, 116, 2, 0, 0,
+ 188, 1, 0, 0, 240, 1,
+ 0, 0, 124, 2, 0, 0,
+ 188, 1, 0, 0, 244, 1,
+ 0, 0, 132, 2, 0, 0,
+ 188, 1, 0, 0, 248, 1,
+ 0, 0, 136, 2, 0, 0,
+ 188, 1, 0, 0, 252, 1,
+ 0, 0, 142, 2, 0, 0,
+ 156, 2, 0, 0, 0, 2,
+ 0, 0, 5, 0, 0, 0,
+ 1, 0, 176, 0, 0, 0,
+ 24, 0, 192, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 176, 0,
+ 0, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32,
+ 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114,
+ 32, 54, 46, 51, 46, 57,
+ 54, 48, 48, 46, 49, 54,
+ 51, 56, 52, 0, 171, 171,
+ 73, 83, 71, 78, 152, 0,
+ 0, 0, 5, 0, 0, 0,
+ 8, 0, 0, 0, 128, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 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1, 64,
+ 0, 0, 255, 255, 255, 255,
+ 54, 0, 0, 8, 242, 32,
+ 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 4,
+ 1, 192, 0, 0, 1, 64,
+ 0, 0, 0, 0, 128, 63,
+ 62, 0, 0, 1, 83, 84,
+ 65, 84, 148, 0, 0, 0,
+ 51, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 7, 0, 0, 0, 35, 0,
+ 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl b/demo/d3d11/shaders/ellipsoidDepthVS.hlsl
new file mode 100644
index 0000000..03ef001
--- /dev/null
+++ b/demo/d3d11/shaders/ellipsoidDepthVS.hlsl
@@ -0,0 +1,195 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ FluidShaderConst gParams;
+};
+
+// returns 1.0 for x==0.0 (unlike glsl)
+float Sign(float x) { return x < 0.0 ? -1.0 : 1.0; }
+
+bool solveQuadratic(float a, float b, float c, out float minT, out float maxT)
+{
+#if 0
+ // for debugging
+ minT = -0.5;
+ maxT = 0.5;
+ return true;
+#else
+ //minT = 0.0f;
+ //maxT = 0.0f;
+#endif
+
+ if (a == 0.0 && b == 0.0)
+ {
+ minT = maxT = 0.0;
+ return false;
+ }
+
+ float discriminant = b*b - 4.0*a*c;
+
+ if (discriminant < 0.0)
+ {
+ return false;
+ }
+
+ float t = -0.5*(b + Sign(b)*sqrt(discriminant));
+ minT = t / a;
+ maxT = c / t;
+
+ if (minT > maxT)
+ {
+ float tmp = minT;
+ minT = maxT;
+ maxT = tmp;
+ }
+
+ return true;
+}
+
+float DotInvW(float4 a, float4 b) { return a.x*b.x + a.y*b.y + a.z*b.z - a.w*b.w; }
+
+FluidVertexOut ellipsoidDepthVS(FluidVertexIn input, uint instance : SV_VertexID)
+{
+ float4 gl_Position;
+ float4 gl_TexCoord[6];
+
+ const float4 gl_Vertex = input.position;
+ const float4 q1 = input.q1;
+ const float4 q2 = input.q2;
+ const float4 q3 = input.q3;
+
+ const float4x4 gl_ModelViewProjectionMatrix = gParams.modelviewprojection;
+ const float4x4 gl_ModelViewMatrixInverse = gParams.modelview_inverse;
+
+ float3 worldPos = gl_Vertex.xyz;
+
+ // construct quadric matrix
+ float4x4 q;
+ q._m00_m10_m20_m30 = float4(q1.xyz*q1.w, 0.0);
+ q._m01_m11_m21_m31 = float4(q2.xyz*q2.w, 0.0);
+ q._m02_m12_m22_m32 = float4(q3.xyz*q3.w, 0.0);
+ q._m03_m13_m23_m33 = float4(worldPos, 1.0);
+
+ // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T)
+ float4x4 invClip = /*transpose*/(mul(gl_ModelViewProjectionMatrix, q));
+
+ // solve for the right hand bounds in homogenous clip space
+ float a1 = DotInvW(invClip[3], invClip[3]);
+ float b1 = -2.0f*DotInvW(invClip[0], invClip[3]);
+ float c1 = DotInvW(invClip[0], invClip[0]);
+
+ float xmin;
+ float xmax;
+ solveQuadratic(a1, b1, c1, xmin, xmax);
+
+ // solve for the right hand bounds in homogenous clip space
+ float a2 = DotInvW(invClip[3], invClip[3]);
+ float b2 = -2.0f*DotInvW(invClip[1], invClip[3]);
+ float c2 = DotInvW(invClip[1], invClip[1]);
+
+ float ymin;
+ float ymax;
+ solveQuadratic(a2, b2, c2, ymin, ymax);
+
+ gl_Position = float4(worldPos.xyz, 1.0);
+ gl_TexCoord[0] = float4(xmin, xmax, ymin, ymax);
+
+ // construct inverse quadric matrix (used for ray-casting in parameter space)
+ float4x4 invq;
+ invq._m00_m10_m20_m30 = float4(q1.xyz / q1.w, 0.0);
+ invq._m01_m11_m21_m31 = float4(q2.xyz / q2.w, 0.0);
+ invq._m02_m12_m22_m32 = float4(q3.xyz / q3.w, 0.0);
+ invq._m03_m13_m23_m33 = float4(0.0, 0.0, 0.0, 1.0);
+
+ invq = transpose(invq);
+ invq._m03_m13_m23_m33 = -(mul(invq, gl_Position));
+
+ // transform a point from view space to parameter space
+ invq = mul(invq, gl_ModelViewMatrixInverse);
+
+ // pass down
+ gl_TexCoord[1] = invq._m00_m10_m20_m30;
+ gl_TexCoord[2] = invq._m01_m11_m21_m31;
+ gl_TexCoord[3] = invq._m02_m12_m22_m32;
+ gl_TexCoord[4] = invq._m03_m13_m23_m33;
+
+ // compute ndc pos for frustrum culling in GS
+ float4 ndcPos = mul(gl_ModelViewProjectionMatrix, float4(worldPos.xyz, 1.0));
+ gl_TexCoord[5].xyz = ndcPos.xyz / ndcPos.w;
+ gl_TexCoord[5].w = ndcPos.w;
+
+ FluidVertexOut output;
+ output.position = gl_Position;
+ [unroll]
+ for (int j = 0; j < 6; j++)
+ output.texCoord[j] = gl_TexCoord[j];
+
+ return output;
+
+ /*
+ // rotation matrix in xyz, scale in w
+ attribute vec4 q1;
+ attribute vec4 q2;
+ attribute vec4 q3;
+
+ void main()
+ {
+ vec3 worldPos = gl_Vertex.xyz;// - vec3(0.0, 0.1*0.25, 0.0); // hack move towards ground to account for anisotropy
+
+ // construct quadric matrix
+ mat4 q;
+ q[0] = vec4(q1.xyz*q1.w, 0.0);
+ q[1] = vec4(q2.xyz*q2.w, 0.0);
+ q[2] = vec4(q3.xyz*q3.w, 0.0);
+ q[3] = vec4(worldPos, 1.0);
+
+ // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T)
+ mat4 invClip = transpose(gl_ModelViewProjectionMatrix*q);
+
+ // solve for the right hand bounds in homogenous clip space
+ float a1 = DotInvW(invClip[3], invClip[3]);
+ float b1 = -2.0f*DotInvW(invClip[0], invClip[3]);
+ float c1 = DotInvW(invClip[0], invClip[0]);
+
+ float xmin;
+ float xmax;
+ solveQuadratic(a1, b1, c1, xmin, xmax);
+
+ // solve for the right hand bounds in homogenous clip space
+ float a2 = DotInvW(invClip[3], invClip[3]);
+ float b2 = -2.0f*DotInvW(invClip[1], invClip[3]);
+ float c2 = DotInvW(invClip[1], invClip[1]);
+
+ float ymin;
+ float ymax;
+ solveQuadratic(a2, b2, c2, ymin, ymax);
+
+ gl_Position = vec4(worldPos.xyz, 1.0);
+ gl_TexCoord[0] = vec4(xmin, xmax, ymin, ymax);
+
+ // construct inverse quadric matrix (used for ray-casting in parameter space)
+ mat4 invq;
+ invq[0] = vec4(q1.xyz / q1.w, 0.0);
+ invq[1] = vec4(q2.xyz / q2.w, 0.0);
+ invq[2] = vec4(q3.xyz / q3.w, 0.0);
+ invq[3] = vec4(0.0, 0.0, 0.0, 1.0);
+
+ invq = transpose(invq);
+ invq[3] = -(invq*gl_Position);
+
+ // transform a point from view space to parameter space
+ invq = invq*gl_ModelViewMatrixInverse;
+
+ // pass down
+ gl_TexCoord[1] = invq[0];
+ gl_TexCoord[2] = invq[1];
+ gl_TexCoord[3] = invq[2];
+ gl_TexCoord[4] = invq[3];
+
+ // compute ndc pos for frustrum culling in GS
+ vec4 ndcPos = gl_ModelViewProjectionMatrix * vec4(worldPos.xyz, 1.0);
+ gl_TexCoord[5] = ndcPos / ndcPos.w;
+ }
+ */
+}
diff --git a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h b/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h
new file mode 100644
index 0000000..d1dd741
--- /dev/null
+++ b/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h
@@ -0,0 +1,940 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct FluidShaderConst
+// {
+//
+// float4x4 modelviewprojection; // Offset: 0
+// float4x4 modelview; // Offset: 64
+// float4x4 projection; // Offset: 128
+// float4x4 modelview_inverse; // Offset: 192
+// float4x4 projection_inverse; // Offset: 256
+// float4 invTexScale; // Offset: 320
+// float3 invViewport; // Offset: 336
+// float _pad0; // Offset: 348
+// float blurRadiusWorld; // Offset: 352
+// float blurScale; // Offset: 356
+// float blurFalloff; // Offset: 360
+// int debug; // Offset: 364
+// float3 lightPos; // Offset: 368
+// float _pad1; // Offset: 380
+// float3 lightDir; // Offset: 384
+// float _pad2; // Offset: 396
+// float4x4 lightTransform; // Offset: 400
+// float4 color; // Offset: 464
+// float4 clipPosToEye; // Offset: 480
+// float spotMin; // Offset: 496
+// float spotMax; // Offset: 500
+// float ior; // Offset: 504
+// float _pad3; // Offset: 508
+// float4 shadowTaps[12]; // Offset: 512
+//
+// } gParams; // Offset: 0 Size: 704
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyz
+// U 0 xyzw 1 NONE float xyzw
+// V 0 xyzw 2 NONE float xyzw
+// W 0 xyzw 3 NONE float xyzw
+// SV_VertexID 0 x 4 VERTID uint
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyzw
+// TEXCOORD 0 xyzw 1 NONE float xyzw
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float xyzw
+// TEXCOORD 3 xyzw 4 NONE float xyzw
+// TEXCOORD 4 xyzw 5 NONE float xyzw
+// TEXCOORD 5 xyzw 6 NONE float xyzw
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[16], immediateIndexed
+dcl_input v0.xyz
+dcl_input v1.xyzw
+dcl_input v2.xyzw
+dcl_input v3.xyzw
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_temps 4
+mov o0.xyz, v0.xyzx
+mov o0.w, l(1.000000)
+mul r0.xyz, v2.wwww, v2.xyzx
+mul r1.xyzw, r0.yyyy, cb0[1].wxxy
+mad r1.xyzw, cb0[0].wxxy, r0.xxxx, r1.xyzw
+mad r0.xyzw, cb0[2].wxxy, r0.zzzz, r1.xyzw
+mul r1.x, r0.w, r0.w
+mul r0.xyzw, r0.xxzx, r0.xyzw
+mul r1.yzw, v1.wwww, v1.xxyz
+mul r2.xyzw, r1.zzzz, cb0[1].wxxy
+mad r2.xyzw, cb0[0].wxxy, r1.yyyy, r2.xyzw
+mad r2.xyzw, cb0[2].wxxy, r1.wwww, r2.xyzw
+mad r1.x, r2.w, r2.w, r1.x
+mad r0.xyzw, r2.xyzw, r2.xxzx, r0.xyzw
+mul r1.yzw, v3.wwww, v3.xxyz
+mul r2.xyzw, r1.zzzz, cb0[1].wxxy
+mad r2.xyzw, cb0[0].wxxy, r1.yyyy, r2.xyzw
+mad r2.xyzw, cb0[2].wxxy, r1.wwww, r2.xyzw
+mad r1.x, r2.w, r2.w, r1.x
+mad r0.xyzw, r2.xyzw, r2.xxzx, r0.xyzw
+mul r2.xyzw, v0.yyyy, cb0[1].wxxy
+mad r2.xyzw, cb0[0].wxxy, v0.xxxx, r2.xyzw
+mad r2.xyzw, cb0[2].wxxy, v0.zzzz, r2.xyzw
+add r2.xyzw, r2.xyzw, cb0[3].wxxy
+mad r1.x, -r2.w, r2.w, r1.x
+mad r0.xyzw, -r2.xyzw, r2.xxzx, r0.xyzw
+mul r1.yzw, r0.yyxw, l(0.000000, -2.000000, 4.000000, -2.000000)
+mul r2.xy, r1.ywyy, r1.ywyy
+mad r2.y, -r1.z, r1.x, r2.y
+mad r1.z, -r1.z, r0.z, r2.x
+sqrt r2.x, r2.y
+ge r2.y, r2.y, l(0.000000)
+lt r2.zw, l(0.000000, 0.000000, -0.000000, -0.000000), r0.yyyw
+movc r2.zw, r2.zzzw, l(0,0,-1.000000,-1.000000), l(0,0,1.000000,1.000000)
+mad r1.w, r2.w, r2.x, r1.w
+mul r1.w, r1.w, l(-0.500000)
+div r3.w, r1.w, r0.x
+div r3.z, r1.x, r1.w
+lt r1.x, r3.z, r3.w
+movc r1.xw, r1.xxxx, r3.zzzw, r3.wwwz
+and r1.xw, r1.xxxw, r2.yyyy
+eq r2.xyw, r0.xyxw, l(0.000000, -0.000000, 0.000000, -0.000000)
+and r0.yw, r2.yyyw, r2.xxxx
+movc o1.zw, r0.wwww, l(0,0,0,0), r1.xxxw
+sqrt r0.w, r1.z
+ge r1.x, r1.z, l(0.000000)
+mad r0.w, r2.z, r0.w, r1.y
+mul r0.w, r0.w, l(-0.500000)
+div r2.xy, r0.zwzz, r0.wxww
+lt r0.x, r2.x, r2.y
+movc r0.xz, r0.xxxx, r2.xxyx, r2.yyxy
+and r0.xz, r0.xxzx, r1.xxxx
+movc o1.xy, r0.yyyy, l(0,0,0,0), r0.xzxx
+mov o2.w, -cb0[12].w
+div r0.xyz, v1.xyzx, v1.wwww
+dp3 r0.w, r0.xyzx, v0.xyzx
+mov r0.w, -r0.w
+dp4 o2.x, r0.xyzw, cb0[12].xyzw
+div r1.xyz, v2.xyzx, v2.wwww
+dp3 r1.w, r1.xyzx, v0.xyzx
+mov r1.w, -r1.w
+dp4 o2.y, r1.xyzw, cb0[12].xyzw
+div r2.xyz, v3.xyzx, v3.wwww
+dp3 r2.w, r2.xyzx, v0.xyzx
+mov r2.w, -r2.w
+dp4 o2.z, r2.xyzw, cb0[12].xyzw
+mov o3.w, -cb0[13].w
+dp4 o3.x, r0.xyzw, cb0[13].xyzw
+dp4 o3.y, r1.xyzw, cb0[13].xyzw
+dp4 o3.z, r2.xyzw, cb0[13].xyzw
+dp4 o4.x, r0.xyzw, cb0[14].xyzw
+dp4 o5.x, r0.xyzw, cb0[15].xyzw
+dp4 o4.y, r1.xyzw, cb0[14].xyzw
+dp4 o5.y, r1.xyzw, cb0[15].xyzw
+dp4 o4.z, r2.xyzw, cb0[14].xyzw
+dp4 o5.z, r2.xyzw, cb0[15].xyzw
+mov o4.w, -cb0[14].w
+mov o5.w, -cb0[15].w
+mul r0.xyzw, v0.yyyy, cb0[1].xyzw
+mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw
+mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
+add r0.xyzw, r0.xyzw, cb0[3].xyzw
+div o6.xyz, r0.xyzx, r0.wwww
+mov o6.w, r0.w
+ret
+// Approximately 85 instruction slots used
+#endif
+
+const BYTE g_ellipsoidDepthVS[] =
+{
+ 68, 88, 66, 67, 1, 86,
+ 214, 204, 57, 184, 18, 6,
+ 20, 42, 129, 16, 226, 241,
+ 71, 198, 1, 0, 0, 0,
+ 208, 17, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 116, 4, 0, 0, 24, 5,
+ 0, 0, 228, 5, 0, 0,
+ 52, 17, 0, 0, 82, 68,
+ 69, 70, 56, 4, 0, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 4, 4, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 99, 111, 110, 115,
+ 116, 66, 117, 102, 0, 171,
+ 171, 171, 92, 0, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 192, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 0, 0, 0,
+ 0, 0, 0, 0, 192, 2,
+ 0, 0, 2, 0, 0, 0,
+ 224, 3, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 103, 80, 97, 114, 97, 109,
+ 115, 0, 70, 108, 117, 105,
+ 100, 83, 104, 97, 100, 101,
+ 114, 67, 111, 110, 115, 116,
+ 0, 109, 111, 100, 101, 108,
+ 118, 105, 101, 119, 112, 114,
+ 111, 106, 101, 99, 116, 105,
+ 111, 110, 0, 102, 108, 111,
+ 97, 116, 52, 120, 52, 0,
+ 171, 171, 3, 0, 3, 0,
+ 4, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 213, 0,
+ 0, 0, 109, 111, 100, 101,
+ 108, 118, 105, 101, 119, 0,
+ 112, 114, 111, 106, 101, 99,
+ 116, 105, 111, 110, 0, 109,
+ 111, 100, 101, 108, 118, 105,
+ 101, 119, 95, 105, 110, 118,
+ 101, 114, 115, 101, 0, 112,
+ 114, 111, 106, 101, 99, 116,
+ 105, 111, 110, 95, 105, 110,
+ 118, 101, 114, 115, 101, 0,
+ 105, 110, 118, 84, 101, 120,
+ 83, 99, 97, 108, 101, 0,
+ 102, 108, 111, 97, 116, 52,
+ 0, 171, 171, 171, 1, 0,
+ 3, 0, 1, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 74, 1, 0, 0, 105, 110,
+ 118, 86, 105, 101, 119, 112,
+ 111, 114, 116, 0, 102, 108,
+ 111, 97, 116, 51, 0, 171,
+ 1, 0, 3, 0, 1, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 132, 1, 0, 0,
+ 95, 112, 97, 100, 48, 0,
+ 102, 108, 111, 97, 116, 0,
+ 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 182, 1, 0, 0,
+ 98, 108, 117, 114, 82, 97,
+ 100, 105, 117, 115, 87, 111,
+ 114, 108, 100, 0, 98, 108,
+ 117, 114, 83, 99, 97, 108,
+ 101, 0, 98, 108, 117, 114,
+ 70, 97, 108, 108, 111, 102,
+ 102, 0, 100, 101, 98, 117,
+ 103, 0, 105, 110, 116, 0,
+ 0, 0, 2, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 12, 2, 0, 0,
+ 108, 105, 103, 104, 116, 80,
+ 111, 115, 0, 95, 112, 97,
+ 100, 49, 0, 108, 105, 103,
+ 104, 116, 68, 105, 114, 0,
+ 95, 112, 97, 100, 50, 0,
+ 108, 105, 103, 104, 116, 84,
+ 114, 97, 110, 115, 102, 111,
+ 114, 109, 0, 99, 111, 108,
+ 111, 114, 0, 99, 108, 105,
+ 112, 80, 111, 115, 84, 111,
+ 69, 121, 101, 0, 115, 112,
+ 111, 116, 77, 105, 110, 0,
+ 115, 112, 111, 116, 77, 97,
+ 120, 0, 105, 111, 114, 0,
+ 95, 112, 97, 100, 51, 0,
+ 115, 104, 97, 100, 111, 119,
+ 84, 97, 112, 115, 0, 171,
+ 171, 171, 1, 0, 3, 0,
+ 1, 0, 4, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 74, 1,
+ 0, 0, 193, 0, 0, 0,
+ 224, 0, 0, 0, 0, 0,
+ 0, 0, 4, 1, 0, 0,
+ 224, 0, 0, 0, 64, 0,
+ 0, 0, 14, 1, 0, 0,
+ 224, 0, 0, 0, 128, 0,
+ 0, 0, 25, 1, 0, 0,
+ 224, 0, 0, 0, 192, 0,
+ 0, 0, 43, 1, 0, 0,
+ 224, 0, 0, 0, 0, 1,
+ 0, 0, 62, 1, 0, 0,
+ 84, 1, 0, 0, 64, 1,
+ 0, 0, 120, 1, 0, 0,
+ 140, 1, 0, 0, 80, 1,
+ 0, 0, 176, 1, 0, 0,
+ 188, 1, 0, 0, 92, 1,
+ 0, 0, 224, 1, 0, 0,
+ 188, 1, 0, 0, 96, 1,
+ 0, 0, 240, 1, 0, 0,
+ 188, 1, 0, 0, 100, 1,
+ 0, 0, 250, 1, 0, 0,
+ 188, 1, 0, 0, 104, 1,
+ 0, 0, 6, 2, 0, 0,
+ 16, 2, 0, 0, 108, 1,
+ 0, 0, 52, 2, 0, 0,
+ 140, 1, 0, 0, 112, 1,
+ 0, 0, 61, 2, 0, 0,
+ 188, 1, 0, 0, 124, 1,
+ 0, 0, 67, 2, 0, 0,
+ 140, 1, 0, 0, 128, 1,
+ 0, 0, 76, 2, 0, 0,
+ 188, 1, 0, 0, 140, 1,
+ 0, 0, 82, 2, 0, 0,
+ 224, 0, 0, 0, 144, 1,
+ 0, 0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, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 5, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/imguiPS.hlsl b/demo/d3d11/shaders/imguiPS.hlsl
new file mode 100644
index 0000000..f51a21b
--- /dev/null
+++ b/demo/d3d11/shaders/imguiPS.hlsl
@@ -0,0 +1,22 @@
+
+struct Input
+{
+ float4 position : SV_POSITION;
+ float2 texCoord : TEXCOORD;
+ float4 color : COLOR;
+};
+
+Texture2D<float> tex : register(t0);
+SamplerState texSampler : register(s0);
+
+float4 imguiPS(Input input) : SV_TARGET
+{
+ float4 color = input.color;
+
+ if (input.texCoord.x >= 0.f)
+ {
+ color.a *= tex.SampleLevel(texSampler, input.texCoord, 0.f);
+ }
+
+ return color;
+} \ No newline at end of file
diff --git a/demo/d3d11/shaders/imguiPS.hlsl.h b/demo/d3d11/shaders/imguiPS.hlsl.h
new file mode 100644
index 0000000..92aa84a
--- /dev/null
+++ b/demo/d3d11/shaders/imguiPS.hlsl.h
@@ -0,0 +1,197 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// texSampler sampler NA NA 0 1
+// tex texture float 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+// COLOR 0 xyzw 2 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_input_ps linear v2.xyzw
+dcl_output o0.xyzw
+dcl_temps 1
+ge r0.x, v1.x, l(0.000000)
+if_nz r0.x
+ sample_l_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t0.xyzw, s0, l(0.000000)
+ mul r0.x, r0.x, v2.w
+else
+ mov r0.x, v2.w
+endif
+mov r0.yzw, v2.xxyz
+mov o0.xyzw, r0.yzwx
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_imguiPS[] =
+{
+ 68, 88, 66, 67, 214, 230,
+ 179, 60, 250, 108, 227, 78,
+ 125, 188, 145, 68, 25, 248,
+ 141, 62, 1, 0, 0, 0,
+ 92, 3, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 252, 0, 0, 0, 112, 1,
+ 0, 0, 164, 1, 0, 0,
+ 192, 2, 0, 0, 82, 68,
+ 69, 70, 192, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 139, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 124, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 135, 0, 0, 0,
+ 2, 0, 0, 0, 5, 0,
+ 0, 0, 4, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 116, 101,
+ 120, 83, 97, 109, 112, 108,
+ 101, 114, 0, 116, 101, 120,
+ 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40,
+ 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32,
+ 54, 46, 51, 46, 57, 54,
+ 48, 48, 46, 49, 54, 51,
+ 56, 52, 0, 171, 171, 171,
+ 73, 83, 71, 78, 108, 0,
+ 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0,
+ 3, 3, 0, 0, 101, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0,
+ 15, 15, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 84, 69,
+ 88, 67, 79, 79, 82, 68,
+ 0, 67, 79, 76, 79, 82,
+ 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 69, 88, 20, 1,
+ 0, 0, 80, 0, 0, 0,
+ 69, 0, 0, 0, 106, 8,
+ 0, 1, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0,
+ 0, 0, 88, 24, 0, 4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 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/demo/d3d11/shaders/imguiVS.hlsl b/demo/d3d11/shaders/imguiVS.hlsl
new file mode 100644
index 0000000..6116ee1
--- /dev/null
+++ b/demo/d3d11/shaders/imguiVS.hlsl
@@ -0,0 +1,31 @@
+
+cbuffer params : register(b0)
+{
+ float4x4 transform;
+};
+
+struct Input
+{
+ float2 position : POSITION;
+ float2 texCoord : TEXCOORD;
+ float4 color : COLOR;
+};
+
+struct Output
+{
+ float4 position : SV_POSITION;
+ float2 texCoord : TEXCOORD;
+ float4 color : COLOR;
+};
+
+Output imguiVS(Input input, uint instance : SV_InstanceID)
+{
+ Output output;
+
+ output.position = mul(float4(input.position, 0.f, 1.f), transform);
+
+ output.texCoord = input.texCoord.xy; // float2(input.texCoord.x, 1.f - input.texCoord.y);
+ output.color = input.color;
+
+ return output;
+} \ No newline at end of file
diff --git a/demo/d3d11/shaders/imguiVS.hlsl.h b/demo/d3d11/shaders/imguiVS.hlsl.h
new file mode 100644
index 0000000..7249cec
--- /dev/null
+++ b/demo/d3d11/shaders/imguiVS.hlsl.h
@@ -0,0 +1,248 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer params
+// {
+//
+// float4x4 transform; // Offset: 0 Size: 64
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// params cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xy 0 NONE float xy
+// TEXCOORD 0 xy 1 NONE float xy
+// COLOR 0 xyzw 2 NONE float xyzw
+// SV_InstanceID 0 x 3 INSTID uint
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xy 1 NONE float xy
+// COLOR 0 xyzw 2 NONE float xyzw
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[4], immediateIndexed
+dcl_input v0.xy
+dcl_input v1.xy
+dcl_input v2.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xy
+dcl_output o2.xyzw
+dcl_temps 1
+mov r0.xy, v0.xyxx
+mov r0.z, l(1.000000)
+dp3 o0.x, r0.xyzx, cb0[0].xywx
+dp3 o0.y, r0.xyzx, cb0[1].xywx
+dp3 o0.z, r0.xyzx, cb0[2].xywx
+dp3 o0.w, r0.xyzx, cb0[3].xywx
+mov o1.xy, v1.xyxx
+mov o2.xyzw, v2.xyzw
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_imguiVS[] =
+{
+ 68, 88, 66, 67, 11, 92,
+ 70, 30, 32, 80, 66, 187,
+ 246, 56, 106, 189, 128, 201,
+ 215, 197, 1, 0, 0, 0,
+ 64, 4, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 76, 1, 0, 0, 228, 1,
+ 0, 0, 88, 2, 0, 0,
+ 164, 3, 0, 0, 82, 68,
+ 69, 70, 16, 1, 0, 0,
+ 1, 0, 0, 0, 100, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 220, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 112, 97, 114, 97,
+ 109, 115, 0, 171, 92, 0,
+ 0, 0, 1, 0, 0, 0,
+ 124, 0, 0, 0, 64, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 164, 0,
+ 0, 0, 0, 0, 0, 0,
+ 64, 0, 0, 0, 2, 0,
+ 0, 0, 184, 0, 0, 0,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 116, 114, 97, 110,
+ 115, 102, 111, 114, 109, 0,
+ 102, 108, 111, 97, 116, 52,
+ 120, 52, 0, 171, 3, 0,
+ 3, 0, 4, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 174, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 54, 46, 51,
+ 46, 57, 54, 48, 48, 46,
+ 49, 54, 51, 56, 52, 0,
+ 171, 171, 73, 83, 71, 78,
+ 144, 0, 0, 0, 4, 0,
+ 0, 0, 8, 0, 0, 0,
+ 104, 0, 0, 0, 0, 0,
+ 0, 0, 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
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 6, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/demo/d3d11/shaders/meshPS.hlsl b/demo/d3d11/shaders/meshPS.hlsl
new file mode 100644
index 0000000..db28d60
--- /dev/null
+++ b/demo/d3d11/shaders/meshPS.hlsl
@@ -0,0 +1,130 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ MeshShaderConst gParams;
+};
+
+Texture2D<float> shadowTexture : register(t0); // shadow map
+
+SamplerComparisonState shadowSampler : register(s0); // texture sample used to sample depth from shadow texture in this sample
+
+// sample shadow map
+float shadowSample(float4 gl_TexCoord[8])
+{
+ float3 pos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w);
+ float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0);
+
+ // user clip
+ if (uvw.x < 0.0 || uvw.x > 1.0)
+ return 1.0;
+ if (uvw.y < 0.0 || uvw.y > 1.0)
+ return 1.0;
+
+ float s = 0.0;
+ float radius = 0.002;
+
+ const int numTaps = 12;
+
+ // flip uv y-coordinate
+ uvw.y = 1.0f - uvw.y;
+
+ [unroll]
+ for (int i = 0; i < numTaps; i++)
+ {
+ float2 shadowTaps = gParams.shadowTaps[i].xy;
+ shadowTaps.y = 1.0f - shadowTaps.y;
+ s += shadowTexture.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z);
+ }
+ s /= numTaps;
+
+ return s;
+}
+
+float filterwidth(float2 v)
+{
+ float2 fw = max(abs(ddx(v)), abs(ddy(v)));
+ return max(fw.x, fw.y);
+}
+
+float2 bump(float2 x)
+{
+ return (floor((x) / 2) + 2.f * max(((x) / 2) - floor((x) / 2) - .5f, 0.f));
+}
+
+float checker(float2 uv)
+{
+ float width = filterwidth(uv);
+ float2 p0 = uv - 0.5 * width;
+ float2 p1 = uv + 0.5 * width;
+
+ float2 i = (bump(p1) - bump(p0)) / width;
+ return i.x * i.y + (1 - i.x) * (1 - i.y);
+}
+
+float4 meshPS(MeshVertexOut input, bool isFrontFace : SV_IsFrontFace) : SV_TARGET
+{
+ float4 gl_FragColor;
+ float4 gl_TexCoord[8];
+
+ [unroll]
+ for (int i = 0; i < 8; i++)
+ gl_TexCoord[i] = input.texCoord[i];
+
+ const float4 fogColor = gParams.fogColor;
+ const float3 lightDir = gParams.lightDir;
+ const float3 lightPos = gParams.lightPos;
+ const float spotMin = gParams.spotMin;
+ const float spotMax = gParams.spotMax;
+ const int grid = gParams.grid;
+ const int tex = gParams.tex;
+
+ // calculate lighting
+ float shadow = max(shadowSample(gl_TexCoord), 0.5);
+
+ float3 lVec = normalize(gl_TexCoord[3].xyz - (lightPos));
+ float3 lPos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w);
+ float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05);
+
+ float3 n = gl_TexCoord[0].xyz;
+ float3 color = gl_TexCoord[4].xyz;
+
+ if (!isFrontFace)
+ {
+ color = gl_TexCoord[6].xyz;
+ n *= -1.0f;
+ }
+
+ if (grid && (n.y > 0.995))
+ {
+ color *= 1.0 - 0.25 * checker(float2(gl_TexCoord[3].x, gl_TexCoord[3].z));
+ }
+ else if (grid && abs(n.z) > 0.995)
+ {
+ color *= 1.0 - 0.25 * checker(float2(gl_TexCoord[3].y, gl_TexCoord[3].x));
+ }
+
+ if (tex)
+ {
+ //color = texture2D(tex, gl_TexCoord[5].xy).xyz;
+ }
+
+ // direct light term
+ float wrap = 0.0;
+ float3 diffuse = color * float3(1.0, 1.0, 1.0) * max(0.0, (-dot(lightDir, n) + wrap) / (1.0 + wrap) * shadow) * attenuation;
+
+ // wrap ambient term aligned with light dir
+ float3 light = float3(0.03, 0.025, 0.025) * 1.5;
+ float3 dark = float3(0.025, 0.025, 0.03);
+ //float3 ambient = 4.0 * color * lerp(dark, light, -dot(lightDir, n) * 0.5 + 0.5) * attenuation;
+ float3 ambient = 4.0 * color * lerp(dark, light, -dot(lightDir, n) * float3(0.5, 0.5, 1.0) + float3(0.5, 0.5, 0.0)) * attenuation;
+
+ float3 fog = lerp(fogColor.xyz, diffuse + ambient, exp(gl_TexCoord[7].z * fogColor.w));
+
+ //gl_FragColor = float4(pow(fog, float3(1.0 / 2.2)), 1.0);
+ const float tmp = 1.0 / 2.2;
+ gl_FragColor = float4(pow(abs(fog), float3(tmp, tmp, tmp)), 1.0);
+
+ return gl_FragColor;
+
+}
diff --git a/demo/d3d11/shaders/meshPS.hlsl.h b/demo/d3d11/shaders/meshPS.hlsl.h
new file mode 100644
index 0000000..9bbb118
--- /dev/null
+++ b/demo/d3d11/shaders/meshPS.hlsl.h
@@ -0,0 +1,1553 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct MeshShaderConst
+// {
+//
+// float4x4 modelviewprojection; // Offset: 0
+// float4x4 modelview; // Offset: 64
+// float4x4 objectTransform; // Offset: 128
+// float4x4 lightTransform; // Offset: 192
+// float4 clipPlane; // Offset: 256
+// float4 fogColor; // Offset: 272
+// float4 color; // Offset: 288
+// float4 secondaryColor; // Offset: 304
+// float4 shadowTaps[12]; // Offset: 320
+// float3 lightPos; // Offset: 512
+// float _pad0; // Offset: 524
+// float3 lightDir; // Offset: 528
+// float _pad1; // Offset: 540
+// float bias; // Offset: 544
+// float expand; // Offset: 548
+// float spotMin; // Offset: 552
+// float spotMax; // Offset: 556
+// int grid; // Offset: 560
+// int tex; // Offset: 564
+// int colorArray; // Offset: 568
+// int _pad2; // Offset: 572
+//
+// } gParams; // Offset: 0 Size: 576
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// shadowSampler sampler_c NA NA 0 1
+// shadowTexture texture float 2d 0 1
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xyzw 1 NONE float xyz
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float
+// TEXCOORD 3 xyzw 4 NONE float xyz
+// TEXCOORD 4 xyzw 5 NONE float xyz
+// TEXCOORD 5 xyzw 6 NONE float
+// TEXCOORD 6 xyzw 7 NONE float xyz
+// TEXCOORD 7 xyzw 8 NONE float z
+// SV_IsFrontFace 0 x 9 FFACE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[36], immediateIndexed
+dcl_sampler s0, mode_comparison
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xyz
+dcl_input_ps linear v2.xyzw
+dcl_input_ps linear v4.xyz
+dcl_input_ps linear v5.xyz
+dcl_input_ps linear v7.xyz
+dcl_input_ps linear v8.z
+dcl_input_ps_sgv v9.x, is_front_face
+dcl_output o0.xyzw
+dcl_temps 6
+div r0.xyz, v2.xyzx, v2.wwww
+mad r1.xyz, r0.xyzx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
+lt r0.z, r1.x, l(0.000000)
+lt r0.w, l(1.000000), r1.x
+or r0.z, r0.w, r0.z
+if_z r0.z
+ lt r0.z, r1.y, l(0.000000)
+ lt r0.w, l(1.000000), r1.y
+ or r0.z, r0.w, r0.z
+ if_z r0.z
+ add r0.z, -cb0[20].y, l(1.000000)
+ mul r2.x, cb0[20].x, l(0.002000)
+ mul r2.y, r0.z, l(0.002000)
+ add r1.w, -r1.y, l(1.000000)
+ add r0.zw, r1.xxxw, r2.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t0.xxxx, s0, r1.z
+ add r0.w, -cb0[21].y, l(1.000000)
+ mul r2.x, cb0[21].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[22].y, l(1.000000)
+ mul r2.x, cb0[22].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[23].y, l(1.000000)
+ mul r2.x, cb0[23].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[24].y, l(1.000000)
+ mul r2.x, cb0[24].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[25].y, l(1.000000)
+ mul r2.x, cb0[25].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[26].y, l(1.000000)
+ mul r2.x, cb0[26].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[27].y, l(1.000000)
+ mul r2.x, cb0[27].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[28].y, l(1.000000)
+ mul r2.x, cb0[28].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[29].y, l(1.000000)
+ mul r2.x, cb0[29].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[30].y, l(1.000000)
+ mul r2.x, cb0[30].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r2.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ add r0.w, -cb0[31].y, l(1.000000)
+ mul r2.x, cb0[31].x, l(0.002000)
+ mul r2.y, r0.w, l(0.002000)
+ add r1.xy, r1.xwxx, r2.xyxx
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t0.xxxx, s0, r1.z
+ add r0.z, r0.w, r0.z
+ mul r0.z, r0.z, l(0.083333)
+ else
+ mov r0.z, l(1.000000)
+ endif
+else
+ mov r0.z, l(1.000000)
+endif
+dp2 r0.x, r0.xyxx, r0.xyxx
+add r0.y, -cb0[34].w, cb0[34].z
+add r0.x, r0.x, -cb0[34].w
+div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
+mul_sat r0.x, r0.y, r0.x
+mad r0.y, r0.x, l(-2.000000), l(3.000000)
+mul r0.x, r0.x, r0.x
+mul r0.x, r0.x, r0.y
+max r0.xz, r0.xxzx, l(0.050000, 0.000000, 0.500000, 0.000000)
+movc r1.xyz, v9.xxxx, v1.xyzx, -v1.xyzx
+movc r2.xyz, v9.xxxx, v5.xyzx, v7.xyzx
+ine r0.y, cb0[35].x, l(0)
+lt r0.w, l(0.995000), r1.y
+and r0.w, r0.w, r0.y
+if_nz r0.w
+ deriv_rtx_coarse r3.xy, v4.xzxx
+ deriv_rty_coarse r3.zw, v4.xxxz
+ max r3.xy, |r3.zwzz|, |r3.xyxx|
+ max r0.w, r3.y, r3.x
+ mad r3.xy, -r0.wwww, l(0.500000, 0.500000, 0.000000, 0.000000), v4.xzxx
+ mad r3.zw, r0.wwww, l(0.000000, 0.000000, 0.500000, 0.500000), v4.xxxz
+ mul r4.xy, r3.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000)
+ round_ni r4.xy, r4.xyxx
+ mad r3.zw, r3.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000), -r4.xxxy
+ add r3.zw, r3.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000)
+ max r3.zw, r3.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000)
+ mad r3.zw, r3.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), r4.xxxy
+ mul r4.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
+ round_ni r4.xy, r4.xyxx
+ mad r3.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), -r4.xyxx
+ add r3.xy, r3.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
+ max r3.xy, r3.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
+ mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r4.xyxx
+ add r3.xy, -r3.xyxx, r3.zwzz
+ div r3.xy, r3.xyxx, r0.wwww
+ add r3.zw, -r3.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000)
+ mul r0.w, r3.w, r3.z
+ mad r0.w, r3.x, r3.y, r0.w
+ mad r0.w, -r0.w, l(0.250000), l(1.000000)
+ mul r3.xyz, r0.wwww, r2.xyzx
+else
+ lt r0.w, l(0.995000), |r1.z|
+ and r0.y, r0.w, r0.y
+ deriv_rtx_coarse r4.xy, v4.yxyy
+ deriv_rty_coarse r4.zw, v4.yyyx
+ max r4.xy, |r4.zwzz|, |r4.xyxx|
+ max r0.w, r4.y, r4.x
+ mad r4.xy, -r0.wwww, l(0.500000, 0.500000, 0.000000, 0.000000), v4.yxyy
+ mad r4.zw, r0.wwww, l(0.000000, 0.000000, 0.500000, 0.500000), v4.yyyx
+ mul r5.xy, r4.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000)
+ round_ni r5.xy, r5.xyxx
+ mad r4.zw, r4.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000), -r5.xxxy
+ add r4.zw, r4.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000)
+ max r4.zw, r4.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000)
+ mad r4.zw, r4.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), r5.xxxy
+ mul r5.xy, r4.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
+ round_ni r5.xy, r5.xyxx
+ mad r4.xy, r4.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), -r5.xyxx
+ add r4.xy, r4.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
+ max r4.xy, r4.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
+ mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r5.xyxx
+ add r4.xy, -r4.xyxx, r4.zwzz
+ div r4.xy, r4.xyxx, r0.wwww
+ add r4.zw, -r4.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000)
+ mul r0.w, r4.w, r4.z
+ mad r0.w, r4.x, r4.y, r0.w
+ mad r0.w, -r0.w, l(0.250000), l(1.000000)
+ mul r4.xyz, r0.wwww, r2.xyzx
+ movc r3.xyz, r0.yyyy, r4.xyzx, r2.xyzx
+endif
+dp3 r0.y, cb0[33].xyzx, r1.xyzx
+mul r0.z, r0.z, -r0.y
+max r0.z, r0.z, l(0.000000)
+mul r1.xyz, r0.zzzz, r3.xyzx
+mul r2.xyz, r3.xyzx, l(4.000000, 4.000000, 4.000000, 0.000000)
+mad r0.yzw, r0.yyyy, l(0.000000, -0.500000, -0.500000, -1.000000), l(0.000000, 0.500000, 0.500000, 0.000000)
+mad r0.yzw, r0.yyzw, l(0.000000, 0.020000, 0.012500, 0.007500), l(0.000000, 0.025000, 0.025000, 0.030000)
+mul r0.yzw, r0.yyzw, r2.xxyz
+mul r0.yzw, r0.xxxx, r0.yyzw
+mad r0.xyz, r1.xyzx, r0.xxxx, r0.yzwy
+mul r0.w, v8.z, cb0[17].w
+mul r0.w, r0.w, l(1.442695)
+exp r0.w, r0.w
+add r0.xyz, r0.xyzx, -cb0[17].xyzx
+mad r0.xyz, r0.wwww, r0.xyzx, cb0[17].xyzx
+log r0.xyz, |r0.xyzx|
+mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000)
+exp o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 179 instruction slots used
+#endif
+
+const BYTE g_meshPS[] =
+{
+ 68, 88, 66, 67, 162, 143,
+ 63, 83, 112, 221, 166, 253,
+ 12, 109, 97, 84, 15, 129,
+ 226, 222, 1, 0, 0, 0,
+ 8, 30, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 116, 4, 0, 0, 152, 5,
+ 0, 0, 204, 5, 0, 0,
+ 108, 29, 0, 0, 82, 68,
+ 69, 70, 56, 4, 0, 0,
+ 1, 0, 0, 0, 196, 0,
+ 0, 0, 3, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 4, 4, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 156, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 170, 0, 0, 0,
+ 2, 0, 0, 0, 5, 0,
+ 0, 0, 4, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 184, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 115, 104, 97, 100, 111, 119,
+ 83, 97, 109, 112, 108, 101,
+ 114, 0, 115, 104, 97, 100,
+ 111, 119, 84, 101, 120, 116,
+ 117, 114, 101, 0, 99, 111,
+ 110, 115, 116, 66, 117, 102,
+ 0, 171, 171, 171, 184, 0,
+ 0, 0, 1, 0, 0, 0,
+ 220, 0, 0, 0, 64, 2,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 1,
+ 0, 0, 0, 0, 0, 0,
+ 64, 2, 0, 0, 2, 0,
+ 0, 0, 224, 3, 0, 0,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 103, 80, 97, 114,
+ 97, 109, 115, 0, 77, 101,
+ 115, 104, 83, 104, 97, 100,
+ 101, 114, 67, 111, 110, 115,
+ 116, 0, 109, 111, 100, 101,
+ 108, 118, 105, 101, 119, 112,
+ 114, 111, 106, 101, 99, 116,
+ 105, 111, 110, 0, 102, 108,
+ 111, 97, 116, 52, 120, 52,
+ 0, 171, 171, 171, 3, 0,
+ 3, 0, 4, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 48, 1, 0, 0, 109, 111,
+ 100, 101, 108, 118, 105, 101,
+ 119, 0, 111, 98, 106, 101,
+ 99, 116, 84, 114, 97, 110,
+ 115, 102, 111, 114, 109, 0,
+ 108, 105, 103, 104, 116, 84,
+ 114, 97, 110, 115, 102, 111,
+ 114, 109, 0, 99, 108, 105,
+ 112, 80, 108, 97, 110, 101,
+ 0, 102, 108, 111, 97, 116,
+ 52, 0, 171, 171, 1, 0,
+ 3, 0, 1, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 147, 1, 0, 0, 102, 111,
+ 103, 67, 111, 108, 111, 114,
+ 0, 99, 111, 108, 111, 114,
+ 0, 115, 101, 99, 111, 110,
+ 100, 97, 114, 121, 67, 111,
+ 108, 111, 114, 0, 115, 104,
+ 97, 100, 111, 119, 84, 97,
+ 112, 115, 0, 171, 171, 171,
+ 1, 0, 3, 0, 1, 0,
+ 4, 0, 12, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 147, 1, 0, 0,
+ 108, 105, 103, 104, 116, 80,
+ 111, 115, 0, 102, 108, 111,
+ 97, 116, 51, 0, 1, 0,
+ 3, 0, 1, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 25, 2, 0, 0, 95, 112,
+ 97, 100, 48, 0, 102, 108,
+ 111, 97, 116, 0, 0, 0,
+ 3, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 74, 2, 0, 0, 108, 105,
+ 103, 104, 116, 68, 105, 114,
+ 0, 95, 112, 97, 100, 49,
+ 0, 98, 105, 97, 115, 0,
+ 101, 120, 112, 97, 110, 100,
+ 0, 115, 112, 111, 116, 77,
+ 105, 110, 0, 115, 112, 111,
+ 116, 77, 97, 120, 0, 103,
+ 114, 105, 100, 0, 105, 110,
+ 116, 0, 0, 0, 2, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 164, 2,
+ 0, 0, 116, 101, 120, 0,
+ 99, 111, 108, 111, 114, 65,
+ 114, 114, 97, 121, 0, 95,
+ 112, 97, 100, 50, 0, 171,
+ 171, 171, 28, 1, 0, 0,
+ 60, 1, 0, 0, 0, 0,
+ 0, 0, 96, 1, 0, 0,
+ 60, 1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0,
+ 0, 0, 0, 0, 8, 0,
+ 0, 0, 146, 0, 0, 0,
+ 1, 0, 0, 0, 4, 0,
+ 0, 0, 4, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 12, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0,
+ 3, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/demo/d3d11/shaders/meshShadowPS.hlsl b/demo/d3d11/shaders/meshShadowPS.hlsl
new file mode 100644
index 0000000..cb60c22
--- /dev/null
+++ b/demo/d3d11/shaders/meshShadowPS.hlsl
@@ -0,0 +1,11 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ MeshShaderConst gParams;
+};
+
+float4 meshPS_Shadow(MeshVertexOut input) : SV_TARGET
+{
+ return float4(0.0, 0.0, 0.0, 1.0);
+}
diff --git a/demo/d3d11/shaders/meshShadowPS.hlsl.h b/demo/d3d11/shaders/meshShadowPS.hlsl.h
new file mode 100644
index 0000000..3794f61
--- /dev/null
+++ b/demo/d3d11/shaders/meshShadowPS.hlsl.h
@@ -0,0 +1,156 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xyzw 1 NONE float
+// TEXCOORD 1 xyzw 2 NONE float
+// TEXCOORD 2 xyzw 3 NONE float
+// TEXCOORD 3 xyzw 4 NONE float
+// TEXCOORD 4 xyzw 5 NONE float
+// TEXCOORD 5 xyzw 6 NONE float
+// TEXCOORD 6 xyzw 7 NONE float
+// TEXCOORD 7 xyzw 8 NONE float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_output o0.xyzw
+mov o0.xyzw, l(0,0,0,1.000000)
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_meshPS_Shadow[] =
+{
+ 68, 88, 66, 67, 106, 78,
+ 82, 142, 162, 137, 138, 82,
+ 3, 68, 165, 116, 56, 116,
+ 165, 11, 1, 0, 0, 0,
+ 192, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 172, 0, 0, 0, 172, 1,
+ 0, 0, 224, 1, 0, 0,
+ 36, 2, 0, 0, 82, 68,
+ 69, 70, 112, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 60, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 54,
+ 46, 51, 46, 57, 54, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52, 0, 171, 171, 73, 83,
+ 71, 78, 248, 0, 0, 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, 65, 82,
+ 71, 69, 84, 0, 171, 171,
+ 83, 72, 69, 88, 60, 0,
+ 0, 0, 80, 0, 0, 0,
+ 15, 0, 0, 0, 106, 8,
+ 0, 1, 101, 0, 0, 3,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 8,
+ 242, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 128, 63, 62, 0,
+ 0, 1, 83, 84, 65, 84,
+ 148, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/demo/d3d11/shaders/meshVS.hlsl b/demo/d3d11/shaders/meshVS.hlsl
new file mode 100644
index 0000000..09f78ec
--- /dev/null
+++ b/demo/d3d11/shaders/meshVS.hlsl
@@ -0,0 +1,91 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ MeshShaderConst gParams;
+};
+
+MeshVertexOut meshVS(MeshVertexIn input)
+{
+ float4 gl_Position;
+ float4 gl_TexCoord[8];
+
+ {
+ [unroll]
+ for (int i = 0; i < 8; i++)
+ gl_TexCoord[i] = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ }
+
+ const float4x4 gl_ModelViewProjectionMatrix = gParams.modelviewprojection;
+ const float4x4 gl_ModelViewMatrix = gParams.modelview;
+ const float4x4 objectTransform = gParams.objectTransform;
+ const float4x4 lightTransform = gParams.lightTransform;
+ const float3 lightDir = gParams.lightDir;
+ const float bias = gParams.bias;
+ const float4 clipPlane = gParams.clipPlane;
+ const float expand = gParams.expand;
+ const float4 gl_Color = gParams.color;
+ const float4 gl_SecondaryColor = gParams.secondaryColor;
+
+ const float3 gl_Vertex = input.position;
+ const float3 gl_Normal = input.normal;
+ const float2 gl_MultiTexCoord0 = input.texCoord;
+
+ float3 n = normalize(mul(objectTransform, float4(gl_Normal, 0.0)).xyz);
+ float3 p = mul(objectTransform, float4(gl_Vertex.xyz, 1.0)).xyz;
+
+ // calculate window-space point size
+ gl_Position = mul(gl_ModelViewProjectionMatrix, float4(p + expand * n, 1.0));
+
+ gl_TexCoord[0].xyz = n;
+ gl_TexCoord[1] = mul(lightTransform, float4(p + n * bias, 1.0));
+ gl_TexCoord[2] = mul(gl_ModelViewMatrix, float4(lightDir, 0.0));
+ gl_TexCoord[3].xyz = p;
+ if (gParams.colorArray)
+ gl_TexCoord[4] = input.color;
+ else
+ gl_TexCoord[4] = gl_Color;
+ gl_TexCoord[5].xy = gl_MultiTexCoord0;
+ gl_TexCoord[5].y = 1.0f - gl_TexCoord[5].y; // flip the y component of uv (glsl to hlsl conversion)
+ gl_TexCoord[6] = gl_SecondaryColor;
+ gl_TexCoord[7] = mul(gl_ModelViewMatrix, float4(gl_Vertex.xyz, 1.0));
+
+ MeshVertexOut output;
+ output.position = gl_Position;
+ {
+ [unroll]
+ for (int i = 0; i < 8; i++)
+ output.texCoord[i] = gl_TexCoord[i];
+ }
+
+ return output;
+
+ /*
+ uniform mat4 lightTransform;
+ uniform vec3 lightDir;
+ uniform float bias;
+ uniform vec4 clipPlane;
+ uniform float expand;
+
+ uniform mat4 objectTransform;
+
+ void main()
+ {
+ vec3 n = normalize((objectTransform*vec4(gl_Normal, 0.0)).xyz);
+ vec3 p = (objectTransform*vec4(gl_Vertex.xyz, 1.0)).xyz;
+
+ // calculate window-space point size
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(p + expand*n, 1.0);
+
+ gl_TexCoord[0].xyz = n;
+ gl_TexCoord[1] = lightTransform*vec4(p + n*bias, 1.0);
+ gl_TexCoord[2] = gl_ModelViewMatrix*vec4(lightDir, 0.0);
+ gl_TexCoord[3].xyz = p;
+ gl_TexCoord[4] = gl_Color;
+ gl_TexCoord[5] = gl_MultiTexCoord0;
+ gl_TexCoord[6] = gl_SecondaryColor;
+ gl_TexCoord[7] = gl_ModelViewMatrix*vec4(gl_Vertex.xyz, 1.0);
+
+ gl_ClipDistance[0] = dot(clipPlane, vec4(gl_Vertex.xyz, 1.0));
+ */
+}
diff --git a/demo/d3d11/shaders/meshVS.hlsl.h b/demo/d3d11/shaders/meshVS.hlsl.h
new file mode 100644
index 0000000..cc314af
--- /dev/null
+++ b/demo/d3d11/shaders/meshVS.hlsl.h
@@ -0,0 +1,635 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct MeshShaderConst
+// {
+//
+// float4x4 modelviewprojection; // Offset: 0
+// float4x4 modelview; // Offset: 64
+// float4x4 objectTransform; // Offset: 128
+// float4x4 lightTransform; // Offset: 192
+// float4 clipPlane; // Offset: 256
+// float4 fogColor; // Offset: 272
+// float4 color; // Offset: 288
+// float4 secondaryColor; // Offset: 304
+// float4 shadowTaps[12]; // Offset: 320
+// float3 lightPos; // Offset: 512
+// float _pad0; // Offset: 524
+// float3 lightDir; // Offset: 528
+// float _pad1; // Offset: 540
+// float bias; // Offset: 544
+// float expand; // Offset: 548
+// float spotMin; // Offset: 552
+// float spotMax; // Offset: 556
+// int grid; // Offset: 560
+// int tex; // Offset: 564
+// int colorArray; // Offset: 568
+// int _pad2; // Offset: 572
+//
+// } gParams; // Offset: 0 Size: 576
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyz 0 NONE float xyz
+// NORMAL 0 xyz 1 NONE float xyz
+// TEXCOORD 0 xy 2 NONE float xy
+// COLOR 0 xyzw 3 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xyzw 1 NONE float xyzw
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float xyzw
+// TEXCOORD 3 xyzw 4 NONE float xyzw
+// TEXCOORD 4 xyzw 5 NONE float xyzw
+// TEXCOORD 5 xyzw 6 NONE float xyzw
+// TEXCOORD 6 xyzw 7 NONE float xyzw
+// TEXCOORD 7 xyzw 8 NONE float xyzw
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[36], immediateIndexed
+dcl_input v0.xyz
+dcl_input v1.xyz
+dcl_input v2.xy
+dcl_input v3.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+dcl_output o8.xyzw
+dcl_temps 4
+mul r0.xyz, v1.yyyy, cb0[9].xyzx
+mad r0.xyz, cb0[8].xyzx, v1.xxxx, r0.xyzx
+mad r0.xyz, cb0[10].xyzx, v1.zzzz, r0.xyzx
+dp3 r0.w, r0.xyzx, r0.xyzx
+rsq r0.w, r0.w
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r1.xyz, v0.yyyy, cb0[9].xyzx
+mad r1.xyz, cb0[8].xyzx, v0.xxxx, r1.xyzx
+mad r1.xyz, cb0[10].xyzx, v0.zzzz, r1.xyzx
+add r1.xyz, r1.xyzx, cb0[11].xyzx
+mad r2.xyz, cb0[34].yyyy, r0.xyzx, r1.xyzx
+mul r3.xyzw, r2.yyyy, cb0[1].xyzw
+mad r3.xyzw, cb0[0].xyzw, r2.xxxx, r3.xyzw
+mad r2.xyzw, cb0[2].xyzw, r2.zzzz, r3.xyzw
+add o0.xyzw, r2.xyzw, cb0[3].xyzw
+mov o1.xyz, r0.xyzx
+mad r0.xyz, r0.xyzx, cb0[34].xxxx, r1.xyzx
+mov o4.xyz, r1.xyzx
+mov o1.w, l(0)
+mul r1.xyzw, r0.yyyy, cb0[13].xyzw
+mad r1.xyzw, cb0[12].xyzw, r0.xxxx, r1.xyzw
+mad r0.xyzw, cb0[14].xyzw, r0.zzzz, r1.xyzw
+add o2.xyzw, r0.xyzw, cb0[15].xyzw
+mul r0.xyzw, cb0[5].xyzw, cb0[33].yyyy
+mad r0.xyzw, cb0[4].xyzw, cb0[33].xxxx, r0.xyzw
+mad o3.xyzw, cb0[6].xyzw, cb0[33].zzzz, r0.xyzw
+mov o4.w, l(0)
+movc o5.xyzw, cb0[35].zzzz, v3.xyzw, cb0[18].xyzw
+mad o6.xy, v2.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000)
+mov o6.zw, l(0,0,0,0)
+mov o7.xyzw, cb0[19].xyzw
+mul r0.xyzw, v0.yyyy, cb0[5].xyzw
+mad r0.xyzw, cb0[4].xyzw, v0.xxxx, r0.xyzw
+mad r0.xyzw, cb0[6].xyzw, v0.zzzz, r0.xyzw
+add o8.xyzw, r0.xyzw, cb0[7].xyzw
+ret
+// Approximately 36 instruction slots used
+#endif
+
+const BYTE g_meshVS[] =
+{
+ 68, 88, 66, 67, 128, 165,
+ 34, 49, 122, 47, 91, 168,
+ 78, 217, 246, 213, 221, 36,
+ 22, 221, 1, 0, 0, 0,
+ 204, 11, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 24, 4, 0, 0, 168, 4,
+ 0, 0, 168, 5, 0, 0,
+ 48, 11, 0, 0, 82, 68,
+ 69, 70, 220, 3, 0, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 168, 3, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 99, 111, 110, 115,
+ 116, 66, 117, 102, 0, 171,
+ 171, 171, 92, 0, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 64, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 0, 0, 0,
+ 0, 0, 0, 0, 64, 2,
+ 0, 0, 2, 0, 0, 0,
+ 132, 3, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 103, 80, 97, 114, 97, 109,
+ 115, 0, 77, 101, 115, 104,
+ 83, 104, 97, 100, 101, 114,
+ 67, 111, 110, 115, 116, 0,
+ 109, 111, 100, 101, 108, 118,
+ 105, 101, 119, 112, 114, 111,
+ 106, 101, 99, 116, 105, 111,
+ 110, 0, 102, 108, 111, 97,
+ 116, 52, 120, 52, 0, 171,
+ 171, 171, 3, 0, 3, 0,
+ 4, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 212, 0,
+ 0, 0, 109, 111, 100, 101,
+ 108, 118, 105, 101, 119, 0,
+ 111, 98, 106, 101, 99, 116,
+ 84, 114, 97, 110, 115, 102,
+ 111, 114, 109, 0, 108, 105,
+ 103, 104, 116, 84, 114, 97,
+ 110, 115, 102, 111, 114, 109,
+ 0, 99, 108, 105, 112, 80,
+ 108, 97, 110, 101, 0, 102,
+ 108, 111, 97, 116, 52, 0,
+ 171, 171, 1, 0, 3, 0,
+ 1, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 55, 1,
+ 0, 0, 102, 111, 103, 67,
+ 111, 108, 111, 114, 0, 99,
+ 111, 108, 111, 114, 0, 115,
+ 101, 99, 111, 110, 100, 97,
+ 114, 121, 67, 111, 108, 111,
+ 114, 0, 115, 104, 97, 100,
+ 111, 119, 84, 97, 112, 115,
+ 0, 171, 171, 171, 1, 0,
+ 3, 0, 1, 0, 4, 0,
+ 12, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 55, 1, 0, 0, 108, 105,
+ 103, 104, 116, 80, 111, 115,
+ 0, 102, 108, 111, 97, 116,
+ 51, 0, 1, 0, 3, 0,
+ 1, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 189, 1,
+ 0, 0, 95, 112, 97, 100,
+ 48, 0, 102, 108, 111, 97,
+ 116, 0, 0, 0, 3, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 238, 1,
+ 0, 0, 108, 105, 103, 104,
+ 116, 68, 105, 114, 0, 95,
+ 112, 97, 100, 49, 0, 98,
+ 105, 97, 115, 0, 101, 120,
+ 112, 97, 110, 100, 0, 115,
+ 112, 111, 116, 77, 105, 110,
+ 0, 115, 112, 111, 116, 77,
+ 97, 120, 0, 103, 114, 105,
+ 100, 0, 105, 110, 116, 0,
+ 0, 0, 2, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 72, 2, 0, 0,
+ 116, 101, 120, 0, 99, 111,
+ 108, 111, 114, 65, 114, 114,
+ 97, 121, 0, 95, 112, 97,
+ 100, 50, 0, 171, 171, 171,
+ 192, 0, 0, 0, 224, 0,
+ 0, 0, 0, 0, 0, 0,
+ 4, 1, 0, 0, 224, 0,
+ 0, 0, 64, 0, 0, 0,
+ 14, 1, 0, 0, 224, 0,
+ 0, 0, 128, 0, 0, 0,
+ 30, 1, 0, 0, 224, 0,
+ 0, 0, 192, 0, 0, 0,
+ 45, 1, 0, 0, 64, 1,
+ 0, 0, 0, 1, 0, 0,
+ 100, 1, 0, 0, 64, 1,
+ 0, 0, 16, 1, 0, 0,
+ 109, 1, 0, 0, 64, 1,
+ 0, 0, 32, 1, 0, 0,
+ 115, 1, 0, 0, 64, 1,
+ 0, 0, 48, 1, 0, 0,
+ 130, 1, 0, 0, 144, 1,
+ 0, 0, 64, 1, 0, 0,
+ 180, 1, 0, 0, 196, 1,
+ 0, 0, 0, 2, 0, 0,
+ 232, 1, 0, 0, 244, 1,
+ 0, 0, 12, 2, 0, 0,
+ 24, 2, 0, 0, 196, 1,
+ 0, 0, 16, 2, 0, 0,
+ 33, 2, 0, 0, 244, 1,
+ 0, 0, 28, 2, 0, 0,
+ 39, 2, 0, 0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
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0
+};
diff --git a/demo/d3d11/shaders/passThroughVS.hlsl b/demo/d3d11/shaders/passThroughVS.hlsl
new file mode 100644
index 0000000..9b16afa
--- /dev/null
+++ b/demo/d3d11/shaders/passThroughVS.hlsl
@@ -0,0 +1,26 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ FluidShaderConst gParams;
+};
+
+PassthroughVertexOut passThroughVS(PassthroughVertexIn input)
+{
+ float4 gl_Vertex = float4(input.position, 0.0f, 1.0f);
+ float2 gl_MultiTexCoord0 = input.texCoord;
+
+ PassthroughVertexOut output;
+ output.position = gl_Vertex;
+ output.texCoord[0] = gl_MultiTexCoord0;
+
+ return output;
+
+ /*
+ void main()
+ {
+ gl_Position = vec4(gl_Vertex.xyz, 1.0);
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ }
+ */
+}
diff --git a/demo/d3d11/shaders/passThroughVS.hlsl.h b/demo/d3d11/shaders/passThroughVS.hlsl.h
new file mode 100644
index 0000000..4b1b2cf
--- /dev/null
+++ b/demo/d3d11/shaders/passThroughVS.hlsl.h
@@ -0,0 +1,145 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xy 0 NONE float xy
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xy 1 NONE float xy
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_input v0.xy
+dcl_input v1.xy
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xy
+mov o0.xy, v0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+mov o1.xy, v1.xyxx
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_passThroughVS[] =
+{
+ 68, 88, 66, 67, 187, 133,
+ 114, 171, 205, 36, 113, 9,
+ 245, 108, 33, 122, 172, 89,
+ 138, 214, 1, 0, 0, 0,
+ 136, 2, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 172, 0, 0, 0, 0, 1,
+ 0, 0, 88, 1, 0, 0,
+ 236, 1, 0, 0, 82, 68,
+ 69, 70, 112, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 60, 0, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115,
+ 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112,
+ 105, 108, 101, 114, 32, 54,
+ 46, 51, 46, 57, 54, 48,
+ 48, 46, 49, 54, 51, 56,
+ 52, 0, 171, 171, 73, 83,
+ 71, 78, 76, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0,
+ 0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
+ 70, 16, 16, 0, 1, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 148, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/pointGS.hlsl b/demo/d3d11/shaders/pointGS.hlsl
new file mode 100644
index 0000000..2d8126e
--- /dev/null
+++ b/demo/d3d11/shaders/pointGS.hlsl
@@ -0,0 +1,84 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ PointShaderConst gParams;
+};
+
+static const float2 corners[4] =
+{
+ float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0)
+};
+
+[maxvertexcount(4)]
+void pointGS(point PointVertexOut input[1], inout TriangleStream<PointGeoOut> triStream)
+{
+ float4 gl_Position;
+ float4 gl_TexCoord[6];
+
+ {
+ [unroll]
+ for (int i = 0; i < 6; i++)
+ gl_TexCoord[i] = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ }
+
+ const float4x4 gl_ModelViewMatrix = gParams.modelview;
+ const float pointRadius = gParams.pointRadius;
+ const float pointScale = gParams.pointScale;
+ const float4x4 lightTransform = gParams.lightTransform;
+ const float3 lightDir = gParams.lightDir.xyz;
+ const int mode = gParams.mode;
+
+ float4 viewPos = input[0].position;
+ float density = input[0].density;
+ unsigned int phase = input[0].phase;
+ float4 gl_Vertex = input[0].vertex;
+
+ //float gl_PointSize = -pointScale * (pointRadius / viewPos.z);
+ //float spriteSize = (pointRadius / viewPos.z);
+ float spriteSize = pointRadius * 2;
+
+ PointGeoOut output;
+
+ for (int i = 0; i < 4; ++i)
+ {
+
+ float4 eyePos = viewPos; // start with point position
+ eyePos.xy += spriteSize * (corners[i] - float2(0.5, 0.5)); // add corner position
+ gl_Position = mul(gParams.projection, eyePos); // complete transformation
+
+ gl_TexCoord[0].xy = corners[i].xy; // use corner as texCoord
+ gl_TexCoord[0].y = 1.0f - gl_TexCoord[0].y; // flip the y component of uv (glsl to hlsl conversion)
+ gl_TexCoord[1] = mul(lightTransform, float4(gl_Vertex.xyz - lightDir * pointRadius * 2.0, 1.0));
+ gl_TexCoord[2] = mul(gl_ModelViewMatrix, float4(lightDir, 0.0));
+
+ if (mode == 1)
+ {
+ // density visualization
+ if (density < 0.0f)
+ gl_TexCoord[3].xyz = lerp(float3(0.1, 0.1, 1.0), float3(0.1, 1.0, 1.0), -density);
+ else
+ gl_TexCoord[3].xyz = lerp(float3(1.0, 1.0, 1.0), float3(0.1, 0.2, 1.0), density);
+ }
+ else if (mode == 2)
+ {
+ //gl_PointSize *= clamp(gl_Vertex.w * 0.25, 0.0f, 1.0);
+ float tmp = clamp(gl_Vertex.w * 0.05, 0.0f, 1.0);
+ gl_TexCoord[3].xyzw = float4(tmp, tmp, tmp, tmp);
+ }
+ else
+ {
+ gl_TexCoord[3].xyz = lerp(gParams.colors[phase % 8].xyz * 2.0, float3(1.0, 1.0, 1.0), 0.1);
+ }
+
+ gl_TexCoord[4].xyz = gl_Vertex.xyz;
+ gl_TexCoord[5].xyz = viewPos.xyz;
+
+ output.position = gl_Position;
+ [unroll]
+ for (int j = 0; j < 6; j++)
+ output.texCoord[j] = gl_TexCoord[j];
+
+ triStream.Append(output);
+ }
+}
diff --git a/demo/d3d11/shaders/pointGS.hlsl.h b/demo/d3d11/shaders/pointGS.hlsl.h
new file mode 100644
index 0000000..afc1b76
--- /dev/null
+++ b/demo/d3d11/shaders/pointGS.hlsl.h
@@ -0,0 +1,740 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct PointShaderConst
+// {
+//
+// float4x4 modelview; // Offset: 0
+// float4x4 projection; // Offset: 64
+// float4x4 lightTransform; // Offset: 128
+// float4 colors[8]; // Offset: 192
+// float4 shadowTaps[12]; // Offset: 320
+// float3 lightPos; // Offset: 512
+// float _pad0; // Offset: 524
+// float3 lightDir; // Offset: 528
+// float _pad1; // Offset: 540
+// float pointRadius; // Offset: 544
+// float pointScale; // Offset: 548
+// float spotMin; // Offset: 552
+// float spotMax; // Offset: 556
+// int mode; // Offset: 560
+// int _pad2[3]; // Offset: 576
+//
+// } gParams; // Offset: 0 Size: 612
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyzw
+// DENSITY 0 x 1 NONE float x
+// PHASE 0 x 2 NONE int x
+// VERTEX 0 xyzw 3 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xyzw 1 NONE float xyzw
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float xyzw
+// TEXCOORD 3 xyzw 4 NONE float xyzw
+// TEXCOORD 4 xyzw 5 NONE float xyzw
+// TEXCOORD 5 xyzw 6 NONE float xyzw
+//
+gs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_immediateConstantBuffer { { 0, 1.000000, 0, 0},
+ { 0, 0, 0, 0},
+ { 1.000000, 1.000000, 0, 0},
+ { 1.000000, 0, 0, 0} }
+dcl_constantbuffer cb0[36], dynamicIndexed
+dcl_input v[1][0].xyzw
+dcl_input v[1][1].x
+dcl_input v[1][2].x
+dcl_input v[1][3].xyzw
+dcl_temps 8
+dcl_indexableTemp x0[6], 4
+dcl_inputprimitive point
+dcl_stream m0
+dcl_outputtopology trianglestrip
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_maxout 4
+mov x0[3].w, l(0)
+add r0.x, cb0[34].x, cb0[34].x
+mul r0.yzw, cb0[33].xxyz, cb0[34].xxxx
+mad r0.yzw, -r0.yyzw, l(0.000000, 2.000000, 2.000000, 2.000000), v[0][3].xxyz
+mul r1.xyzw, r0.zzzz, cb0[9].xyzw
+mad r1.xyzw, cb0[8].xyzw, r0.yyyy, r1.xyzw
+mad r1.xyzw, cb0[10].xyzw, r0.wwww, r1.xyzw
+add r1.xyzw, r1.xyzw, cb0[11].xyzw
+mul r2.xyzw, cb0[1].xyzw, cb0[33].yyyy
+mad r2.xyzw, cb0[0].xyzw, cb0[33].xxxx, r2.xyzw
+mad r2.xyzw, cb0[2].xyzw, cb0[33].zzzz, r2.xyzw
+lt r0.y, v[0][1].x, l(0.000000)
+mad r3.xyz, v[0][1].xxxx, l(0.000000, -0.900000, 0.000000, 0.000000), l(0.100000, 0.100000, 1.000000, 0.000000)
+mad r4.xyz, v[0][1].xxxx, l(-0.900000, -0.800000, 0.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000)
+ieq r0.zw, l(0, 0, 1, 2), cb0[35].xxxx
+mul r3.w, l(0.050000), v[0][3].w
+mov_sat r5.xyz, r3.wwww
+and r3.w, l(7), v[0][2].x
+add r6.xyz, cb0[r3.w + 12].xyzx, cb0[r3.w + 12].xyzx
+mad r7.xyz, -cb0[r3.w + 12].xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000)
+mad r6.xyz, r7.xyzx, l(0.100000, 0.100000, 0.100000, 0.000000), r6.xyzx
+movc r3.xyz, r0.yyyy, r3.xyzx, r4.xyzx
+mov r0.y, l(0)
+loop
+ ige r3.w, r0.y, l(4)
+ breakc_nz r3.w
+ add r4.xy, l(-0.500000, -0.500000, 0.000000, 0.000000), icb[r0.y + 0].xyxx
+ mad r4.xy, r0.xxxx, r4.xyxx, v[0][0].xyxx
+ mul r7.xyzw, r4.yyyy, cb0[5].xyzw
+ mad r4.xyzw, cb0[4].xyzw, r4.xxxx, r7.xyzw
+ mad r4.xyzw, cb0[6].xyzw, v[0][0].zzzz, r4.xyzw
+ mad r4.xyzw, cb0[7].xyzw, v[0][0].wwww, r4.xyzw
+ add r3.w, l(1.000000), -icb[r0.y + 0].y
+ if_nz r0.z
+ mov r7.xyz, r3.xyzx
+ else
+ if_nz r0.w
+ mov x0[3].w, r5.z
+ mov r7.xyz, r5.xyzx
+ else
+ mov r7.xyz, r6.xyzx
+ endif
+ endif
+ mov r5.w, x0[3].w
+ mov o0.xyzw, r4.xyzw
+ mov o1.x, icb[r0.y + 0].x
+ mov o1.y, r3.w
+ mov o1.zw, l(0,0,0,0)
+ mov o2.xyzw, r1.xyzw
+ mov o3.xyzw, r2.xyzw
+ mov o4.xyz, r7.xyzx
+ mov o4.w, r5.w
+ mov o5.xyz, v[0][3].xyzx
+ mov o5.w, l(0)
+ mov o6.xyz, v[0][0].xyzx
+ mov o6.w, l(0)
+ emit_stream m0
+ iadd r0.y, r0.y, l(1)
+endloop
+ret
+// Approximately 60 instruction slots used
+#endif
+
+const BYTE g_pointGS[] =
+{
+ 68, 88, 66, 67, 83, 238,
+ 66, 156, 86, 118, 105, 62,
+ 85, 224, 176, 224, 229, 4,
+ 226, 151, 1, 0, 0, 0,
+ 188, 13, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 176, 3, 0, 0, 64, 4,
+ 0, 0, 44, 5, 0, 0,
+ 32, 13, 0, 0, 82, 68,
+ 69, 70, 116, 3, 0, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 83, 71, 0, 1, 0, 0,
+ 64, 3, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 99, 111, 110, 115,
+ 116, 66, 117, 102, 0, 171,
+ 171, 171, 92, 0, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 112, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 0, 0, 0,
+ 0, 0, 0, 0, 100, 2,
+ 0, 0, 2, 0, 0, 0,
+ 28, 3, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 103, 80, 97, 114, 97, 109,
+ 115, 0, 80, 111, 105, 110,
+ 116, 83, 104, 97, 100, 101,
+ 114, 67, 111, 110, 115, 116,
+ 0, 109, 111, 100, 101, 108,
+ 118, 105, 101, 119, 0, 102,
+ 108, 111, 97, 116, 52, 120,
+ 52, 0, 3, 0, 3, 0,
+ 4, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 203, 0,
+ 0, 0, 112, 114, 111, 106,
+ 101, 99, 116, 105, 111, 110,
+ 0, 108, 105, 103, 104, 116,
+ 84, 114, 97, 110, 115, 102,
+ 111, 114, 109, 0, 99, 111,
+ 108, 111, 114, 115, 0, 102,
+ 108, 111, 97, 116, 52, 0,
+ 1, 0, 3, 0, 1, 0,
+ 4, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 25, 1, 0, 0,
+ 115, 104, 97, 100, 111, 119,
+ 84, 97, 112, 115, 0, 171,
+ 1, 0, 3, 0, 1, 0,
+ 4, 0, 12, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 25, 1, 0, 0,
+ 108, 105, 103, 104, 116, 80,
+ 111, 115, 0, 102, 108, 111,
+ 97, 116, 51, 0, 1, 0,
+ 3, 0, 1, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 125, 1, 0, 0, 95, 112,
+ 97, 100, 48, 0, 102, 108,
+ 111, 97, 116, 0, 0, 0,
+ 3, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 174, 1, 0, 0, 108, 105,
+ 103, 104, 116, 68, 105, 114,
+ 0, 95, 112, 97, 100, 49,
+ 0, 112, 111, 105, 110, 116,
+ 82, 97, 100, 105, 117, 115,
+ 0, 112, 111, 105, 110, 116,
+ 83, 99, 97, 108, 101, 0,
+ 115, 112, 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 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/pointPS.hlsl b/demo/d3d11/shaders/pointPS.hlsl
new file mode 100644
index 0000000..e8bcaf4
--- /dev/null
+++ b/demo/d3d11/shaders/pointPS.hlsl
@@ -0,0 +1,103 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ PointShaderConst gParams;
+};
+
+Texture2D<float> shadowTexture : register(t0); // shadow map
+
+SamplerComparisonState shadowSampler : register(s0); // texture sample used to sample depth from shadow texture in this sample
+
+float sqr(float x) { return x * x; }
+
+float shadowSample(float4 gl_TexCoord[6])
+{
+ float3 pos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w);
+ //float3 uvw = (pos.xyz * 0.5) + vec3(0.5);
+ float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0);
+
+ // user clip
+ if (uvw.x < 0.0 || uvw.x > 1.0)
+ return 1.0;
+ if (uvw.y < 0.0 || uvw.y > 1.0)
+ return 1.0;
+
+ float s = 0.0;
+ float radius = 0.002;
+
+ // flip uv y-coordinate
+ uvw.y = 1.0f - uvw.y;
+
+ [unroll]
+ for (int i = 0; i < 8; i++)
+ {
+ float2 shadowTaps = gParams.shadowTaps[i].xy;
+ shadowTaps.y = 1.0f - shadowTaps.y;
+
+ //s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i] * radius, uvw.z)).r;
+ s += shadowTexture.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z);
+ }
+ s /= 8.0;
+
+ return s;
+}
+
+float4 pointPS(PointGeoOut input
+ //, out float gl_FragDepth : SV_DEPTH
+) : SV_TARGET
+{
+ //gl_FragDepth = 0.0f;
+
+ const float spotMin = gParams.spotMin;
+ const float spotMax = gParams.spotMax;
+
+ float4 gl_FragColor;
+ float4 gl_TexCoord[6];
+
+ [unroll]
+ for (int i = 0; i < 6; i++)
+ gl_TexCoord[i] = input.texCoord[i];
+
+ // calculate normal from texture coordinates
+ float3 normal;
+ normal.xy = gl_TexCoord[0].xy * float2(2.0, -2.0) + float2(-1.0, 1.0);
+ float mag = dot(normal.xy, normal.xy);
+ if (mag > 1.0) discard; // kill pixels outside circle
+ normal.z = sqrt(1.0 - mag);
+
+ if (gParams.mode == 2)
+ {
+ float alpha = normal.z * gl_TexCoord[3].w;
+ gl_FragColor.xyz = gl_TexCoord[3].xyz * alpha;
+ gl_FragColor.w = alpha;
+
+ return gl_FragColor;
+ }
+
+ // calculate lighting
+ float shadow = shadowSample(gl_TexCoord);
+
+ float3 lPos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w);
+ float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05);
+
+ float3 diffuse = float3(0.9, 0.9, 0.9);
+ float3 reflectance = gl_TexCoord[3].xyz;
+
+ float3 Lo = diffuse * reflectance * max(0.0, sqr(-dot(gl_TexCoord[2].xyz, normal) * 0.5 + 0.5)) * max(0.2, shadow) * attenuation;
+
+ const float tmp = 1.0 / 2.2;
+ gl_FragColor = float4(pow(abs(Lo), float3(tmp, tmp, tmp)), 1.0);
+
+ /*
+ const float pointRadius = gParams.pointRadius;
+ const float4x4 gl_ProjectionMatrix = gParams.projection;
+
+ float3 eyePos = gl_TexCoord[5].xyz + normal * pointRadius;
+ float4 ndcPos = mul(gl_ProjectionMatrix, float4(eyePos, 1.0));
+ ndcPos.z /= ndcPos.w;
+ gl_FragDepth = ndcPos.z;
+ */
+
+ return gl_FragColor;
+}
diff --git a/demo/d3d11/shaders/pointPS.hlsl.h b/demo/d3d11/shaders/pointPS.hlsl.h
new file mode 100644
index 0000000..843b166
--- /dev/null
+++ b/demo/d3d11/shaders/pointPS.hlsl.h
@@ -0,0 +1,947 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct PointShaderConst
+// {
+//
+// float4x4 modelview; // Offset: 0
+// float4x4 projection; // Offset: 64
+// float4x4 lightTransform; // Offset: 128
+// float4 colors[8]; // Offset: 192
+// float4 shadowTaps[12]; // Offset: 320
+// float3 lightPos; // Offset: 512
+// float _pad0; // Offset: 524
+// float3 lightDir; // Offset: 528
+// float _pad1; // Offset: 540
+// float pointRadius; // Offset: 544
+// float pointScale; // Offset: 548
+// float spotMin; // Offset: 552
+// float spotMax; // Offset: 556
+// int mode; // Offset: 560
+// int _pad2[3]; // Offset: 576
+//
+// } gParams; // Offset: 0 Size: 612
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// shadowSampler sampler_c NA NA 0 1
+// shadowTexture texture float 2d 0 1
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xyzw 1 NONE float xy
+// TEXCOORD 1 xyzw 2 NONE float xyzw
+// TEXCOORD 2 xyzw 3 NONE float xyz
+// TEXCOORD 3 xyzw 4 NONE float xyzw
+// TEXCOORD 4 xyzw 5 NONE float
+// TEXCOORD 5 xyzw 6 NONE float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[36], immediateIndexed
+dcl_sampler s0, mode_comparison
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_input_ps linear v2.xyzw
+dcl_input_ps linear v3.xyz
+dcl_input_ps linear v4.xyzw
+dcl_output o0.xyzw
+dcl_temps 4
+mad r0.xy, v1.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
+dp2 r0.x, r0.xyxx, r0.xyxx
+lt r0.y, l(1.000000), r0.x
+discard_nz r0.y
+add r0.x, -r0.x, l(1.000000)
+sqrt r0.z, r0.x
+ieq r0.w, cb0[35].x, l(2)
+if_nz r0.w
+ mul r0.w, r0.z, v4.w
+ mul o0.xyz, r0.wwww, v4.xyzx
+ mov o0.w, r0.w
+ ret
+endif
+div r1.xyz, v2.xyzx, v2.wwww
+mad r2.xyz, r1.xyzx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
+lt r0.w, r2.x, l(0.000000)
+lt r1.z, l(1.000000), r2.x
+or r0.w, r0.w, r1.z
+if_z r0.w
+ lt r0.w, r2.y, l(0.000000)
+ lt r1.z, l(1.000000), r2.y
+ or r0.w, r0.w, r1.z
+ if_z r0.w
+ add r0.w, -cb0[20].y, l(1.000000)
+ mul r3.x, cb0[20].x, l(0.002000)
+ mul r3.y, r0.w, l(0.002000)
+ add r2.w, -r2.y, l(1.000000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r1.zwzz, t0.xxxx, s0, r2.z
+ add r1.z, -cb0[21].y, l(1.000000)
+ mul r3.x, cb0[21].x, l(0.002000)
+ mul r3.y, r1.z, l(0.002000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z
+ add r0.w, r0.w, r1.z
+ add r1.z, -cb0[22].y, l(1.000000)
+ mul r3.x, cb0[22].x, l(0.002000)
+ mul r3.y, r1.z, l(0.002000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z
+ add r0.w, r0.w, r1.z
+ add r1.z, -cb0[23].y, l(1.000000)
+ mul r3.x, cb0[23].x, l(0.002000)
+ mul r3.y, r1.z, l(0.002000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z
+ add r0.w, r0.w, r1.z
+ add r1.z, -cb0[24].y, l(1.000000)
+ mul r3.x, cb0[24].x, l(0.002000)
+ mul r3.y, r1.z, l(0.002000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z
+ add r0.w, r0.w, r1.z
+ add r1.z, -cb0[25].y, l(1.000000)
+ mul r3.x, cb0[25].x, l(0.002000)
+ mul r3.y, r1.z, l(0.002000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z
+ add r0.w, r0.w, r1.z
+ add r1.z, -cb0[26].y, l(1.000000)
+ mul r3.x, cb0[26].x, l(0.002000)
+ mul r3.y, r1.z, l(0.002000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z
+ add r0.w, r0.w, r1.z
+ add r1.z, -cb0[27].y, l(1.000000)
+ mul r3.x, cb0[27].x, l(0.002000)
+ mul r3.y, r1.z, l(0.002000)
+ add r1.zw, r2.xxxw, r3.xxxy
+ sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z
+ add r0.w, r0.w, r1.z
+ mul r0.w, r0.w, l(0.125000)
+ else
+ mov r0.w, l(1.000000)
+ endif
+else
+ mov r0.w, l(1.000000)
+endif
+dp2 r1.x, r1.xyxx, r1.xyxx
+add r1.y, -cb0[34].w, cb0[34].z
+add r1.x, r1.x, -cb0[34].w
+div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), r1.y
+mul_sat r1.x, r1.y, r1.x
+mad r1.y, r1.x, l(-2.000000), l(3.000000)
+mul r1.x, r1.x, r1.x
+mul r1.x, r1.x, r1.y
+max r1.x, r1.x, l(0.050000)
+mul r1.yzw, v4.xxyz, l(0.000000, 0.900000, 0.900000, 0.900000)
+mad r0.xy, v1.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
+dp3 r0.x, v3.xyzx, r0.xyzx
+mad r0.x, r0.x, l(-0.500000), l(0.500000)
+mul r0.x, r0.x, r0.x
+mul r0.xyz, r0.xxxx, r1.yzwy
+max r0.w, r0.w, l(0.200000)
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r1.xxxx, r0.xyzx
+log r0.xyz, |r0.xyzx|
+mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000)
+exp o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 101 instruction slots used
+#endif
+
+const BYTE g_pointPS[] =
+{
+ 68, 88, 66, 67, 43, 46,
+ 192, 8, 211, 105, 212, 151,
+ 103, 8, 148, 62, 30, 192,
+ 144, 175, 1, 0, 0, 0,
+ 244, 17, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 12, 4, 0, 0, 220, 4,
+ 0, 0, 16, 5, 0, 0,
+ 88, 17, 0, 0, 82, 68,
+ 69, 70, 208, 3, 0, 0,
+ 1, 0, 0, 0, 196, 0,
+ 0, 0, 3, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 255, 255, 0, 1, 0, 0,
+ 156, 3, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 156, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0,
+ 0, 0, 170, 0, 0, 0,
+ 2, 0, 0, 0, 5, 0,
+ 0, 0, 4, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 184, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0,
+ 115, 104, 97, 100, 111, 119,
+ 83, 97, 109, 112, 108, 101,
+ 114, 0, 115, 104, 97, 100,
+ 111, 119, 84, 101, 120, 116,
+ 117, 114, 101, 0, 99, 111,
+ 110, 115, 116, 66, 117, 102,
+ 0, 171, 171, 171, 184, 0,
+ 0, 0, 1, 0, 0, 0,
+ 220, 0, 0, 0, 112, 2,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 1,
+ 0, 0, 0, 0, 0, 0,
+ 100, 2, 0, 0, 2, 0,
+ 0, 0, 120, 3, 0, 0,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 255, 255, 255, 255, 0, 0,
+ 0, 0, 103, 80, 97, 114,
+ 97, 109, 115, 0, 80, 111,
+ 105, 110, 116, 83, 104, 97,
+ 100, 101, 114, 67, 111, 110,
+ 115, 116, 0, 109, 111, 100,
+ 101, 108, 118, 105, 101, 119,
+ 0, 102, 108, 111, 97, 116,
+ 52, 120, 52, 0, 3, 0,
+ 3, 0, 4, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 39, 1, 0, 0, 112, 114,
+ 111, 106, 101, 99, 116, 105,
+ 111, 110, 0, 108, 105, 103,
+ 104, 116, 84, 114, 97, 110,
+ 115, 102, 111, 114, 109, 0,
+ 99, 111, 108, 111, 114, 115,
+ 0, 102, 108, 111, 97, 116,
+ 52, 0, 1, 0, 3, 0,
+ 1, 0, 4, 0, 8, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 117, 1,
+ 0, 0, 115, 104, 97, 100,
+ 111, 119, 84, 97, 112, 115,
+ 0, 171, 1, 0, 3, 0,
+ 1, 0, 4, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 117, 1,
+ 0, 0, 108, 105, 103, 104,
+ 116, 80, 111, 115, 0, 102,
+ 108, 111, 97, 116, 51, 0,
+ 1, 0, 3, 0, 1, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 217, 1, 0, 0,
+ 95, 112, 97, 100, 48, 0,
+ 102, 108, 111, 97, 116, 0,
+ 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 2, 0, 0,
+ 108, 105, 103, 104, 116, 68,
+ 105, 114, 0, 95, 112, 97,
+ 100, 49, 0, 112, 111, 105,
+ 110, 116, 82, 97, 100, 105,
+ 117, 115, 0, 112, 111, 105,
+ 110, 116, 83, 99, 97, 108,
+ 101, 0, 115, 112, 111, 116,
+ 77, 105, 110, 0, 115, 112,
+ 111, 116, 77, 97, 120, 0,
+ 109, 111, 100, 101, 0, 105,
+ 110, 116, 0, 171, 0, 0,
+ 2, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 111, 2, 0, 0, 95, 112,
+ 97, 100, 50, 0, 171, 171,
+ 0, 0, 2,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0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/pointVS.hlsl b/demo/d3d11/shaders/pointVS.hlsl
new file mode 100644
index 0000000..6ab4b6c
--- /dev/null
+++ b/demo/d3d11/shaders/pointVS.hlsl
@@ -0,0 +1,26 @@
+#include "shaderCommon.h"
+
+cbuffer constBuf : register(b0)
+{
+ PointShaderConst gParams;
+};
+
+PointVertexOut pointVS(PointVertexIn input, uint instance : SV_VertexID)
+{
+ const float4 gl_Vertex = input.position;
+ const float4x4 gl_ModelViewMatrix = gParams.modelview;
+
+ float density = input.density;
+ int phase = input.phase;
+
+ // calculate window-space point size
+ float4 viewPos = mul(gl_ModelViewMatrix, float4(gl_Vertex.xyz, 1.0));
+
+ PointVertexOut output;
+ output.position = viewPos;
+ output.density = density;
+ output.phase = phase;
+ output.vertex = gl_Vertex;
+
+ return output;
+}
diff --git a/demo/d3d11/shaders/pointVS.hlsl.h b/demo/d3d11/shaders/pointVS.hlsl.h
new file mode 100644
index 0000000..b78b3f1
--- /dev/null
+++ b/demo/d3d11/shaders/pointVS.hlsl.h
@@ -0,0 +1,374 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions:
+//
+// cbuffer constBuf
+// {
+//
+// struct PointShaderConst
+// {
+//
+// float4x4 modelview; // Offset: 0
+// float4x4 projection; // Offset: 64
+// float4x4 lightTransform; // Offset: 128
+// float4 colors[8]; // Offset: 192
+// float4 shadowTaps[12]; // Offset: 320
+// float3 lightPos; // Offset: 512
+// float _pad0; // Offset: 524
+// float3 lightDir; // Offset: 528
+// float _pad1; // Offset: 540
+// float pointRadius; // Offset: 544
+// float pointScale; // Offset: 548
+// float spotMin; // Offset: 552
+// float spotMax; // Offset: 556
+// int mode; // Offset: 560
+// int _pad2[3]; // Offset: 576
+//
+// } gParams; // Offset: 0 Size: 612
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// constBuf cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyzw
+// DENSITY 0 x 1 NONE float x
+// PHASE 0 x 2 NONE int x
+// SV_VertexID 0 x 3 VERTID uint
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION 0 xyzw 0 NONE float xyzw
+// DENSITY 0 x 1 NONE float x
+// PHASE 0 x 2 NONE int x
+// VERTEX 0 xyzw 3 NONE float xyzw
+//
+vs_5_0
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[4], immediateIndexed
+dcl_input v0.xyzw
+dcl_input v1.x
+dcl_input v2.x
+dcl_output o0.xyzw
+dcl_output o1.x
+dcl_output o2.x
+dcl_output o3.xyzw
+dcl_temps 1
+mul r0.xyzw, v0.yyyy, cb0[1].xyzw
+mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw
+mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
+add o0.xyzw, r0.xyzw, cb0[3].xyzw
+mov o1.x, v1.x
+mov o2.x, v2.x
+mov o3.xyzw, v0.xyzw
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_pointVS[] =
+{
+ 68, 88, 66, 67, 195, 164,
+ 148, 248, 252, 197, 222, 222,
+ 84, 139, 94, 6, 43, 78,
+ 110, 120, 1, 0, 0, 0,
+ 192, 6, 0, 0, 5, 0,
+ 0, 0, 52, 0, 0, 0,
+ 176, 3, 0, 0, 68, 4,
+ 0, 0, 212, 4, 0, 0,
+ 36, 6, 0, 0, 82, 68,
+ 69, 70, 116, 3, 0, 0,
+ 1, 0, 0, 0, 104, 0,
+ 0, 0, 1, 0, 0, 0,
+ 60, 0, 0, 0, 0, 5,
+ 254, 255, 0, 1, 0, 0,
+ 64, 3, 0, 0, 82, 68,
+ 49, 49, 60, 0, 0, 0,
+ 24, 0, 0, 0, 32, 0,
+ 0, 0, 40, 0, 0, 0,
+ 36, 0, 0, 0, 12, 0,
+ 0, 0, 0, 0, 0, 0,
+ 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0,
+ 0, 0, 99, 111, 110, 115,
+ 116, 66, 117, 102, 0, 171,
+ 171, 171, 92, 0, 0, 0,
+ 1, 0, 0, 0, 128, 0,
+ 0, 0, 112, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 0, 0, 0,
+ 0, 0, 0, 0, 100, 2,
+ 0, 0, 2, 0, 0, 0,
+ 28, 3, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255,
+ 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 0, 0, 0,
+ 103, 80, 97, 114, 97, 109,
+ 115, 0, 80, 111, 105, 110,
+ 116, 83, 104, 97, 100, 101,
+ 114, 67, 111, 110, 115, 116,
+ 0, 109, 111, 100, 101, 108,
+ 118, 105, 101, 119, 0, 102,
+ 108, 111, 97, 116, 52, 120,
+ 52, 0, 3, 0, 3, 0,
+ 4, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 203, 0,
+ 0, 0, 112, 114, 111, 106,
+ 101, 99, 116, 105, 111, 110,
+ 0, 108, 105, 103, 104, 116,
+ 84, 114, 97, 110, 115, 102,
+ 111, 114, 109, 0, 99, 111,
+ 108, 111, 114, 115, 0, 102,
+ 108, 111, 97, 116, 52, 0,
+ 1, 0, 3, 0, 1, 0,
+ 4, 0, 8, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 25, 1, 0, 0,
+ 115, 104, 97, 100, 111, 119,
+ 84, 97, 112, 115, 0, 171,
+ 1, 0, 3, 0, 1, 0,
+ 4, 0, 12, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 25, 1, 0, 0,
+ 108, 105, 103, 104, 116, 80,
+ 111, 115, 0, 102, 108, 111,
+ 97, 116, 51, 0, 1, 0,
+ 3, 0, 1, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 125, 1, 0, 0, 95, 112,
+ 97, 100, 48, 0, 102, 108,
+ 111, 97, 116, 0, 0, 0,
+ 3, 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 174, 1, 0, 0, 108, 105,
+ 103, 104, 116, 68, 105, 114,
+ 0, 95, 112, 97, 100, 49,
+ 0, 112, 111, 105, 110, 116,
+ 82, 97, 100, 105, 117, 115,
+ 0, 112, 111, 105, 110, 116,
+ 83, 99, 97, 108, 101, 0,
+ 115, 112, 111, 116, 77, 105,
+ 110, 0, 115, 112, 111, 116,
+ 77, 97, 120, 0, 109, 111,
+ 100, 101, 0, 105, 110, 116,
+ 0, 171, 0, 0, 2, 0,
+ 1, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 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32, 0,
+ 0, 0, 0, 0, 3, 0,
+ 0, 0, 54, 0, 0, 5,
+ 18, 32, 16, 0, 1, 0,
+ 0, 0, 10, 16, 16, 0,
+ 1, 0, 0, 0, 54, 0,
+ 0, 5, 18, 32, 16, 0,
+ 2, 0, 0, 0, 10, 16,
+ 16, 0, 2, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32,
+ 16, 0, 3, 0, 0, 0,
+ 70, 30, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 148, 0,
+ 0, 0, 8, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 7, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
diff --git a/demo/d3d11/shaders/shaderCommon.h b/demo/d3d11/shaders/shaderCommon.h
new file mode 100644
index 0000000..176c97d
--- /dev/null
+++ b/demo/d3d11/shaders/shaderCommon.h
@@ -0,0 +1,237 @@
+struct MeshShaderConst
+{
+ float4x4 modelviewprojection;
+ float4x4 modelview;
+ float4x4 objectTransform;
+ float4x4 lightTransform;
+
+ float4 clipPlane;
+ float4 fogColor;
+ float4 color;
+ float4 secondaryColor;
+
+ float4 shadowTaps[12];
+
+ float3 lightPos;
+ float _pad0;
+ float3 lightDir;
+ float _pad1;
+
+ float bias;
+ float expand;
+ float spotMin;
+ float spotMax;
+
+ int grid;
+ int tex;
+ int colorArray;
+ int _pad2;
+};
+
+struct DebugRenderConst
+{
+ float4x4 modelview;
+ float4x4 projection;
+};
+
+
+#ifndef EXCLUDE_SHADER_STRUCTS
+struct MeshVertexIn
+{
+ float3 position : POSITION;
+ float3 normal : NORMAL;
+ float2 texCoord : TEXCOORD;
+ float4 color : COLOR;
+};
+
+struct MeshVertexOut
+{
+ float4 position : SV_POSITION;
+ //float3 normal : NORMAL;
+ //float4 color : COLOR;
+ float4 texCoord[8] : TEXCOORD;
+ //float clipDistance[1] : CLIP_DISTANCE;
+};
+#endif
+
+struct PointShaderConst
+{
+ float4x4 modelview;
+ float4x4 projection;
+ float4x4 lightTransform;
+
+ float4 colors[8];
+ float4 shadowTaps[12];
+
+ float3 lightPos;
+ float _pad0;
+ float3 lightDir;
+ float _pad1;
+
+ float pointRadius; // point size in world space
+ float pointScale; // scale to calculate size in pixels
+ float spotMin;
+ float spotMax;
+
+ int mode;
+ int _pad2[3];
+};
+
+#ifndef EXCLUDE_SHADER_STRUCTS
+struct PointVertexIn
+{
+ float4 position : POSITION;
+ float density : DENSITY;
+ int phase : PHASE;
+};
+
+struct PointVertexOut
+{
+ float4 position : POSITION;
+ float density : DENSITY;
+ int phase : PHASE;
+ float4 vertex : VERTEX;
+};
+
+struct PointGeoOut
+{
+ float4 position : SV_POSITION;
+ float4 texCoord[6] : TEXCOORD;
+};
+#endif
+
+struct FluidShaderConst
+{
+ float4x4 modelviewprojection;
+ float4x4 modelview;
+ float4x4 projection; // ogl projection
+ float4x4 modelview_inverse;
+ float4x4 projection_inverse; // ogl inverse projection
+
+ float4 invTexScale;
+
+ float3 invViewport;
+ float _pad0;
+ //float3 invProjection;
+ //float _pad1;
+
+ float blurRadiusWorld;
+ float blurScale;
+ float blurFalloff;
+ int debug;
+
+ float3 lightPos;
+ float _pad1;
+ float3 lightDir;
+ float _pad2;
+ float4x4 lightTransform;
+
+ float4 color;
+ float4 clipPosToEye;
+
+ float spotMin;
+ float spotMax;
+ float ior;
+ float _pad3;
+
+ float4 shadowTaps[12];
+};
+
+#ifndef EXCLUDE_SHADER_STRUCTS
+struct FluidVertexIn
+{
+ float4 position : POSITION;
+ float4 q1 : U;
+ float4 q2 : V;
+ float4 q3 : W;
+};
+
+struct FluidVertexOut
+{
+ float4 position : POSITION;
+ float4 texCoord[6] : TEXCOORD;
+};
+
+struct FluidGeoOut
+{
+ float4 position : SV_POSITION;
+ float4 texCoord[4] : TEXCOORD;
+};
+
+struct PassthroughVertexIn
+{
+ float2 position : POSITION;
+ float2 texCoord : TEXCOORD;
+};
+
+struct PassthroughVertexOut
+{
+ float4 position : SV_POSITION;
+ float2 texCoord[1] : TEXCOORD;
+};
+#endif
+
+
+struct DiffuseShaderConst
+{
+ float3 lightPos; float pad0;
+ float3 lightDir; float pad1;
+ float4x4 lightTransform;
+ float4 color;
+
+ float4x4 modelView;
+ float4x4 modelViewProjection;
+ float4x4 projection;
+
+ float4 shadowTaps[12];
+
+ float diffusion;
+ float diffuseRadius; // point size in world space
+ float diffuseScale; // scale to calculate size in pixels
+
+ float spotMin;
+ float spotMax;
+
+ float motionBlurScale;
+
+ float pad3;
+ float pad4;
+
+};
+
+#ifndef EXCLUDE_SHADER_STRUCTS
+
+struct DiffuseVertexIn
+{
+ float4 position : POSITION; // lifetime in w
+ float4 velocity : VELOCITY;
+};
+
+struct DiffuseVertexOut
+{
+ float4 worldPos : POSITION; // lifetime in w
+ float4 ndcPos : NCDPOS;
+ float4 viewPos : VIEWPOS;
+ float4 viewVel : VIEWVEL;
+
+ float4 color : COLOR;
+};
+
+struct DiffuseGeometryOut
+{
+ float4 clipPos : SV_POSITION;
+
+ float4 worldPos : POSITION;
+
+ float4 viewPos : VIEWPOS;
+ float4 viewVel : VIEWVEL;
+
+ float4 lightDir : LIGHTDIR;
+ float4 color : COLOR;
+
+ float4 uv : UV;
+
+};
+
+#endif
+
diff --git a/demo/d3d11/shadersD3D11.cpp b/demo/d3d11/shadersD3D11.cpp
new file mode 100644
index 0000000..9e1d278
--- /dev/null
+++ b/demo/d3d11/shadersD3D11.cpp
@@ -0,0 +1,1041 @@
+#include "core/maths.h"
+#include "core/extrude.h"
+
+#include "shaders.h"
+
+#include "meshRender.h"
+#include "pointRender.h"
+#include "fluidRender.h"
+#include "diffuseRender.h"
+#include "debugLineRender.h"
+
+#include "shadowMap.h"
+#include "renderTarget.h"
+
+#include "imguiGraph.h"
+#include "imguiGraphD3D11.h"
+
+#include "appD3D11Ctx.h"
+
+#include <d3d11.h>
+#include <d3dcompiler.h>
+
+#include <cstdlib>
+
+DebugLineRender gDebugLineRender;
+MeshRenderer gMeshRenderer;
+PointRenderer gPointRenderer;
+DiffuseRenderer gDiffuseRenderer;
+
+AppGraphCtx* gAppGraphCtx;
+
+static float gSpotMin = 0.5f;
+static float gSpotMax = 1.0f;
+float gShadowBias = 0.075f;
+
+struct RenderContext
+{
+ RenderContext()
+ {
+ memset(&mMeshDrawParams, 0, sizeof(MeshDrawParams));
+ }
+
+ MeshDrawParams mMeshDrawParams;
+
+ Matrix44 view;
+ Matrix44 proj;
+
+ ShadowMap* shadowMap;
+ GpuMesh* immediateMesh;
+
+ SDL_Window* window;
+
+ int msaaSamples;
+};
+
+RenderContext gContext;
+
+
+// convert an OpenGL style projection matrix to D3D (clip z range [0, 1])
+Matrix44 ConvertToD3DProjection(const Matrix44& proj)
+{
+ Matrix44 scale = Matrix44::kIdentity;
+ scale.columns[2][2] = 0.5f;
+
+ Matrix44 bias = Matrix44::kIdentity;
+ bias.columns[3][2] = 1.0f;
+
+ return scale*bias*proj;
+}
+
+#define checkDxErrors(err) __checkDxErrors (err, __FILE__, __LINE__)
+
+inline void __checkDxErrors(HRESULT err, const char *file, const int line)
+{
+ if (FAILED(err))
+ {
+ char* lpMsgBuf;
+
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ err,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&lpMsgBuf,
+ 0, NULL);
+
+ fprintf(stdout, "DX Error = %04d \"%s\" from file <%s>, line %i.\n",
+ err, lpMsgBuf, file, line);
+
+ exit(EXIT_FAILURE);
+ }
+}
+
+void InitRender(SDL_Window* window, bool fullscreen, int msaaSamples)
+{
+ // must always have at least one sample
+ msaaSamples = Max(1, msaaSamples);
+
+ // create app graph context
+ gAppGraphCtx = AppGraphCtxCreate(0);
+
+ AppGraphCtxInitRenderTarget(gAppGraphCtx, window, fullscreen, msaaSamples);
+ //gScene = getScene(0);
+
+ float clearVal[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ AppGraphCtxFrameStart(gAppGraphCtx, clearVal);
+
+ // create imgui, connect to app graph context
+
+ ImguiGraphDesc desc;
+ desc.device = gAppGraphCtx->m_device;
+ desc.deviceContext = gAppGraphCtx->m_deviceContext;
+ desc.winW = gAppGraphCtx->m_winW;
+ desc.winH = gAppGraphCtx->m_winH;
+
+ imguiGraphInit("../../data/DroidSans.ttf", &desc);
+
+ AppGraphCtxFramePresent(gAppGraphCtx, true);
+
+ gPointRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext);
+ gMeshRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext);
+ gDebugLineRender.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext);
+ gDiffuseRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext);
+
+ // create a mesh for immediate mode rendering
+ gContext.immediateMesh = new GpuMesh(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext);
+
+ gContext.window = window;
+ gContext.msaaSamples = msaaSamples;
+}
+
+void GetRenderDevice(ID3D11Device** device, ID3D11DeviceContext** context)
+{
+ *device = gAppGraphCtx->m_device;
+ *context = gAppGraphCtx->m_deviceContext;
+}
+
+void ReshapeRender(SDL_Window* window)
+{
+ AppGraphCtxReleaseRenderTarget(gAppGraphCtx);
+ AppGraphCtxInitRenderTarget(gAppGraphCtx, window, false, gContext.msaaSamples);
+}
+
+void DestroyRender()
+{
+ gDebugLineRender.Destroy();
+ gMeshRenderer.Destroy();
+ gPointRenderer.Destroy();
+ gDiffuseRenderer.Destroy();
+
+ imguiGraphDestroy();
+
+ delete gContext.immediateMesh;
+
+ // do this first, since it flushes all GPU work
+ AppGraphCtxReleaseRenderTarget(gAppGraphCtx);
+ AppGraphCtxRelease(gAppGraphCtx);
+
+ gAppGraphCtx = nullptr;
+}
+
+void StartFrame(Vec4 clear)
+{
+ AppGraphCtxFrameStart(gAppGraphCtx, clear);
+
+ MeshDrawParams meshDrawParams;
+ memset(&meshDrawParams, 0, sizeof(MeshDrawParams));
+ meshDrawParams.renderStage = MESH_DRAW_LIGHT;
+ meshDrawParams.renderMode = MESH_RENDER_SOLID;
+ meshDrawParams.cullMode = MESH_CULL_BACK;
+ meshDrawParams.projection = (XMMATRIX)Matrix44::kIdentity;
+ meshDrawParams.view = (XMMATRIX)Matrix44::kIdentity;
+ meshDrawParams.model = DirectX::XMMatrixMultiply(
+ DirectX::XMMatrixScaling(1.0f, 1.0f, 1.0f),
+ DirectX::XMMatrixTranslation(0.0f, 0.0f, 0.0f)
+ );
+
+ gContext.mMeshDrawParams = meshDrawParams;
+}
+
+void FlushFrame()
+{
+ gAppGraphCtx->m_deviceContext->Flush();
+
+}
+
+void EndFrame()
+{
+ FlushFrame();
+
+ ImguiGraphDesc desc;
+ desc.device = gAppGraphCtx->m_device;
+ desc.deviceContext = gAppGraphCtx->m_deviceContext;
+ desc.winW = gAppGraphCtx->m_winW;
+ desc.winH = gAppGraphCtx->m_winH;
+
+ imguiGraphUpdate(&desc);
+}
+
+void PresentFrame(bool fullsync)
+{
+ AppGraphCtxFramePresent(gAppGraphCtx, fullsync);
+
+}
+
+void ReadFrame(int* backbuffer, int width, int height)
+{
+ assert(0);
+}
+
+void GetViewRay(int x, int y, Vec3& origin, Vec3& dir)
+{
+ using namespace DirectX;
+
+ XMVECTOR nearVector = XMVector3Unproject(XMVectorSet(float(x), float(gAppGraphCtx->m_winH-y), 0.0f, 0.0f), 0.0f, 0.0f, (float)gAppGraphCtx->m_winW, (float)gAppGraphCtx->m_winH, 0.0f, 1.0f, (XMMATRIX)gContext.proj, XMMatrixIdentity(), (XMMATRIX)gContext.view);
+ XMVECTOR farVector = XMVector3Unproject(XMVectorSet(float(x), float(gAppGraphCtx->m_winH-y), 1.0f, 0.0f), 0.0f, 0.0f, (float)gAppGraphCtx->m_winW, (float)gAppGraphCtx->m_winH, 0.0f, 1.0f, (XMMATRIX)gContext.proj, XMMatrixIdentity(), (XMMATRIX)gContext.view);
+
+ origin = Vec3(XMVectorGetX(nearVector), XMVectorGetY(nearVector), XMVectorGetZ(nearVector));
+ XMVECTOR tmp = farVector - nearVector;
+ dir = Normalize(Vec3(XMVectorGetX(tmp), XMVectorGetY(tmp), XMVectorGetZ(tmp)));
+
+}
+
+Colour gColors[] =
+{
+ Colour(0.0f, 0.5f, 1.0f),
+ Colour(0.797f, 0.354f, 0.000f),
+ Colour(0.092f, 0.465f, 0.820f),
+ Colour(0.000f, 0.349f, 0.173f),
+ Colour(0.875f, 0.782f, 0.051f),
+ Colour(0.000f, 0.170f, 0.453f),
+ Colour(0.673f, 0.111f, 0.000f),
+ Colour(0.612f, 0.194f, 0.394f)
+};
+
+
+void SetFillMode(bool wire)
+{
+ gContext.mMeshDrawParams.renderMode = wire?MESH_RENDER_WIREFRAME:MESH_RENDER_SOLID;
+}
+
+void SetCullMode(bool enabled)
+{
+ gContext.mMeshDrawParams.cullMode = enabled?MESH_CULL_BACK:MESH_CULL_NONE;
+}
+
+void SetView(Matrix44 view, Matrix44 projection)
+{
+ Matrix44 vp = projection*view;
+
+ gContext.mMeshDrawParams.model = (XMMATRIX)Matrix44::kIdentity;
+ gContext.mMeshDrawParams.view = (XMMATRIX)view;
+ gContext.mMeshDrawParams.projection = (XMMATRIX)(ConvertToD3DProjection(projection));
+
+ gContext.view = view;
+ gContext.proj = ConvertToD3DProjection(projection);
+}
+
+
+
+FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height)
+{
+ FluidRenderer* renderer = new(_aligned_malloc(sizeof(FluidRenderer), 16)) FluidRenderer();
+ renderer->Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext, width, height);
+
+ return renderer;
+}
+
+void DestroyFluidRenderer(FluidRenderer* renderer)
+{
+ renderer->Destroy();
+ renderer->~FluidRenderer();
+
+ _aligned_free(renderer);
+}
+
+FluidRenderBuffers CreateFluidRenderBuffers(int numParticles, bool enableInterop)
+{
+ FluidRenderBuffers buffers = {};
+ buffers.mNumFluidParticles = numParticles;
+
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = numParticles*sizeof(Vec4);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+ bufDesc.StructureByteStride = 0;
+
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mPositionVBO);
+
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[0]);
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[1]);
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[2]);
+
+ bufDesc.ByteWidth = numParticles*sizeof(float);
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDensityVBO);
+ }
+
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = numParticles * sizeof(int);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+ bufDesc.StructureByteStride = 0;
+
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mIndices);
+ }
+
+ if (enableInterop)
+ {
+ extern NvFlexLibrary* g_flexLib;
+
+ buffers.mPositionBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mPositionVBO, numParticles, sizeof(Vec4));
+ buffers.mDensitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDensityVBO, numParticles, sizeof(float));
+ buffers.mIndicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mIndices, numParticles, sizeof(int));
+
+ buffers.mAnisotropyBuf[0] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[0], numParticles, sizeof(Vec4));
+ buffers.mAnisotropyBuf[1] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[1], numParticles, sizeof(Vec4));
+ buffers.mAnisotropyBuf[2] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[2], numParticles, sizeof(Vec4));
+ }
+
+ return buffers;
+}
+
+void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, NvFlexSolver* solver, bool anisotropy, bool density)
+{
+ if (!anisotropy)
+ {
+ // regular particles
+ NvFlexGetParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles);
+ }
+ else
+ {
+ // fluid buffers
+ NvFlexGetSmoothParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles);
+ NvFlexGetAnisotropy(solver, buffers.mAnisotropyBuf[0], buffers.mAnisotropyBuf[1], buffers.mAnisotropyBuf[2]);
+ }
+
+ if (density)
+ {
+ NvFlexGetDensities(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles);
+ }
+ else
+ {
+ NvFlexGetPhases(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles);
+ }
+
+ NvFlexGetActive(solver, buffers.mIndicesBuf);
+}
+
+void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices)
+{
+ D3D11_MAPPED_SUBRESOURCE res;
+
+ // vertices
+ if (particles)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mPositionVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, particles, sizeof(Vec4)*numParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mPositionVBO, 0);
+ }
+
+ if (anisotropy1)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[0], 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, anisotropy1, sizeof(Vec4)*numParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[0], 0);
+ }
+
+ if (anisotropy2)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[1], 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, anisotropy2, sizeof(Vec4)*numParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[1], 0);
+ }
+
+ if (anisotropy3)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[2], 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, anisotropy3, sizeof(Vec4)*numParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[2], 0);
+ }
+
+ if (densities)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mDensityVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, densities, sizeof(float)*numParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mDensityVBO, 0);
+ }
+
+ // indices
+ if (indices)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mIndices, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, indices, sizeof(int)*numIndices);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mIndices, 0);
+ }
+
+}
+
+void DestroyFluidRenderBuffers(FluidRenderBuffers buffers)
+{
+ COMRelease(buffers.mPositionVBO);
+ COMRelease(buffers.mAnisotropyVBO[0]);
+ COMRelease(buffers.mAnisotropyVBO[1]);
+ COMRelease(buffers.mAnisotropyVBO[2]);
+ COMRelease(buffers.mDensityVBO);
+ COMRelease(buffers.mIndices);
+
+ NvFlexUnregisterD3DBuffer(buffers.mPositionBuf);
+ NvFlexUnregisterD3DBuffer(buffers.mDensitiesBuf);
+ NvFlexUnregisterD3DBuffer(buffers.mIndicesBuf);
+
+ NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[0]);
+ NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[1]);
+ NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[2]);
+}
+
+
+static const int kShadowResolution = 2048;
+
+
+ShadowMap* ShadowCreate()
+{
+ ShadowMap* shadowMap = new(_aligned_malloc(sizeof(ShadowMap), 16)) ShadowMap();
+ shadowMap->init(gAppGraphCtx->m_device, kShadowResolution);
+
+ return shadowMap;
+}
+
+void ShadowDestroy(ShadowMap* map)
+{
+ map->~ShadowMap();
+ _aligned_free(map);
+}
+
+void ShadowBegin(ShadowMap* map)
+{
+ ShadowMap* shadowMap = map;
+ shadowMap->bindAndClear(gAppGraphCtx->m_deviceContext);
+
+ gContext.mMeshDrawParams.renderStage = MESH_DRAW_SHADOW;
+}
+
+void ShadowEnd()
+{
+ AppGraphCtx* context = gAppGraphCtx;
+
+ // reset to main frame buffer
+ context->m_deviceContext->RSSetViewports(1, &context->m_viewport);
+ context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv);
+ context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u);
+ context->m_deviceContext->ClearDepthStencilView(context->m_dsv, D3D11_CLEAR_DEPTH, 1.0, 0);
+
+ gContext.mMeshDrawParams.renderStage = MESH_DRAW_NULL;
+
+}
+
+
+struct ShadowParams
+{
+ DirectX::XMMATRIX lightTransform;
+ float3 lightPos;
+ float3 lightDir;
+ float bias;
+ float4 shadowTaps[12];
+};
+
+void ShadowApply(ShadowParams* params, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, void* shadowTex)
+{
+ params->lightTransform = (DirectX::XMMATRIX&)(ConvertToD3DProjection(lightTransform));
+ params->lightPos = (float3&)lightPos;
+ params->lightDir = (float3&)Normalize(lightTarget - lightPos);
+ params->bias = gShadowBias;
+
+ const Vec4 taps[] =
+ {
+ Vec2(-0.326212f,-0.40581f), Vec2(-0.840144f,-0.07358f),
+ Vec2(-0.695914f,0.457137f), Vec2(-0.203345f,0.620716f),
+ Vec2(0.96234f,-0.194983f), Vec2(0.473434f,-0.480026f),
+ Vec2(0.519456f,0.767022f), Vec2(0.185461f,-0.893124f),
+ Vec2(0.507431f,0.064425f), Vec2(0.89642f,0.412458f),
+ Vec2(-0.32194f,-0.932615f), Vec2(-0.791559f,-0.59771f)
+ };
+ memcpy(params->shadowTaps, taps, sizeof(taps));
+
+}
+
+void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor)
+{
+ gContext.mMeshDrawParams.renderStage = MESH_DRAW_LIGHT;
+
+ gContext.mMeshDrawParams.grid = 0;
+ gContext.mMeshDrawParams.spotMin = gSpotMin;
+ gContext.mMeshDrawParams.spotMax = gSpotMax;
+ gContext.mMeshDrawParams.fogColor = (float4&)fogColor;
+
+ gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity;
+
+ ShadowParams shadow;
+ ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowMap);
+ gContext.mMeshDrawParams.lightTransform = shadow.lightTransform;
+ gContext.mMeshDrawParams.lightDir = shadow.lightDir;
+ gContext.mMeshDrawParams.lightPos = shadow.lightPos;
+ gContext.mMeshDrawParams.bias = shadow.bias;
+ memcpy(gContext.mMeshDrawParams.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps));
+
+ gContext.shadowMap = shadowMap;
+
+}
+
+void UnbindSolidShader()
+{
+ gContext.mMeshDrawParams.renderStage = MESH_DRAW_NULL;
+}
+
+void DrawMesh(const Mesh* m, Vec3 color)
+{
+ if (m)
+ {
+ if (m->m_colours.size())
+ {
+ gContext.mMeshDrawParams.colorArray = 1;
+ gContext.immediateMesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, (Vec4*)&m->m_colours[0], (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces()));
+ }
+ else
+ {
+ gContext.mMeshDrawParams.colorArray = 0;
+ gContext.immediateMesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces()));
+ }
+
+ gContext.mMeshDrawParams.color = (float4&)color;
+ gContext.mMeshDrawParams.secondaryColor = (float4&)color;
+ gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity;
+ gContext.mMeshDrawParams.shadowMap = gContext.shadowMap;
+
+ gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams);
+
+ if (m->m_colours.size())
+ gContext.mMeshDrawParams.colorArray = 0;
+
+ }
+}
+
+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)
+{
+ if (!numTris)
+ return;
+
+ gContext.immediateMesh->UpdateData(positions, normals, NULL, NULL, indices, numPositions, numTris);
+
+ if (twosided)
+ SetCullMode(false);
+
+ gContext.mMeshDrawParams.bias = 0.0f;
+ gContext.mMeshDrawParams.expand = expand;
+
+ gContext.mMeshDrawParams.color = (float4&)(gColors[colorIndex + 1] * 1.5f);
+ gContext.mMeshDrawParams.secondaryColor = (float4&)(gColors[colorIndex] * 1.5f);
+ gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity;
+ gContext.mMeshDrawParams.shadowMap = gContext.shadowMap;
+
+ gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams);
+
+ if (twosided)
+ SetCullMode(true);
+
+ gContext.mMeshDrawParams.bias = gShadowBias;
+ gContext.mMeshDrawParams.expand = 0.0f;
+
+}
+
+void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int color)
+{
+ if (numIndices < 2)
+ return;
+
+ std::vector<Vec3> vertices;
+ std::vector<Vec3> normals;
+ std::vector<int> triangles;
+
+ // flatten curve
+ std::vector<Vec3> curve(numIndices);
+ for (int i = 0; i < numIndices; ++i)
+ curve[i] = Vec3(positions[indices[i]]);
+
+ const int resolution = 8;
+ const int smoothing = 3;
+
+ vertices.reserve(resolution*numIndices*smoothing);
+ normals.reserve(resolution*numIndices*smoothing);
+ triangles.reserve(numIndices*resolution * 6 * smoothing);
+
+ Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing);
+
+ gContext.immediateMesh->UpdateData(&vertices[0], &normals[0], NULL, NULL, &triangles[0], int(vertices.size()), int(triangles.size())/3);
+
+ SetCullMode(false);
+
+ gContext.mMeshDrawParams.color = (float4&)(gColors[color % 8] * 1.5f);
+ gContext.mMeshDrawParams.secondaryColor = (float4&)(gColors[color % 8] * 1.5f);
+ gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity;
+ gContext.mMeshDrawParams.shadowMap = gContext.shadowMap;
+
+ gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams);
+
+ SetCullMode(true);
+}
+
+void DrawPlane(const Vec4& p, bool color)
+{
+ std::vector<Vec3> vertices;
+ std::vector<Vec3> normals;
+ std::vector<int> indices;
+
+ Vec3 u, v;
+ BasisFromVector(Vec3(p.x, p.y, p.z), &u, &v);
+
+ Vec3 c = Vec3(p.x, p.y, p.z)*-p.w;
+
+ gContext.mMeshDrawParams.shadowMap = gContext.shadowMap;
+
+ if (color)
+ gContext.mMeshDrawParams.color = (float4&)(p * 0.5f + Vec4(0.5f, 0.5f, 0.5f, 0.5f));
+
+ const float kSize = 200.0f;
+ const int kGrid = 3;
+
+ // draw a grid of quads, otherwise z precision suffers
+ for (int x = -kGrid; x <= kGrid; ++x)
+ {
+ for (int y = -kGrid; y <= kGrid; ++y)
+ {
+ Vec3 coff = c + u*float(x)*kSize*2.0f + v*float(y)*kSize*2.0f;
+
+ int indexStart = int(vertices.size());
+
+ vertices.push_back(Vec3(coff + u*kSize + v*kSize));
+ vertices.push_back(Vec3(coff - u*kSize + v*kSize));
+ vertices.push_back(Vec3(coff - u*kSize - v*kSize));
+ vertices.push_back(Vec3(coff + u*kSize - v*kSize));
+
+ normals.push_back(Vec3(p.x, p.y, p.z));
+ normals.push_back(Vec3(p.x, p.y, p.z));
+ normals.push_back(Vec3(p.x, p.y, p.z));
+ normals.push_back(Vec3(p.x, p.y, p.z));
+
+
+ indices.push_back(indexStart+0);
+ indices.push_back(indexStart+1);
+ indices.push_back(indexStart+2);
+
+ indices.push_back(indexStart+2);
+ indices.push_back(indexStart+3);
+ indices.push_back(indexStart+0);
+ }
+ }
+
+ gContext.immediateMesh->UpdateData(&vertices[0], &normals[0], NULL, NULL, &indices[0], int(vertices.size()), int(indices.size())/3);
+ gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams);
+}
+
+void DrawPlanes(Vec4* planes, int n, float bias)
+{
+ gContext.mMeshDrawParams.color = (float4&)Vec4(0.9f, 0.9f, 0.9f, 1.0f);
+
+ gContext.mMeshDrawParams.bias = 0.0f;
+ gContext.mMeshDrawParams.grid = 1;
+ gContext.mMeshDrawParams.expand = 0;
+
+ for (int i = 0; i < n; ++i)
+ {
+ Vec4 p = planes[i];
+ p.w -= bias;
+
+ DrawPlane(p, false);
+ }
+
+ gContext.mMeshDrawParams.grid = 0;
+ gContext.mMeshDrawParams.bias = gShadowBias;
+
+}
+
+GpuMesh* CreateGpuMesh(const Mesh* m)
+{
+ GpuMesh* mesh = new GpuMesh(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext);
+
+ mesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces()));
+
+ return mesh;
+}
+
+void DestroyGpuMesh(GpuMesh* m)
+{
+ delete m;
+}
+
+void DrawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color)
+{
+ if (m)
+ {
+ MeshDrawParams params = gContext.mMeshDrawParams;
+
+ params.color = (float4&)color;
+ params.secondaryColor = (float4&)color;
+ params.objectTransform = (float4x4&)xform;
+ params.shadowMap = gContext.shadowMap;
+
+ gMeshRenderer.Draw(m, &params);
+ }
+}
+
+void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color)
+{
+ if (m)
+ {
+ gContext.mMeshDrawParams.color = (float4&)color;
+ gContext.mMeshDrawParams.secondaryColor = (float4&)color;
+ gContext.mMeshDrawParams.shadowMap = gContext.shadowMap;
+
+ // copy params
+ MeshDrawParams params = gContext.mMeshDrawParams;
+
+ for (int i = 0; i < n; ++i)
+ {
+ params.objectTransform = (float4x4&)xforms[i];
+
+ gMeshRenderer.Draw(m, &params);
+ }
+ }
+}
+
+void DrawPoints(VertexBuffer positions, VertexBuffer colors, IndexBuffer indices, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity)
+{
+ if (n == 0)
+ return;
+
+ PointDrawParams params;
+
+ params.renderMode = POINT_RENDER_SOLID;
+ params.cullMode = POINT_CULL_BACK;
+ params.model = (XMMATRIX&)Matrix44::kIdentity;
+ params.view = (XMMATRIX&)gContext.view;
+ params.projection = (XMMATRIX&)gContext.proj;
+
+ params.pointRadius = radius;
+ params.pointScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f)));
+ params.spotMin = gSpotMin;
+ params.spotMax = gSpotMax;
+
+ int mode = 0;
+ if (showDensity)
+ mode = 1;
+ if (shadowTex == 0)
+ mode = 2;
+ params.mode = mode;
+
+ for (int i = 0; i < 8; i++)
+ params.colors[i] = *((float4*)&gColors[i].r);
+
+ // set shadow parameters
+ ShadowParams shadow;
+ ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowTex);
+ params.lightTransform = shadow.lightTransform;
+ params.lightDir = shadow.lightDir;
+ params.lightPos = shadow.lightPos;
+ memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps));
+
+ if (gContext.mMeshDrawParams.renderStage == MESH_DRAW_SHADOW)
+ {
+ params.renderStage = POINT_DRAW_SHADOW;
+ params.mode = 2;
+ }
+ else
+ params.renderStage = POINT_DRAW_LIGHT;
+
+ params.shadowMap = gContext.shadowMap;
+
+ gPointRenderer.Draw(&params, positions, colors, indices, n, offset);
+
+}
+
+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)
+{
+ if (n == 0)
+ return;
+
+ FluidDrawParams params;
+
+ params.renderMode = FLUID_RENDER_SOLID;
+ params.cullMode = FLUID_CULL_BACK;
+ params.model = (XMMATRIX&)Matrix44::kIdentity;
+ params.view = (XMMATRIX&)gContext.view;
+ params.projection = (XMMATRIX&)gContext.proj;
+
+ params.offset = offset;
+ params.n = n;
+ params.renderStage = FLUID_DRAW_LIGHT;
+
+ const float viewHeight = tanf(fov / 2.0f);
+ params.invViewport = float3(1.0f / screenWidth, screenAspect / screenWidth, 1.0f);
+ params.invProjection = float3(screenAspect * viewHeight, viewHeight, 1.0f);
+
+ params.shadowMap = gContext.shadowMap;
+
+ renderer->mDepthTex.BindAndClear(gAppGraphCtx->m_deviceContext);
+
+ // draw static shapes into depth buffer
+ //DrawShapes();
+
+ renderer->DrawEllipsoids(&params, &buffers);
+
+
+ //---------------------------------------------------------------
+ // build smooth depth
+
+ renderer->mDepthSmoothTex.BindAndClear(gAppGraphCtx->m_deviceContext);
+
+ params.blurRadiusWorld = radius * 0.5f;
+ params.blurScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f)));
+ params.invTexScale = float4(1.0f / screenAspect, 1.0f, 0.0f, 0.0f);
+ params.blurFalloff = blur;
+ params.debug = debug;
+
+ renderer->DrawBlurDepth(&params);
+
+ //---------------------------------------------------------------
+ // composite
+
+ AppGraphCtx* context = gAppGraphCtx;
+
+ {
+ context->m_deviceContext->RSSetViewports(1, &context->m_viewport);
+ context->m_deviceContext->RSSetScissorRects(0, nullptr);
+
+ context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv);
+ context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u);
+
+ float blendFactor[4] = { 1.0, 1.0, 1.0, 1.0 };
+ context->m_deviceContext->OMSetBlendState(context->m_blendState, blendFactor, 0xffff);
+ }
+
+ params.invTexScale = (float4&)Vec2(1.0f / screenWidth, screenAspect / screenWidth);
+ params.clipPosToEye = (float4&)Vec2(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f));
+ params.color = (float4&)color;
+ params.ior = ior;
+ params.spotMin = gSpotMin;
+ params.spotMax = gSpotMax;
+ params.debug = debug;
+
+ params.lightPos = (float3&)lightPos;
+ params.lightDir = (float3&)-Normalize(lightTarget - lightPos);
+ params.lightTransform = (XMMATRIX&)(ConvertToD3DProjection(lightTransform));
+
+
+ AppGraphCtxResolveFrame(context);
+
+
+ renderer->DrawComposite(&params, context->m_resolvedTargetSRV);
+
+ {
+ AppGraphCtx* context = gAppGraphCtx;
+ context->m_deviceContext->OMSetBlendState(nullptr, 0, 0xffff);
+ }
+}
+
+DiffuseRenderBuffers CreateDiffuseRenderBuffers(int numParticles, bool& enableInterop)
+{
+ DiffuseRenderBuffers buffers = {};
+ buffers.mNumDiffuseParticles = numParticles;
+ if (numParticles > 0)
+ {
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = numParticles * sizeof(Vec4);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+ if (enableInterop)
+ {
+ bufDesc.CPUAccessFlags = 0;
+ bufDesc.Usage = D3D11_USAGE_DEFAULT;
+ bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
+ }
+
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffusePositionVBO);
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffuseVelocityVBO);
+ }
+
+ {
+ D3D11_BUFFER_DESC bufDesc;
+ bufDesc.ByteWidth = numParticles * sizeof(int);
+ bufDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufDesc.MiscFlags = 0;
+ if (enableInterop)
+ {
+ bufDesc.CPUAccessFlags = 0;
+ bufDesc.Usage = D3D11_USAGE_DEFAULT;
+ bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
+ }
+
+ gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffuseIndicesIBO);
+ }
+
+ if (enableInterop)
+ {
+ extern NvFlexLibrary* g_flexLib;
+
+ buffers.mDiffuseIndicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffuseIndicesIBO, numParticles, sizeof(int));
+ buffers.mDiffusePositionsBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffusePositionVBO, numParticles, sizeof(Vec4));
+ buffers.mDiffuseVelocitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffuseVelocityVBO, numParticles, sizeof(Vec4));
+
+ if (buffers.mDiffuseIndicesBuf == nullptr ||
+ buffers.mDiffusePositionsBuf == nullptr ||
+ buffers.mDiffuseVelocitiesBuf == nullptr)
+ enableInterop = false;
+ }
+ }
+
+ return buffers;
+}
+
+void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers buffers)
+{
+ if (buffers.mNumDiffuseParticles > 0)
+ {
+ COMRelease(buffers.mDiffusePositionVBO);
+ COMRelease(buffers.mDiffuseVelocityVBO);
+ COMRelease(buffers.mDiffuseIndicesIBO);
+
+ NvFlexUnregisterD3DBuffer(buffers.mDiffuseIndicesBuf);
+ NvFlexUnregisterD3DBuffer(buffers.mDiffusePositionsBuf);
+ NvFlexUnregisterD3DBuffer(buffers.mDiffuseVelocitiesBuf);
+ }
+}
+
+void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, NvFlexSolver* solver)
+{
+ // diffuse particles
+ if (buffers.mNumDiffuseParticles)
+ {
+ NvFlexGetDiffuseParticles(solver, buffers.mDiffusePositionsBuf, buffers.mDiffuseVelocitiesBuf, buffers.mDiffuseIndicesBuf);
+ }
+}
+
+void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int* diffuseIndices, int numDiffuseParticles)
+{
+ D3D11_MAPPED_SUBRESOURCE res;
+
+ // vertices
+ if (diffusePositions)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mDiffusePositionVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, diffusePositions, sizeof(Vec4)*numDiffuseParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffusePositionVBO, 0);
+ }
+
+ if (diffuseVelocities)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mDiffuseVelocityVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, diffuseVelocities, sizeof(Vec4)*numDiffuseParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffuseVelocityVBO, 0);
+ }
+
+ if (diffuseIndices)
+ {
+ gAppGraphCtx->m_deviceContext->Map(buffers.mDiffuseIndicesIBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res);
+ memcpy(res.pData, diffuseIndices, sizeof(int)*numDiffuseParticles);
+ gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffuseIndicesIBO, 0);
+ }
+
+}
+
+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)
+{
+ if (n == 0)
+ return;
+
+ DiffuseDrawParams params;
+
+ params.model = (const XMMATRIX&)Matrix44::kIdentity;
+ params.view = (const XMMATRIX&)gContext.view;
+ params.projection = (const XMMATRIX&)gContext.proj;
+ params.diffuseRadius = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f)));
+ params.diffuseScale = radius;
+ params.spotMin = gSpotMin;
+ params.spotMax = gSpotMax;
+ params.color = float4(1.0f, 1.0f, 1.0f, 1.0f);
+ params.motionScale = motionBlur;
+
+ // set shadow parameters
+ ShadowParams shadow;
+ ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowMap);
+ params.lightTransform = shadow.lightTransform;
+ params.lightDir = shadow.lightDir;
+ params.lightPos = shadow.lightPos;
+ params.shadowMap = gContext.shadowMap;
+
+ memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps));
+
+
+ gDiffuseRenderer.Draw(&params, buffers.mDiffusePositionVBO, buffers.mDiffuseVelocityVBO, buffers.mDiffuseIndicesIBO, n);
+
+ // reset depth stencil state
+ gAppGraphCtx->m_deviceContext->OMSetDepthStencilState(gAppGraphCtx->m_depthState, 0u);
+
+
+}
+
+
+void BeginLines()
+{
+
+}
+
+void DrawLine(const Vec3& p, const Vec3& q, const Vec4& color)
+{
+ gDebugLineRender.AddLine(p, q, color);
+}
+
+void EndLines()
+{
+ // draw
+ Matrix44 projectionViewWorld = ((Matrix44&)(gContext.mMeshDrawParams.projection))*((Matrix44&)(gContext.mMeshDrawParams.view));
+
+ gDebugLineRender.FlushLines(projectionViewWorld);
+}
+
+void BeginPoints(float size) {}
+void DrawPoint(const Vec3& p, const Vec4& color) {}
+void EndPoints() {}
+
diff --git a/demo/d3d11/shadowMap.cpp b/demo/d3d11/shadowMap.cpp
new file mode 100644
index 0000000..403ec59
--- /dev/null
+++ b/demo/d3d11/shadowMap.cpp
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#include "shadowMap.h"
+
+ShadowMap::ShadowMap()
+{
+}
+
+static D3D11_TEXTURE2D_DESC _getTextureDesc(DXGI_FORMAT format, UINT width, UINT height,
+ UINT bindFlags, UINT sampleCount = 1, D3D11_USAGE usage = D3D11_USAGE_DEFAULT, UINT cpuAccessFlags = 0,
+ UINT miscFlags = 0, UINT arraySize = 1, UINT mipLevels = 1)
+{
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Format = format;
+ desc.Width = width;
+ desc.Height = height;
+
+ desc.ArraySize = arraySize;
+ desc.MiscFlags = miscFlags;
+ desc.MipLevels = mipLevels;
+
+ desc.SampleDesc.Count = sampleCount;
+ desc.SampleDesc.Quality = 0;
+ desc.BindFlags = bindFlags;
+ desc.Usage = usage;
+ desc.CPUAccessFlags = cpuAccessFlags;
+ return desc;
+}
+
+static D3D11_DEPTH_STENCIL_VIEW_DESC _getDsvDesc(DXGI_FORMAT format, D3D11_DSV_DIMENSION viewDimension, UINT flags = 0, UINT mipSlice = 0)
+{
+ D3D11_DEPTH_STENCIL_VIEW_DESC desc;
+ desc.Format = format;
+ desc.ViewDimension = viewDimension;
+ desc.Flags = flags;
+ desc.Texture2D.MipSlice = mipSlice;
+ return desc;
+}
+
+static D3D11_SHADER_RESOURCE_VIEW_DESC _getSrvDesc(DXGI_FORMAT format)
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC desc;
+ desc.Format = format;
+ desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ desc.Texture2D.MostDetailedMip = 0;
+ desc.Texture2D.MipLevels = -1;
+
+ return desc;
+}
+
+HRESULT ShadowMap::init(ID3D11Device* device, int resolution)
+{
+ // set viewport
+ {
+ m_viewport.Width = float(resolution);
+ m_viewport.Height = float(resolution);
+ m_viewport.MinDepth = 0;
+ m_viewport.MaxDepth = 1;
+ m_viewport.TopLeftX = 0;
+ m_viewport.TopLeftY = 0;
+ }
+
+ // create shadow render target
+ {
+ D3D11_TEXTURE2D_DESC texDesc = _getTextureDesc(DXGI_FORMAT_R32_FLOAT, UINT(resolution), UINT(resolution),
+ D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE);
+
+ NV_RETURN_ON_FAIL(device->CreateTexture2D(&texDesc, NV_NULL, m_backTexture.ReleaseAndGetAddressOf()));
+ NV_RETURN_ON_FAIL(device->CreateShaderResourceView(m_backTexture.Get(), NV_NULL, m_backSrv.ReleaseAndGetAddressOf()));
+ NV_RETURN_ON_FAIL(device->CreateRenderTargetView(m_backTexture.Get(), NV_NULL, m_backRtv.ReleaseAndGetAddressOf()));
+ }
+
+ // create shadow depth stencil
+ {
+ D3D11_TEXTURE2D_DESC texDesc = _getTextureDesc(DXGI_FORMAT_R32_TYPELESS, UINT(resolution), UINT(resolution),
+ D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE);
+ NV_RETURN_ON_FAIL(device->CreateTexture2D(&texDesc, NV_NULL, m_depthTexture.ReleaseAndGetAddressOf()));
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc = _getDsvDesc(DXGI_FORMAT_D32_FLOAT, D3D11_DSV_DIMENSION_TEXTURE2D);
+ NV_RETURN_ON_FAIL(device->CreateDepthStencilView(m_depthTexture.Get(), &dsvDesc, m_depthDsv.ReleaseAndGetAddressOf()));
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = _getSrvDesc(DXGI_FORMAT_R32_FLOAT);
+ NV_RETURN_ON_FAIL(device->CreateShaderResourceView(m_depthTexture.Get(), &srvDesc, m_depthSrv.ReleaseAndGetAddressOf()));
+ }
+
+ {
+ // example texture sampler (use any texture sampler of your own choice)
+ D3D11_SAMPLER_DESC samplerDesc =
+ {
+ D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ 0.0, 0, D3D11_COMPARISON_LESS_EQUAL,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, D3D11_FLOAT32_MAX,
+ };
+ NV_RETURN_ON_FAIL(device->CreateSamplerState(&samplerDesc, m_linearSampler.ReleaseAndGetAddressOf()));
+ }
+ {
+ D3D11_SAMPLER_DESC samplerDesc =
+ {
+ D3D11_FILTER_MIN_MAG_MIP_POINT,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ D3D11_TEXTURE_ADDRESS_CLAMP,
+ 0.0, 0, D3D11_COMPARISON_NEVER,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, D3D11_FLOAT32_MAX,
+ };
+ NV_RETURN_ON_FAIL(device->CreateSamplerState(&samplerDesc, m_pointSampler.ReleaseAndGetAddressOf()));
+ }
+
+ return S_OK;
+}
+
+void ShadowMap::bindAndClear(ID3D11DeviceContext* context)
+{
+ ID3D11RenderTargetView* ppRtv[1] = { m_backRtv.Get() };
+ context->OMSetRenderTargets(1, ppRtv, m_depthDsv.Get());
+
+ context->RSSetViewports(1, &m_viewport);
+
+ float clearDepth = FLT_MAX;
+ float clearColor[4] = { clearDepth, clearDepth, clearDepth, clearDepth };
+
+ context->ClearRenderTargetView(m_backRtv.Get(), clearColor);
+ context->ClearDepthStencilView(m_depthDsv.Get(), D3D11_CLEAR_DEPTH, 1.0, 0);
+}
+
+void ShadowMap::setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up)
+{
+ float sizeX = 50.0f;
+ float sizeY = 50.0f;
+ float znear = -200.0f;
+ float zfar = 200.0f;
+
+ setLightMatrices(eye, at, up, sizeX, sizeY, znear, zfar);
+}
+
+void ShadowMap::setLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar)
+{
+ m_lightView = XMMatrixLookAtLH(eye, lookAt, up);
+
+ m_lightProjection = XMMatrixOrthographicLH(sizeX, sizeY, zNear, zFar);
+
+ DirectX::XMMATRIX clip2Tex(0.5, 0, 0, 0,
+ 0, -0.5, 0, 0,
+ 0, 0, 1, 0,
+ 0.5, 0.5, 0, 1);
+
+ DirectX::XMMATRIX viewProjection = m_lightView * m_lightProjection;
+ m_lightWorldToTex = viewProjection * clip2Tex;
+}
diff --git a/demo/d3d11/shadowMap.h b/demo/d3d11/shadowMap.h
new file mode 100644
index 0000000..2ed15ca
--- /dev/null
+++ b/demo/d3d11/shadowMap.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+#pragma once
+
+#include <d3d11.h>
+#include <DirectXMath.h>
+#include <wrl.h>
+
+using namespace DirectX;
+using namespace Microsoft::WRL;
+
+#define NV_NULL nullptr
+#define NV_RETURN_ON_FAIL(x) { HRESULT _res = (x); if (FAILED(_res)) { return _res; } }
+
+struct ShadowMap
+{
+
+ ShadowMap();
+
+ HRESULT init(ID3D11Device* device, int resolution);
+
+ void setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up);
+ void setLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar);
+
+ void bindAndClear(ID3D11DeviceContext* context);
+
+ XMMATRIX m_lightView;
+ XMMATRIX m_lightProjection;
+ XMMATRIX m_lightWorldToTex;
+
+ ComPtr<ID3D11Texture2D> m_backTexture;
+ ComPtr<ID3D11RenderTargetView> m_backRtv;
+ ComPtr<ID3D11ShaderResourceView> m_backSrv;
+
+ ComPtr<ID3D11Texture2D> m_depthTexture;
+ ComPtr<ID3D11DepthStencilView> m_depthDsv;
+ ComPtr<ID3D11ShaderResourceView> m_depthSrv;
+
+ ComPtr<ID3D11SamplerState> m_linearSampler;
+ ComPtr<ID3D11SamplerState> m_pointSampler;
+
+ D3D11_VIEWPORT m_viewport;
+};
diff --git a/demo/helpers.h b/demo/helpers.h
new file mode 100644
index 0000000..5aec028
--- /dev/null
+++ b/demo/helpers.h
@@ -0,0 +1,1698 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2013-2017 NVIDIA Corporation. All rights reserved.
+
+#pragma once
+
+#include <stdarg.h>
+
+// disable some warnings
+#if _WIN32
+#pragma warning(disable: 4267) // conversion from 'size_t' to 'int', possible loss of data
+#endif
+
+float SampleSDF(const float* sdf, int dim, int x, int y, int z)
+{
+ assert(x < dim && x >= 0);
+ assert(y < dim && y >= 0);
+ assert(z < dim && z >= 0);
+
+ return sdf[z*dim*dim + y*dim + x];
+}
+
+// return normal of signed distance field
+Vec3 SampleSDFGrad(const float* sdf, int dim, int x, int y, int z)
+{
+ int x0 = max(x-1, 0);
+ int x1 = min(x+1, dim-1);
+
+ int y0 = max(y-1, 0);
+ int y1 = min(y+1, dim-1);
+
+ int z0 = max(z-1, 0);
+ int z1 = min(z+1, dim-1);
+
+ float dx = (SampleSDF(sdf, dim, x1, y, z) - SampleSDF(sdf, dim, x0, y, z))*(dim*0.5f);
+ float dy = (SampleSDF(sdf, dim, x, y1, z) - SampleSDF(sdf, dim, x, y0, z))*(dim*0.5f);
+ float dz = (SampleSDF(sdf, dim, x, y, z1) - SampleSDF(sdf, dim, x, y, z0))*(dim*0.5f);
+
+ return Vec3(dx, dy, dz);
+}
+
+void GetParticleBounds(Vec3& lower, Vec3& upper)
+{
+ lower = Vec3(FLT_MAX);
+ upper = Vec3(-FLT_MAX);
+
+ for (int i=0; i < g_buffers->positions.size(); ++i)
+ {
+ lower = Min(Vec3(g_buffers->positions[i]), lower);
+ upper = Max(Vec3(g_buffers->positions[i]), upper);
+ }
+}
+
+
+void CreateParticleGrid(Vec3 lower, int dimx, int dimy, int dimz, float radius, Vec3 velocity, float invMass, bool rigid, float rigidStiffness, int phase, float jitter=0.005f)
+{
+ if (rigid && g_buffers->rigidIndices.empty())
+ g_buffers->rigidOffsets.push_back(0);
+
+ for (int x = 0; x < dimx; ++x)
+ {
+ for (int y = 0; y < dimy; ++y)
+ {
+ for (int z=0; z < dimz; ++z)
+ {
+ if (rigid)
+ g_buffers->rigidIndices.push_back(int(g_buffers->positions.size()));
+
+ Vec3 position = lower + Vec3(float(x), float(y), float(z))*radius + RandomUnitVector()*jitter;
+
+ g_buffers->positions.push_back(Vec4(position.x, position.y, position.z, invMass));
+ g_buffers->velocities.push_back(velocity);
+ g_buffers->phases.push_back(phase);
+ }
+ }
+ }
+
+ if (rigid)
+ {
+ g_buffers->rigidCoefficients.push_back(rigidStiffness);
+ g_buffers->rigidOffsets.push_back(int(g_buffers->rigidIndices.size()));
+ }
+}
+
+void CreateParticleSphere(Vec3 center, int dim, float radius, Vec3 velocity, float invMass, bool rigid, float rigidStiffness, int phase, float jitter=0.005f)
+{
+ if (rigid && g_buffers->rigidIndices.empty())
+ g_buffers->rigidOffsets.push_back(0);
+
+ for (int x=0; x <= dim; ++x)
+ {
+ for (int y=0; y <= dim; ++y)
+ {
+ for (int z=0; z <= dim; ++z)
+ {
+ float sx = x - dim*0.5f;
+ float sy = y - dim*0.5f;
+ float sz = z - dim*0.5f;
+
+ if (sx*sx + sy*sy + sz*sz <= float(dim*dim)*0.25f)
+ {
+ if (rigid)
+ g_buffers->rigidIndices.push_back(int(g_buffers->positions.size()));
+
+ Vec3 position = center + radius*Vec3(sx, sy, sz) + RandomUnitVector()*jitter;
+
+ g_buffers->positions.push_back(Vec4(position.x, position.y, position.z, invMass));
+ g_buffers->velocities.push_back(velocity);
+ g_buffers->phases.push_back(phase);
+ }
+ }
+ }
+ }
+
+ if (rigid)
+ {
+ g_buffers->rigidCoefficients.push_back(rigidStiffness);
+ g_buffers->rigidOffsets.push_back(int(g_buffers->rigidIndices.size()));
+ }
+}
+
+void CreateSpring(int i, int j, float stiffness, float give=0.0f)
+{
+ g_buffers->springIndices.push_back(i);
+ g_buffers->springIndices.push_back(j);
+ g_buffers->springLengths.push_back((1.0f+give)*Length(Vec3(g_buffers->positions[i])-Vec3(g_buffers->positions[j])));
+ g_buffers->springStiffness.push_back(stiffness);
+}
+
+
+void CreateParticleShape(const Mesh* srcMesh, Vec3 lower, Vec3 scale, float rotation, float spacing, Vec3 velocity, float invMass, bool rigid, float rigidStiffness, int phase, bool skin, float jitter=0.005f, Vec3 skinOffset=0.0f, float skinExpand=0.0f, Vec4 color=Vec4(0.0f), float springStiffness=0.0f)
+{
+ if (rigid && g_buffers->rigidIndices.empty())
+ g_buffers->rigidOffsets.push_back(0);
+
+ if (!srcMesh)
+ return;
+
+ // duplicate mesh
+ Mesh mesh;
+ mesh.AddMesh(*srcMesh);
+
+ int startIndex = int(g_buffers->positions.size());
+
+ {
+ mesh.Transform(RotationMatrix(rotation, Vec3(0.0f, 1.0f, 0.0f)));
+
+ Vec3 meshLower, meshUpper;
+ mesh.GetBounds(meshLower, meshUpper);
+
+ Vec3 edges = meshUpper-meshLower;
+ float maxEdge = max(max(edges.x, edges.y), edges.z);
+
+ // put mesh at the origin and scale to specified size
+ Matrix44 xform = ScaleMatrix(scale/maxEdge)*TranslationMatrix(Point3(-meshLower));
+
+ mesh.Transform(xform);
+ mesh.GetBounds(meshLower, meshUpper);
+
+ // recompute expanded edges
+ edges = meshUpper-meshLower;
+ maxEdge = max(max(edges.x, edges.y), edges.z);
+
+ // tweak spacing to avoid edge cases for particles laying on the boundary
+ // just covers the case where an edge is a whole multiple of the spacing.
+ float spacingEps = spacing*(1.0f - 1e-4f);
+
+ // make sure to have at least one particle in each dimension
+ int dx, dy, dz;
+ dx = spacing > edges.x ? 1 : int(edges.x/spacingEps);
+ dy = spacing > edges.y ? 1 : int(edges.y/spacingEps);
+ dz = spacing > edges.z ? 1 : int(edges.z/spacingEps);
+
+ int maxDim = max(max(dx, dy), dz);
+
+ // expand border by two voxels to ensure adequate sampling at edges
+ meshLower -= 2.0f*Vec3(spacing);
+ meshUpper += 2.0f*Vec3(spacing);
+ maxDim += 4;
+
+ vector<uint32_t> voxels(maxDim*maxDim*maxDim);
+
+ // we shift the voxelization bounds so that the voxel centers
+ // lie symmetrically to the center of the object. this reduces the
+ // chance of missing features, and also better aligns the particles
+ // with the mesh
+ Vec3 meshOffset;
+ meshOffset.x = 0.5f * (spacing - (edges.x - (dx-1)*spacing));
+ meshOffset.y = 0.5f * (spacing - (edges.y - (dy-1)*spacing));
+ meshOffset.z = 0.5f * (spacing - (edges.z - (dz-1)*spacing));
+ meshLower -= meshOffset;
+
+ //Voxelize(*mesh, dx, dy, dz, &voxels[0], meshLower - Vec3(spacing*0.05f) , meshLower + Vec3(maxDim*spacing) + Vec3(spacing*0.05f));
+ Voxelize((const float*)&mesh.m_positions[0], mesh.m_positions.size(), (const int*)&mesh.m_indices[0], mesh.m_indices.size(), maxDim, maxDim, maxDim, &voxels[0], meshLower, meshLower + Vec3(maxDim*spacing));
+
+ vector<int> indices(maxDim*maxDim*maxDim);
+ vector<float> sdf(maxDim*maxDim*maxDim);
+ MakeSDF(&voxels[0], maxDim, maxDim, maxDim, &sdf[0]);
+
+ for (int x=0; x < maxDim; ++x)
+ {
+ for (int y=0; y < maxDim; ++y)
+ {
+ for (int z=0; z < maxDim; ++z)
+ {
+ const int index = z*maxDim*maxDim + y*maxDim + x;
+
+ // if voxel is marked as occupied the add a particle
+ if (voxels[index])
+ {
+ if (rigid)
+ g_buffers->rigidIndices.push_back(int(g_buffers->positions.size()));
+
+ Vec3 position = lower + meshLower + spacing*Vec3(float(x) + 0.5f, float(y) + 0.5f, float(z) + 0.5f) + RandomUnitVector()*jitter;
+
+ // normalize the sdf value and transform to world scale
+ Vec3 n = SafeNormalize(SampleSDFGrad(&sdf[0], maxDim, x, y, z));
+ float d = sdf[index]*maxEdge;
+
+ if (rigid)
+ g_buffers->rigidLocalNormals.push_back(Vec4(n, d));
+
+ // track which particles are in which cells
+ indices[index] = g_buffers->positions.size();
+
+ g_buffers->positions.push_back(Vec4(position.x, position.y, position.z, invMass));
+ g_buffers->velocities.push_back(velocity);
+ g_buffers->phases.push_back(phase);
+ }
+ }
+ }
+ }
+ mesh.Transform(ScaleMatrix(1.0f + skinExpand)*TranslationMatrix(Point3(-0.5f*(meshUpper+meshLower))));
+ mesh.Transform(TranslationMatrix(Point3(lower + 0.5f*(meshUpper+meshLower))));
+
+
+ if (springStiffness > 0.0f)
+ {
+ // construct cross link springs to occupied cells
+ for (int x=0; x < maxDim; ++x)
+ {
+ for (int y=0; y < maxDim; ++y)
+ {
+ for (int z=0; z < maxDim; ++z)
+ {
+ const int centerCell = z*maxDim*maxDim + y*maxDim + x;
+
+ // if voxel is marked as occupied the add a particle
+ if (voxels[centerCell])
+ {
+ const int width = 1;
+
+ // create springs to all the neighbors within the width
+ for (int i=x-width; i <= x+width; ++i)
+ {
+ for (int j=y-width; j <= y+width; ++j)
+ {
+ for (int k=z-width; k <= z+width; ++k)
+ {
+ const int neighborCell = k*maxDim*maxDim + j*maxDim + i;
+
+ if (neighborCell > 0 && neighborCell < int(voxels.size()) && voxels[neighborCell] && neighborCell != centerCell)
+ {
+ CreateSpring(indices[neighborCell], indices[centerCell], springStiffness);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+
+ if (skin)
+ {
+ g_buffers->rigidMeshSize.push_back(mesh.GetNumVertices());
+
+ int startVertex = 0;
+
+ if (!g_mesh)
+ g_mesh = new Mesh();
+
+ // append to mesh
+ startVertex = g_mesh->GetNumVertices();
+
+ g_mesh->Transform(TranslationMatrix(Point3(skinOffset)));
+ g_mesh->AddMesh(mesh);
+
+ const Colour colors[7] =
+ {
+ Colour(0.0f, 0.5f, 1.0f),
+ Colour(0.797f, 0.354f, 0.000f),
+ Colour(0.000f, 0.349f, 0.173f),
+ Colour(0.875f, 0.782f, 0.051f),
+ Colour(0.01f, 0.170f, 0.453f),
+ Colour(0.673f, 0.111f, 0.000f),
+ Colour(0.612f, 0.194f, 0.394f)
+ };
+
+ for (uint32_t i=startVertex; i < g_mesh->GetNumVertices(); ++i)
+ {
+ int indices[g_numSkinWeights] = { -1, -1, -1, -1 };
+ float distances[g_numSkinWeights] = {FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX };
+
+ if (LengthSq(color) == 0.0f)
+ g_mesh->m_colours[i] = 1.25f*colors[phase%7];
+ else
+ g_mesh->m_colours[i] = Colour(color);
+
+ // find closest n particles
+ for (int j=startIndex; j < g_buffers->positions.size(); ++j)
+ {
+ float dSq = LengthSq(Vec3(g_mesh->m_positions[i])-Vec3(g_buffers->positions[j]));
+
+ // insertion sort
+ int w=0;
+ for (; w < 4; ++w)
+ if (dSq < distances[w])
+ break;
+
+ if (w < 4)
+ {
+ // shuffle down
+ for (int s=3; s > w; --s)
+ {
+ indices[s] = indices[s-1];
+ distances[s] = distances[s-1];
+ }
+
+ distances[w] = dSq;
+ indices[w] = int(j);
+ }
+ }
+
+ // weight particles according to distance
+ float wSum = 0.0f;
+
+ for (int w=0; w < 4; ++w)
+ {
+ // convert to inverse distance
+ distances[w] = 1.0f/(0.1f + powf(distances[w], .125f));
+
+ wSum += distances[w];
+
+ }
+
+ float weights[4];
+ for (int w=0; w < 4; ++w)
+ weights[w] = distances[w]/wSum;
+
+ for (int j=0; j < 4; ++j)
+ {
+ g_meshSkinIndices.push_back(indices[j]);
+ g_meshSkinWeights.push_back(weights[j]);
+ }
+ }
+ }
+
+ if (rigid)
+ {
+ g_buffers->rigidCoefficients.push_back(rigidStiffness);
+ g_buffers->rigidOffsets.push_back(int(g_buffers->rigidIndices.size()));
+ }
+}
+
+// wrapper to create shape from a filename
+void CreateParticleShape(const char* filename, Vec3 lower, Vec3 scale, float rotation, float spacing, Vec3 velocity, float invMass, bool rigid, float rigidStiffness, int phase, bool skin, float jitter=0.005f, Vec3 skinOffset=0.0f, float skinExpand=0.0f, Vec4 color=Vec4(0.0f), float springStiffness=0.0f)
+{
+ Mesh* mesh = ImportMesh(filename);
+ if (mesh)
+ CreateParticleShape(mesh, lower, scale, rotation, spacing, velocity, invMass, rigid, rigidStiffness, phase, skin, jitter, skinOffset, skinExpand, color, springStiffness);
+
+ delete mesh;
+}
+
+void SkinMesh()
+{
+ if (g_mesh)
+ {
+ int startVertex = 0;
+
+ for (int r=0; r < g_buffers->rigidRotations.size(); ++r)
+ {
+ const Matrix33 rotation = g_buffers->rigidRotations[r];
+ const int numVertices = g_buffers->rigidMeshSize[r];
+
+ for (int i=startVertex; i < numVertices+startVertex; ++i)
+ {
+ Vec3 skinPos;
+
+ for (int w=0; w < 4; ++w)
+ {
+ // small shapes can have < 4 particles
+ if (g_meshSkinIndices[i*4+w] > -1)
+ {
+ assert(g_meshSkinWeights[i*4+w] < FLT_MAX);
+
+ int index = g_meshSkinIndices[i*4+w];
+ float weight = g_meshSkinWeights[i*4+w];
+
+ skinPos += (rotation*(g_meshRestPositions[i]-Point3(g_buffers->restPositions[index])) + Vec3(g_buffers->positions[index]))*weight;
+ }
+ }
+
+ g_mesh->m_positions[i] = Point3(skinPos);
+ }
+
+ startVertex += numVertices;
+ }
+
+ g_mesh->CalculateNormals();
+ }
+}
+
+void AddBox(Vec3 halfEdge = Vec3(2.0f), Vec3 center=Vec3(0.0f), Quat quat=Quat(), bool dynamic=false)
+{
+ // transform
+ g_buffers->shapePositions.push_back(Vec4(center.x, center.y, center.z, 0.0f));
+ g_buffers->shapeRotations.push_back(quat);
+
+ g_buffers->shapePrevPositions.push_back(g_buffers->shapePositions.back());
+ g_buffers->shapePrevRotations.push_back(g_buffers->shapeRotations.back());
+
+ NvFlexCollisionGeometry geo;
+ geo.box.halfExtents[0] = halfEdge.x;
+ geo.box.halfExtents[1] = halfEdge.y;
+ geo.box.halfExtents[2] = halfEdge.z;
+
+ g_buffers->shapeGeometry.push_back(geo);
+ g_buffers->shapeFlags.push_back(NvFlexMakeShapeFlags(eNvFlexShapeBox, dynamic));
+}
+
+// helper that creates a plinth whose center matches the particle bounds
+void AddPlinth()
+{
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Vec3 center = (lower+upper)*0.5f;
+ center.y = 0.5f;
+
+ AddBox(Vec3(2.0f, 0.5f, 2.0f), center);
+}
+
+void AddSphere(float radius, Vec3 position, Quat rotation)
+{
+ NvFlexCollisionGeometry geo;
+ geo.sphere.radius = radius;
+ g_buffers->shapeGeometry.push_back(geo);
+
+ g_buffers->shapePositions.push_back(Vec4(position, 0.0f));
+ g_buffers->shapeRotations.push_back(rotation);
+
+ g_buffers->shapePrevPositions.push_back(g_buffers->shapePositions.back());
+ g_buffers->shapePrevRotations.push_back(g_buffers->shapeRotations.back());
+
+ int flags = NvFlexMakeShapeFlags(eNvFlexShapeSphere, false);
+ g_buffers->shapeFlags.push_back(flags);
+}
+
+// creates a capsule aligned to the local x-axis with a given radius
+void AddCapsule(float radius, float halfHeight, Vec3 position, Quat rotation)
+{
+ NvFlexCollisionGeometry geo;
+ geo.capsule.radius = radius;
+ geo.capsule.halfHeight = halfHeight;
+
+ g_buffers->shapeGeometry.push_back(geo);
+
+ g_buffers->shapePositions.push_back(Vec4(position, 0.0f));
+ g_buffers->shapeRotations.push_back(rotation);
+
+ g_buffers->shapePrevPositions.push_back(g_buffers->shapePositions.back());
+ g_buffers->shapePrevRotations.push_back(g_buffers->shapeRotations.back());
+
+ int flags = NvFlexMakeShapeFlags(eNvFlexShapeCapsule, false);
+ g_buffers->shapeFlags.push_back(flags);
+}
+
+void CreateSDF(const Mesh* mesh, uint32_t dim, Vec3 lower, Vec3 upper, float* sdf)
+{
+ if (mesh)
+ {
+ printf("Begin mesh voxelization\n");
+
+ double startVoxelize = GetSeconds();
+
+ uint32_t* volume = new uint32_t[dim*dim*dim];
+ Voxelize((const float*)&mesh->m_positions[0], mesh->m_positions.size(), (const int*)&mesh->m_indices[0], mesh->m_indices.size(), dim, dim, dim, volume, lower, upper);
+
+ printf("End mesh voxelization (%.2fs)\n", (GetSeconds()-startVoxelize));
+
+ printf("Begin SDF gen (fast marching method)\n");
+
+ double startSDF = GetSeconds();
+
+ MakeSDF(volume, dim, dim, dim, sdf);
+
+ printf("End SDF gen (%.2fs)\n", (GetSeconds()-startSDF));
+
+ delete[] volume;
+ }
+}
+
+
+void AddRandomConvex(int numPlanes, Vec3 position, float minDist, float maxDist, Vec3 axis, float angle)
+{
+ const int maxPlanes = 12;
+
+ // 12-kdop
+ const Vec3 directions[maxPlanes] = {
+ Vec3(1.0f, 0.0f, 0.0f),
+ Vec3(0.0f, 1.0f, 0.0f),
+ Vec3(0.0f, 0.0f, 1.0f),
+ Vec3(-1.0f, 0.0f, 0.0f),
+ Vec3(0.0f, -1.0f, 0.0f),
+ Vec3(0.0f, 0.0f, -1.0f),
+ Vec3(1.0f, 1.0f, 0.0f),
+ Vec3(-1.0f, -1.0f, 0.0f),
+ Vec3(1.0f, 0.0f, 1.0f),
+ Vec3(-1.0f, 0.0f, -1.0f),
+ Vec3(0.0f, 1.0f, 1.0f),
+ Vec3(0.0f, -1.0f, -1.0f),
+ };
+
+ numPlanes = Clamp(6, numPlanes, maxPlanes);
+
+ int mesh = NvFlexCreateConvexMesh(g_flexLib);
+
+ NvFlexVector<Vec4> planes(g_flexLib);
+ planes.map();
+
+ // create a box
+ for (int i=0; i < numPlanes; ++i)
+ {
+ Vec4 plane = Vec4(Normalize(directions[i]), -Randf(minDist, maxDist));
+ planes.push_back(plane);
+ }
+
+ g_buffers->shapePositions.push_back(Vec4(position.x, position.y, position.z, 0.0f));
+ g_buffers->shapeRotations.push_back(QuatFromAxisAngle(axis, angle));
+
+ g_buffers->shapePrevPositions.push_back(g_buffers->shapePositions.back());
+ g_buffers->shapePrevRotations.push_back(g_buffers->shapeRotations.back());
+
+ // set aabbs
+ ConvexMeshBuilder builder(&planes[0]);
+ builder(numPlanes);
+
+ Vec3 lower(FLT_MAX), upper(-FLT_MAX);
+ for (size_t v=0; v < builder.mVertices.size(); ++v)
+ {
+ const Vec3 p = builder.mVertices[v];
+
+ lower = Min(lower, p);
+ upper = Max(upper, p);
+ }
+
+ planes.unmap();
+
+
+ NvFlexUpdateConvexMesh(g_flexLib, mesh, planes.buffer, planes.size(), lower, upper);
+
+ NvFlexCollisionGeometry geo;
+ geo.convexMesh.mesh = mesh;
+ geo.convexMesh.scale[0] = 1.0f;
+ geo.convexMesh.scale[1] = 1.0f;
+ geo.convexMesh.scale[2] = 1.0f;
+
+ g_buffers->shapeGeometry.push_back(geo);
+
+ int flags = NvFlexMakeShapeFlags(eNvFlexShapeConvexMesh, false);
+ g_buffers->shapeFlags.push_back(flags);
+
+
+ // create render mesh for convex
+ Mesh renderMesh;
+
+ for (uint32_t j = 0; j < builder.mIndices.size(); j += 3)
+ {
+ uint32_t a = builder.mIndices[j + 0];
+ uint32_t b = builder.mIndices[j + 1];
+ uint32_t c = builder.mIndices[j + 2];
+
+ Vec3 n = Normalize(Cross(builder.mVertices[b] - builder.mVertices[a], builder.mVertices[c] - builder.mVertices[a]));
+
+ int startIndex = renderMesh.m_positions.size();
+
+ renderMesh.m_positions.push_back(Point3(builder.mVertices[a]));
+ renderMesh.m_normals.push_back(n);
+
+ renderMesh.m_positions.push_back(Point3(builder.mVertices[b]));
+ renderMesh.m_normals.push_back(n);
+
+ renderMesh.m_positions.push_back(Point3(builder.mVertices[c]));
+ renderMesh.m_normals.push_back(n);
+
+ renderMesh.m_indices.push_back(startIndex+0);
+ renderMesh.m_indices.push_back(startIndex+1);
+ renderMesh.m_indices.push_back(startIndex+2);
+ }
+
+ // insert into the global mesh list
+ GpuMesh* gpuMesh = CreateGpuMesh(&renderMesh);
+ g_convexes[mesh] = gpuMesh;
+}
+
+void CreateRandomBody(int numPlanes, Vec3 position, float minDist, float maxDist, Vec3 axis, float angle, float invMass, int phase, float stiffness)
+{
+ // 12-kdop
+ const Vec3 directions[] = {
+ Vec3(1.0f, 0.0f, 0.0f),
+ Vec3(0.0f, 1.0f, 0.0f),
+ Vec3(0.0f, 0.0f, 1.0f),
+ Vec3(-1.0f, 0.0f, 0.0f),
+ Vec3(0.0f, -1.0f, 0.0f),
+ Vec3(0.0f, 0.0f, -1.0f),
+ Vec3(1.0f, 1.0f, 0.0f),
+ Vec3(-1.0f, -1.0f, 0.0f),
+ Vec3(1.0f, 0.0f, 1.0f),
+ Vec3(-1.0f, 0.0f, -1.0f),
+ Vec3(0.0f, 1.0f, 1.0f),
+ Vec3(0.0f, -1.0f, -1.0f),
+ };
+
+ numPlanes = max(4, numPlanes);
+
+ vector<Vec4> planes;
+
+ // create a box
+ for (int i=0; i < numPlanes; ++i)
+ {
+ // pick random dir and distance
+ Vec3 dir = Normalize(directions[i]);//RandomUnitVector();
+ float dist = Randf(minDist, maxDist);
+
+ planes.push_back(Vec4(dir.x, dir.y, dir.z, -dist));
+ }
+
+ // set aabbs
+ ConvexMeshBuilder builder(&planes[0]);
+ builder(numPlanes);
+
+ int startIndex = int(g_buffers->positions.size());
+
+ for (size_t v=0; v < builder.mVertices.size(); ++v)
+ {
+ Quat q = QuatFromAxisAngle(axis, angle);
+ Vec3 p = rotate(Vec3(q), q.w, builder.mVertices[v]) + position;
+
+ g_buffers->positions.push_back(Vec4(p.x, p.y, p.z, invMass));
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);
+
+ // add spring to all verts with higher index
+ for (size_t i=v+1; i < builder.mVertices.size(); ++i)
+ {
+ int a = startIndex + int(v);
+ int b = startIndex + int(i);
+
+ g_buffers->springIndices.push_back(a);
+ g_buffers->springIndices.push_back(b);
+ g_buffers->springLengths.push_back(Length(builder.mVertices[v]-builder.mVertices[i]));
+ g_buffers->springStiffness.push_back(stiffness);
+
+ }
+ }
+
+ for (size_t t=0; t < builder.mIndices.size(); ++t)
+ g_buffers->triangles.push_back(startIndex + builder.mIndices[t]);
+
+ // lazy
+ g_buffers->triangleNormals.resize(g_buffers->triangleNormals.size() + builder.mIndices.size()/3, Vec3(0.0f));
+}
+
+NvFlexTriangleMeshId CreateTriangleMesh(Mesh* m)
+{
+ if (!m)
+ return 0;
+
+ Vec3 lower, upper;
+ m->GetBounds(lower, upper);
+
+ NvFlexVector<Vec3> positions(g_flexLib);
+ NvFlexVector<int> indices(g_flexLib);
+
+ positions.assign((Vec3*)&m->m_positions[0], m->m_positions.size());
+ indices.assign((int*)&m->m_indices[0], m->m_indices.size());
+
+ positions.unmap();
+ indices.unmap();
+
+ NvFlexTriangleMeshId flexMesh = NvFlexCreateTriangleMesh(g_flexLib);
+ NvFlexUpdateTriangleMesh(g_flexLib, flexMesh, positions.buffer, indices.buffer, m->GetNumVertices(), m->GetNumFaces(), (float*)&lower, (float*)&upper);
+
+ // entry in the collision->render map
+ g_meshes[flexMesh] = CreateGpuMesh(m);
+
+ return flexMesh;
+}
+
+void AddTriangleMesh(NvFlexTriangleMeshId mesh, Vec3 translation, Quat rotation, Vec3 scale)
+{
+ Vec3 lower, upper;
+ NvFlexGetTriangleMeshBounds(g_flexLib, mesh, lower, upper);
+
+ NvFlexCollisionGeometry geo;
+ geo.triMesh.mesh = mesh;
+ geo.triMesh.scale[0] = scale.x;
+ geo.triMesh.scale[1] = scale.y;
+ geo.triMesh.scale[2] = scale.z;
+
+ g_buffers->shapePositions.push_back(Vec4(translation, 0.0f));
+ g_buffers->shapeRotations.push_back(Quat(rotation));
+ g_buffers->shapePrevPositions.push_back(Vec4(translation, 0.0f));
+ g_buffers->shapePrevRotations.push_back(Quat(rotation));
+ g_buffers->shapeGeometry.push_back((NvFlexCollisionGeometry&)geo);
+ g_buffers->shapeFlags.push_back(NvFlexMakeShapeFlags(eNvFlexShapeTriangleMesh, false));
+}
+
+NvFlexDistanceFieldId CreateSDF(const char* meshFile, int dim, float margin = 0.1f, float expand = 0.0f)
+{
+ Mesh* mesh = ImportMesh(meshFile);
+
+ // include small margin to ensure valid gradients near the boundary
+ mesh->Normalize(1.0f - margin);
+ mesh->Transform(TranslationMatrix(Point3(margin, margin, margin)*0.5f));
+
+ Vec3 lower(0.0f);
+ Vec3 upper(1.0f);
+
+ // try and load the sdf from disc if it exists
+ // Begin Add Android Support
+#ifdef ANDROID
+ string sdfFile = string(meshFile, strlen(meshFile) - strlen(strrchr(meshFile, '.'))) + ".pfm";
+#else
+ string sdfFile = string(meshFile, strrchr(meshFile, '.')) + ".pfm";
+#endif
+ // End Add Android Support
+
+ PfmImage pfm;
+ if (!PfmLoad(sdfFile.c_str(), pfm))
+ {
+ pfm.m_width = dim;
+ pfm.m_height = dim;
+ pfm.m_depth = dim;
+ pfm.m_data = new float[dim*dim*dim];
+
+ printf("Cooking SDF: %s - dim: %d^3\n", sdfFile.c_str(), dim);
+
+ CreateSDF(mesh, dim, lower, upper, pfm.m_data);
+
+ PfmSave(sdfFile.c_str(), pfm);
+ }
+
+ //printf("Loaded SDF, %d\n", pfm.m_width);
+
+ assert(pfm.m_width == pfm.m_height && pfm.m_width == pfm.m_depth);
+
+ // cheap collision offset
+ int numVoxels = int(pfm.m_width*pfm.m_height*pfm.m_depth);
+ for (int i = 0; i < numVoxels; ++i)
+ pfm.m_data[i] += expand;
+
+ NvFlexVector<float> field(g_flexLib);
+ field.assign(pfm.m_data, pfm.m_width*pfm.m_height*pfm.m_depth);
+ field.unmap();
+
+ // set up flex collision shape
+ NvFlexDistanceFieldId sdf = NvFlexCreateDistanceField(g_flexLib);
+ NvFlexUpdateDistanceField(g_flexLib, sdf, dim, dim, dim, field.buffer);
+
+ // entry in the collision->render map
+ g_fields[sdf] = CreateGpuMesh(mesh);
+
+ delete mesh;
+
+ return sdf;
+}
+
+void AddSDF(NvFlexDistanceFieldId sdf, Vec3 translation, Quat rotation, float width)
+{
+ NvFlexCollisionGeometry geo;
+ geo.sdf.field = sdf;
+ geo.sdf.scale = width;
+
+ g_buffers->shapePositions.push_back(Vec4(translation, 0.0f));
+ g_buffers->shapeRotations.push_back(Quat(rotation));
+ g_buffers->shapePrevPositions.push_back(Vec4(translation, 0.0f));
+ g_buffers->shapePrevRotations.push_back(Quat(rotation));
+ g_buffers->shapeGeometry.push_back((NvFlexCollisionGeometry&)geo);
+ g_buffers->shapeFlags.push_back(NvFlexMakeShapeFlags(eNvFlexShapeSDF, false));
+}
+
+inline int GridIndex(int x, int y, int dx) { return y*dx + x; }
+
+void CreateSpringGrid(Vec3 lower, int dx, int dy, int dz, float radius, int phase, float stretchStiffness, float bendStiffness, float shearStiffness, Vec3 velocity, float invMass)
+{
+ int baseIndex = int(g_buffers->positions.size());
+
+ for (int z=0; z < dz; ++z)
+ {
+ for (int y=0; y < dy; ++y)
+ {
+ for (int x=0; x < dx; ++x)
+ {
+ Vec3 position = lower + radius*Vec3(float(x), float(z), float(y));
+
+ g_buffers->positions.push_back(Vec4(position.x, position.y, position.z, invMass));
+ g_buffers->velocities.push_back(velocity);
+ g_buffers->phases.push_back(phase);
+
+ if (x > 0 && y > 0)
+ {
+ g_buffers->triangles.push_back(baseIndex + GridIndex(x-1, y-1, dx));
+ g_buffers->triangles.push_back(baseIndex + GridIndex(x, y-1, dx));
+ g_buffers->triangles.push_back(baseIndex + GridIndex(x, y, dx));
+
+ g_buffers->triangles.push_back(baseIndex + GridIndex(x-1, y-1, dx));
+ g_buffers->triangles.push_back(baseIndex + GridIndex(x, y, dx));
+ g_buffers->triangles.push_back(baseIndex + GridIndex(x-1, y, dx));
+
+ g_buffers->triangleNormals.push_back(Vec3(0.0f, 1.0f, 0.0f));
+ g_buffers->triangleNormals.push_back(Vec3(0.0f, 1.0f, 0.0f));
+ }
+ }
+ }
+ }
+
+ // horizontal
+ for (int y=0; y < dy; ++y)
+ {
+ for (int x=0; x < dx; ++x)
+ {
+ int index0 = y*dx + x;
+
+ if (x > 0)
+ {
+ int index1 = y*dx + x - 1;
+ CreateSpring(baseIndex + index0, baseIndex + index1, stretchStiffness);
+ }
+
+ if (x > 1)
+ {
+ int index2 = y*dx + x - 2;
+ CreateSpring(baseIndex + index0, baseIndex + index2, bendStiffness);
+ }
+
+ if (y > 0 && x < dx-1)
+ {
+ int indexDiag = (y-1)*dx + x + 1;
+ CreateSpring(baseIndex + index0, baseIndex + indexDiag, shearStiffness);
+ }
+
+ if (y > 0 && x > 0)
+ {
+ int indexDiag = (y-1)*dx + x - 1;
+ CreateSpring(baseIndex + index0, baseIndex + indexDiag, shearStiffness);
+ }
+ }
+ }
+
+ // vertical
+ for (int x=0; x < dx; ++x)
+ {
+ for (int y=0; y < dy; ++y)
+ {
+ int index0 = y*dx + x;
+
+ if (y > 0)
+ {
+ int index1 = (y-1)*dx + x;
+ CreateSpring(baseIndex + index0, baseIndex + index1, stretchStiffness);
+ }
+
+ if (y > 1)
+ {
+ int index2 = (y-2)*dx + x;
+ CreateSpring(baseIndex + index0, baseIndex + index2, bendStiffness);
+ }
+ }
+ }
+}
+
+void CreateRope(Rope& rope, Vec3 start, Vec3 dir, float stiffness, int segments, float length, int phase, float spiralAngle=0.0f, float invmass=1.0f, float give=0.075f)
+{
+ rope.mIndices.push_back(int(g_buffers->positions.size()));
+
+ g_buffers->positions.push_back(Vec4(start.x, start.y, start.z, invmass));
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);//int(g_buffers->positions.size()));
+
+ Vec3 left, right;
+ BasisFromVector(dir, &left, &right);
+
+ float segmentLength = length/segments;
+ Vec3 spiralAxis = dir;
+ float spiralHeight = spiralAngle/(2.0f*kPi)*(length/segments);
+
+ if (spiralAngle > 0.0f)
+ dir = left;
+
+ Vec3 p = start;
+
+ for (int i=0; i < segments; ++i)
+ {
+ int prev = int(g_buffers->positions.size())-1;
+
+ p += dir*segmentLength;
+
+ // rotate
+ if (spiralAngle > 0.0f)
+ {
+ p += spiralAxis*spiralHeight;
+
+ dir = RotationMatrix(spiralAngle, spiralAxis)*dir;
+ }
+
+ rope.mIndices.push_back(int(g_buffers->positions.size()));
+
+ g_buffers->positions.push_back(Vec4(p.x, p.y, p.z, 1.0f));
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);//int(g_buffers->positions.size()));
+
+ // stretch
+ CreateSpring(prev, prev+1, stiffness, give);
+
+ // tether
+ //if (i > 0 && i%4 == 0)
+ //CreateSpring(prev-3, prev+1, -0.25f);
+
+ // bending spring
+ if (i > 0)
+ CreateSpring(prev-1, prev+1, stiffness*0.5f, give);
+ }
+}
+
+namespace
+{
+ struct Tri
+ {
+ int a;
+ int b;
+ int c;
+
+ Tri(int a, int b, int c) : a(a), b(b), c(c) {}
+
+ bool operator < (const Tri& rhs)
+ {
+ if (a != rhs.a)
+ return a < rhs.a;
+ else if (b != rhs.b)
+ return b < rhs.b;
+ else
+ return c < rhs.c;
+ }
+ };
+}
+
+
+namespace
+{
+ struct TriKey
+ {
+ int orig[3];
+ int indices[3];
+
+ TriKey(int a, int b, int c)
+ {
+ orig[0] = a;
+ orig[1] = b;
+ orig[2] = c;
+
+ indices[0] = a;
+ indices[1] = b;
+ indices[2] = c;
+
+ std::sort(indices, indices+3);
+ }
+
+ bool operator < (const TriKey& rhs) const
+ {
+ if (indices[0] != rhs.indices[0])
+ return indices[0] < rhs.indices[0];
+ else if (indices[1] != rhs.indices[1])
+ return indices[1] < rhs.indices[1];
+ else
+ return indices[2] < rhs.indices[2];
+ }
+ };
+}
+
+void CreateTetMesh(const char* filename, Vec3 lower, float scale, float stiffness, int phase)
+{
+ FILE* f = fopen(filename, "r");
+
+ char line[2048];
+
+ if (f)
+ {
+ typedef std::map<TriKey, int> TriMap;
+ TriMap triCount;
+
+ const int vertOffset = g_buffers->positions.size();
+
+ Vec3 meshLower(FLT_MAX);
+ Vec3 meshUpper(-FLT_MAX);
+
+ bool firstTet = true;
+
+ while (!feof(f))
+ {
+ if (fgets(line, 2048, f))
+ {
+ switch(line[0])
+ {
+ case '#':
+ break;
+ case 'v':
+ {
+ Vec3 pos;
+ sscanf(line, "v %f %f %f", &pos.x, &pos.y, &pos.z);
+
+ g_buffers->positions.push_back(Vec4(pos.x, pos.y, pos.z, 1.0f));
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);
+
+ meshLower = Min(pos, meshLower);
+ meshUpper = Max(pos, meshUpper);
+ break;
+ }
+ case 't':
+ {
+ if (firstTet)
+ {
+ Vec3 edges = meshUpper-meshLower;
+ float maxEdge = max(edges.x, max(edges.y, edges.z));
+
+ // normalize positions
+ for (int i=vertOffset; i < int(g_buffers->positions.size()); ++i)
+ {
+ Vec3 p = lower + (Vec3(g_buffers->positions[i])-meshLower)*scale/maxEdge;
+ g_buffers->positions[i] = Vec4(p, g_buffers->positions[i].w);
+ }
+
+ firstTet = false;
+ }
+
+ int indices[4];
+ sscanf(line, "t %d %d %d %d", &indices[0], &indices[1], &indices[2], &indices[3]);
+
+ indices[0] += vertOffset;
+ indices[1] += vertOffset;
+ indices[2] += vertOffset;
+ indices[3] += vertOffset;
+
+ CreateSpring(indices[0], indices[1], stiffness);
+ CreateSpring(indices[0], indices[2], stiffness);
+ CreateSpring(indices[0], indices[3], stiffness);
+
+ CreateSpring(indices[1], indices[2], stiffness);
+ CreateSpring(indices[1], indices[3], stiffness);
+ CreateSpring(indices[2], indices[3], stiffness);
+
+ TriKey k1(indices[0], indices[2], indices[1]);
+ triCount[k1] += 1;
+
+ TriKey k2(indices[1], indices[2], indices[3]);
+ triCount[k2] += 1;
+
+ TriKey k3(indices[0], indices[1], indices[3]);
+ triCount[k3] += 1;
+
+ TriKey k4(indices[0], indices[3], indices[2]);
+ triCount[k4] += 1;
+
+ break;
+ }
+ }
+ }
+ }
+
+ for (TriMap::iterator iter=triCount.begin(); iter != triCount.end(); ++iter)
+ {
+ TriKey key = iter->first;
+
+ // only output faces that are referenced by one tet (open faces)
+ if (iter->second == 1)
+ {
+ g_buffers->triangles.push_back(key.orig[0]);
+ g_buffers->triangles.push_back(key.orig[1]);
+ g_buffers->triangles.push_back(key.orig[2]);
+ g_buffers->triangleNormals.push_back(0.0f);
+ }
+ }
+
+
+ fclose(f);
+ }
+}
+
+
+// finds the closest particle to a view ray
+int PickParticle(Vec3 origin, Vec3 dir, Vec4* particles, int* phases, int n, float radius, float &outT)
+{
+ float maxDistSq = radius*radius;
+ float minT = FLT_MAX;
+ int minIndex = -1;
+
+ for (int i=0; i < n; ++i)
+ {
+ if (phases[i] & eNvFlexPhaseFluid)
+ continue;
+
+ Vec3 delta = Vec3(particles[i])-origin;
+ float t = Dot(delta, dir);
+
+ if (t > 0.0f)
+ {
+ Vec3 perp = delta - t*dir;
+
+ float dSq = LengthSq(perp);
+
+ if (dSq < maxDistSq && t < minT)
+ {
+ minT = t;
+ minIndex = i;
+ }
+ }
+ }
+
+ outT = minT;
+
+ return minIndex;
+}
+
+// calculates local space positions given a set of particles and rigid indices
+void CalculateRigidLocalPositions(const Vec4* restPositions, int numRestPositions, const int* offsets, const int* indices, int numRigids, Vec3* localPositions)
+{
+
+ // To improve the accuracy of the result, first transform the restPositions to relative coordinates (by finding the mean and subtracting that from all points)
+ // Note: If this is not done, one might see ghost forces if the mean of the restPositions is far from the origin.
+
+ // Calculate mean
+ Vec3 shapeOffset(0.0f);
+
+ for (int i = 0; i < numRestPositions; i++)
+ {
+ shapeOffset += Vec3(restPositions[i]);
+ }
+
+ shapeOffset /= float(numRestPositions);
+
+ int count = 0;
+
+ for (int r=0; r < numRigids; ++r)
+ {
+ const int startIndex = offsets[r];
+ const int endIndex = offsets[r+1];
+
+ const int n = endIndex-startIndex;
+
+ assert(n);
+
+ Vec3 com;
+
+ for (int i=startIndex; i < endIndex; ++i)
+ {
+ const int r = indices[i];
+
+ // By substracting meshOffset the calculation is done in relative coordinates
+ com += Vec3(restPositions[r]) - shapeOffset;
+ }
+
+ com /= float(n);
+
+ for (int i=startIndex; i < endIndex; ++i)
+ {
+ const int r = indices[i];
+
+ // By substracting meshOffset the calculation is done in relative coordinates
+ localPositions[count++] = (Vec3(restPositions[r]) - shapeOffset) - com;
+ }
+ }
+}
+
+void DrawImguiString(int x, int y, Vec3 color, int align, const char* s, ...)
+{
+ char buf[2048];
+
+ va_list args;
+
+ va_start(args, s);
+ vsnprintf(buf, 2048, s, args);
+ va_end(args);
+
+ imguiDrawText(x, y, align, buf, imguiRGBA((unsigned char)(color.x*255), (unsigned char)(color.y*255), (unsigned char)(color.z*255)));
+}
+
+// Soft body support functions
+
+Vec3 CalculateMean(const Vec3* particles, const int* indices, int numIndices)
+{
+ Vec3 sum;
+
+ for (int i = 0; i < numIndices; ++i)
+ sum += Vec3(particles[indices[i]]);
+
+ if (numIndices)
+ return sum / float(numIndices);
+ else
+ return sum;
+}
+
+float CalculateRadius(const Vec3* particles, Vec3 center, const int* indices, int numIndices)
+{
+ float radiusSq = 0.0f;
+
+ for (int i = 0; i < numIndices; ++i)
+ {
+ float dSq = LengthSq(Vec3(particles[indices[i]]) - center);
+ if (dSq > radiusSq)
+ radiusSq = dSq;
+ }
+
+ return sqrtf(radiusSq);
+}
+
+struct Cluster
+{
+ Vec3 mean;
+ float radius;
+
+ // indices of particles belonging to this cluster
+ std::vector<int> indices;
+};
+
+struct Seed
+{
+ int index;
+ float priority;
+
+ bool operator < (const Seed& rhs) const
+ {
+ return priority < rhs.priority;
+ }
+};
+
+int CreateClusters(Vec3* particles, const float* priority, int numParticles, std::vector<int>& outClusterOffsets, std::vector<int>& outClusterIndices, std::vector<Vec3>& outClusterPositions, float radius, float smoothing = 0.0f)
+{
+ std::vector<Seed> seeds;
+ std::vector<Cluster> clusters;
+
+ // flags a particle as belonging to at least one cluster
+ std::vector<bool> used(numParticles, false);
+
+ // initialize seeds
+ for (int i = 0; i < numParticles; ++i)
+ {
+ Seed s;
+ s.index = i;
+ s.priority = priority[i];
+
+ seeds.push_back(s);
+ }
+
+ std::stable_sort(seeds.begin(), seeds.end());
+
+ while (seeds.size())
+ {
+ // pick highest unused particle from the seeds list
+ Seed seed = seeds.back();
+ seeds.pop_back();
+
+ if (!used[seed.index])
+ {
+ Cluster c;
+
+ const float radiusSq = sqr(radius);
+
+ // push all neighbors within radius
+ for (int p = 0; p < numParticles; ++p)
+ {
+ float dSq = LengthSq(Vec3(particles[seed.index]) - Vec3(particles[p]));
+ if (dSq <= radiusSq)
+ {
+ c.indices.push_back(p);
+
+ used[p] = true;
+ }
+ }
+
+ c.mean = CalculateMean(particles, &c.indices[0], c.indices.size());
+
+ clusters.push_back(c);
+ }
+ }
+
+ if (smoothing > 0.0f)
+ {
+ // expand clusters by smoothing radius
+ float radiusSmoothSq = sqr(smoothing);
+
+ for (int i = 0; i < int(clusters.size()); ++i)
+ {
+ Cluster& c = clusters[i];
+
+ // clear cluster indices
+ c.indices.resize(0);
+
+ // push all neighbors within radius
+ for (int p = 0; p < numParticles; ++p)
+ {
+ float dSq = LengthSq(c.mean - Vec3(particles[p]));
+ if (dSq <= radiusSmoothSq)
+ c.indices.push_back(p);
+ }
+
+ c.mean = CalculateMean(particles, &c.indices[0], c.indices.size());
+ }
+ }
+
+ // write out cluster indices
+ int count = 0;
+
+ //outClusterOffsets.push_back(0);
+
+ for (int c = 0; c < int(clusters.size()); ++c)
+ {
+ const Cluster& cluster = clusters[c];
+
+ const int clusterSize = int(cluster.indices.size());
+
+ // skip empty clusters
+ if (clusterSize)
+ {
+ // write cluster indices
+ for (int i = 0; i < clusterSize; ++i)
+ outClusterIndices.push_back(cluster.indices[i]);
+
+ // write cluster offset
+ outClusterOffsets.push_back(outClusterIndices.size());
+
+ // write center
+ outClusterPositions.push_back(cluster.mean);
+
+ ++count;
+ }
+ }
+
+ return count;
+}
+
+// creates distance constraints between particles within some distance
+int CreateLinks(const Vec3* particles, int numParticles, std::vector<int>& outSpringIndices, std::vector<float>& outSpringLengths, std::vector<float>& outSpringStiffness, float radius, float stiffness = 1.0f)
+{
+ const float radiusSq = sqr(radius);
+
+ int count = 0;
+
+ for (int i = 0; i < numParticles; ++i)
+ {
+ for (int j = i + 1; j < numParticles; ++j)
+ {
+ float dSq = LengthSq(Vec3(particles[i]) - Vec3(particles[j]));
+
+ if (dSq < radiusSq)
+ {
+ outSpringIndices.push_back(i);
+ outSpringIndices.push_back(j);
+ outSpringLengths.push_back(sqrtf(dSq));
+ outSpringStiffness.push_back(stiffness);
+
+ ++count;
+ }
+ }
+ }
+
+ return count;
+}
+
+void CreateSkinning(const Vec3* vertices, int numVertices, const Vec3* clusters, int numClusters, float* outWeights, int* outIndices, float falloff, float maxdist)
+{
+ const int maxBones = 4;
+
+ // for each vertex, find the closest n clusters
+ for (int i = 0; i < numVertices; ++i)
+ {
+ int indices[4] = { -1, -1, -1, -1 };
+ float distances[4] = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX };
+ float weights[maxBones];
+
+ for (int c = 0; c < numClusters; ++c)
+ {
+ float dSq = LengthSq(vertices[i] - clusters[c]);
+
+ // insertion sort
+ int w = 0;
+ for (; w < maxBones; ++w)
+ if (dSq < distances[w])
+ break;
+
+ if (w < maxBones)
+ {
+ // shuffle down
+ for (int s = maxBones - 1; s > w; --s)
+ {
+ indices[s] = indices[s - 1];
+ distances[s] = distances[s - 1];
+ }
+
+ distances[w] = dSq;
+ indices[w] = c;
+ }
+ }
+
+ // weight particles according to distance
+ float wSum = 0.0f;
+
+ for (int w = 0; w < maxBones; ++w)
+ {
+ if (distances[w] > sqr(maxdist))
+ {
+ // clamp bones over a given distance to zero
+ weights[w] = 0.0f;
+ }
+ else
+ {
+ // weight falls off inversely with distance
+ weights[w] = 1.0f / (powf(distances[w], falloff) + 0.0001f);
+ }
+
+ wSum += weights[w];
+ }
+
+ if (wSum == 0.0f)
+ {
+ // if all weights are zero then just
+ // rigidly skin to the closest bone
+ weights[0] = 1.0f;
+ }
+ else
+ {
+ // normalize weights
+ for (int w = 0; w < maxBones; ++w)
+ {
+ weights[w] = weights[w] / wSum;
+ }
+ }
+
+ // output
+ for (int j = 0; j < maxBones; ++j)
+ {
+ outWeights[i*maxBones + j] = weights[j];
+ outIndices[i*maxBones + j] = indices[j];
+ }
+ }
+}
+
+
+void SampleMesh(Mesh* mesh, Vec3 lower, Vec3 scale, float rotation, float radius, float volumeSampling, float surfaceSampling, std::vector<Vec3>& outPositions)
+{
+ if (!mesh)
+ return;
+
+ mesh->Transform(RotationMatrix(rotation, Vec3(0.0f, 1.0f, 0.0f)));
+
+ Vec3 meshLower, meshUpper;
+ mesh->GetBounds(meshLower, meshUpper);
+
+ Vec3 edges = meshUpper - meshLower;
+ float maxEdge = max(max(edges.x, edges.y), edges.z);
+
+ // put mesh at the origin and scale to specified size
+ Matrix44 xform = ScaleMatrix(scale / maxEdge)*TranslationMatrix(Point3(-meshLower));
+
+ mesh->Transform(xform);
+ mesh->GetBounds(meshLower, meshUpper);
+
+ std::vector<Vec3> samples;
+
+ if (volumeSampling > 0.0f)
+ {
+ // recompute expanded edges
+ edges = meshUpper - meshLower;
+ maxEdge = max(max(edges.x, edges.y), edges.z);
+
+ // use a higher resolution voxelization as a basis for the particle decomposition
+ float spacing = radius / volumeSampling;
+
+ // tweak spacing to avoid edge cases for particles laying on the boundary
+ // just covers the case where an edge is a whole multiple of the spacing.
+ float spacingEps = spacing*(1.0f - 1e-4f);
+
+ // make sure to have at least one particle in each dimension
+ int dx, dy, dz;
+ dx = spacing > edges.x ? 1 : int(edges.x / spacingEps);
+ dy = spacing > edges.y ? 1 : int(edges.y / spacingEps);
+ dz = spacing > edges.z ? 1 : int(edges.z / spacingEps);
+
+ int maxDim = max(max(dx, dy), dz);
+
+ // expand border by two voxels to ensure adequate sampling at edges
+ meshLower -= 2.0f*Vec3(spacing);
+ meshUpper += 2.0f*Vec3(spacing);
+ maxDim += 4;
+
+ vector<uint32_t> voxels(maxDim*maxDim*maxDim);
+
+ // we shift the voxelization bounds so that the voxel centers
+ // lie symmetrically to the center of the object. this reduces the
+ // chance of missing features, and also better aligns the particles
+ // with the mesh
+ Vec3 meshOffset;
+ meshOffset.x = 0.5f * (spacing - (edges.x - (dx - 1)*spacing));
+ meshOffset.y = 0.5f * (spacing - (edges.y - (dy - 1)*spacing));
+ meshOffset.z = 0.5f * (spacing - (edges.z - (dz - 1)*spacing));
+ meshLower -= meshOffset;
+
+ //Voxelize(*mesh, dx, dy, dz, &voxels[0], meshLower - Vec3(spacing*0.05f) , meshLower + Vec3(maxDim*spacing) + Vec3(spacing*0.05f));
+ Voxelize((const float*)&mesh->m_positions[0], mesh->m_positions.size(), (const int*)&mesh->m_indices[0], mesh->m_indices.size(), maxDim, maxDim, maxDim, &voxels[0], meshLower, meshLower + Vec3(maxDim*spacing));
+
+ // sample interior
+ for (int x = 0; x < maxDim; ++x)
+ {
+ for (int y = 0; y < maxDim; ++y)
+ {
+ for (int z = 0; z < maxDim; ++z)
+ {
+ const int index = z*maxDim*maxDim + y*maxDim + x;
+
+ // if voxel is marked as occupied the add a particle
+ if (voxels[index])
+ {
+ Vec3 position = lower + meshLower + spacing*Vec3(float(x) + 0.5f, float(y) + 0.5f, float(z) + 0.5f);
+
+ // normalize the sdf value and transform to world scale
+ samples.push_back(position);
+ }
+ }
+ }
+ }
+ }
+
+ // move back
+ mesh->Transform(ScaleMatrix(1.0f)*TranslationMatrix(Point3(-0.5f*(meshUpper + meshLower))));
+ mesh->Transform(TranslationMatrix(Point3(lower + 0.5f*(meshUpper + meshLower))));
+
+ if (surfaceSampling > 0.0f)
+ {
+ // sample vertices
+ for (int i = 0; i < int(mesh->m_positions.size()); ++i)
+ samples.push_back(Vec3(mesh->m_positions[i]));
+
+ // random surface sampling
+ if (1)
+ {
+ for (int i = 0; i < 50000; ++i)
+ {
+ int t = Rand() % mesh->GetNumFaces();
+ float u = Randf();
+ float v = Randf()*(1.0f - u);
+ float w = 1.0f - u - v;
+
+ int a = mesh->m_indices[t * 3 + 0];
+ int b = mesh->m_indices[t * 3 + 1];
+ int c = mesh->m_indices[t * 3 + 2];
+
+ Point3 pt = mesh->m_positions[a] * u + mesh->m_positions[b] * v + mesh->m_positions[c] * w;
+ Vec3 p(pt.x,pt.y,pt.z);
+
+ samples.push_back(p);
+ }
+ }
+ }
+
+ std::vector<int> clusterIndices;
+ std::vector<int> clusterOffsets;
+ std::vector<Vec3> clusterPositions;
+ std::vector<float> priority(samples.size());
+
+ CreateClusters(&samples[0], &priority[0], samples.size(), clusterOffsets, clusterIndices, outPositions, radius);
+
+}
+
+void ClearShapes()
+{
+ g_buffers->shapeGeometry.resize(0);
+ g_buffers->shapePositions.resize(0);
+ g_buffers->shapeRotations.resize(0);
+ g_buffers->shapePrevPositions.resize(0);
+ g_buffers->shapePrevRotations.resize(0);
+ g_buffers->shapeFlags.resize(0);
+}
+
+void UpdateShapes()
+{
+ // mark shapes as dirty so they are sent to flex during the next update
+ g_shapesChanged = true;
+}
+
+// calculates the union bounds of all the collision shapes in the scene
+void GetShapeBounds(Vec3& totalLower, Vec3& totalUpper)
+{
+ Bounds totalBounds;
+
+ for (int i=0; i < g_buffers->shapeFlags.size(); ++i)
+ {
+ NvFlexCollisionGeometry geo = g_buffers->shapeGeometry[i];
+
+ int type = g_buffers->shapeFlags[i]&eNvFlexShapeFlagTypeMask;
+
+ Vec3 localLower;
+ Vec3 localUpper;
+
+ switch(type)
+ {
+ case eNvFlexShapeBox:
+ {
+ localLower = -Vec3(geo.box.halfExtents);
+ localUpper = Vec3(geo.box.halfExtents);
+ break;
+ }
+ case eNvFlexShapeSphere:
+ {
+ localLower = -geo.sphere.radius;
+ localUpper = geo.sphere.radius;
+ break;
+ }
+ case eNvFlexShapeCapsule:
+ {
+ localLower = -Vec3(geo.capsule.halfHeight, 0.0f, 0.0f) - Vec3(geo.capsule.radius);
+ localUpper = Vec3(geo.capsule.halfHeight, 0.0f, 0.0f) + Vec3(geo.capsule.radius);
+ break;
+ }
+ case eNvFlexShapeConvexMesh:
+ {
+ NvFlexGetConvexMeshBounds(g_flexLib, geo.convexMesh.mesh, localLower, localUpper);
+
+ // apply instance scaling
+ localLower *= geo.convexMesh.scale;
+ localUpper *= geo.convexMesh.scale;
+ break;
+ }
+ case eNvFlexShapeTriangleMesh:
+ {
+ NvFlexGetTriangleMeshBounds(g_flexLib, geo.triMesh.mesh, localLower, localUpper);
+
+ // apply instance scaling
+ localLower *= Vec3(geo.triMesh.scale);
+ localUpper *= Vec3(geo.triMesh.scale);
+ break;
+ }
+ case eNvFlexShapeSDF:
+ {
+ localLower = 0.0f;
+ localUpper = geo.sdf.scale;
+ break;
+ }
+ };
+
+ // transform local bounds to world space
+ Vec3 worldLower, worldUpper;
+ TransformBounds(localLower, localUpper, Vec3(g_buffers->shapePositions[i]), g_buffers->shapeRotations[i], 1.0f, worldLower, worldUpper);
+
+ totalBounds = Union(totalBounds, Bounds(worldLower, worldUpper));
+ }
+
+ totalLower = totalBounds.lower;
+ totalUpper = totalBounds.upper;
+} \ No newline at end of file
diff --git a/demo/imgui.cpp b/demo/imgui.cpp
new file mode 100644
index 0000000..bc42082
--- /dev/null
+++ b/demo/imgui.cpp
@@ -0,0 +1,699 @@
+//
+// Copyright (c) 2009-2010 Mikko Mononen [email protected]
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#include <stdio.h>
+#include <string.h>
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include "imgui.h"
+
+#ifdef WIN32
+# define snprintf _snprintf
+#endif
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static const unsigned TEXT_POOL_SIZE = 8000;
+static char g_textPool[TEXT_POOL_SIZE];
+static unsigned g_textPoolSize = 0;
+static const char* allocText(const char* text)
+{
+ int len = (int)(strlen(text)+1);
+ if (g_textPoolSize + len >= TEXT_POOL_SIZE)
+ return 0;
+ char* dst = &g_textPool[g_textPoolSize];
+ memcpy(dst, text, len);
+ g_textPoolSize += len;
+ return dst;
+}
+
+static const unsigned GFXCMD_QUEUE_SIZE = 5000;
+static imguiGfxCmd g_gfxCmdQueue[GFXCMD_QUEUE_SIZE];
+static unsigned g_gfxCmdQueueSize = 0;
+
+static void resetGfxCmdQueue()
+{
+ g_gfxCmdQueueSize = 0;
+ g_textPoolSize = 0;
+}
+
+static void addGfxCmdScissor(int x, int y, int w, int h)
+{
+ if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
+ return;
+ imguiGfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
+ cmd.type = IMGUI_GFXCMD_SCISSOR;
+ cmd.flags = x < 0 ? 0 : 1; // on/off flag.
+ cmd.col = 0;
+ cmd.rect.x = (short)x;
+ cmd.rect.y = (short)y;
+ cmd.rect.w = (short)w;
+ cmd.rect.h = (short)h;
+}
+
+static void addGfxCmdRect(float x, float y, float w, float h, unsigned int color)
+{
+ if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
+ return;
+ imguiGfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
+ cmd.type = IMGUI_GFXCMD_RECT;
+ cmd.flags = 0;
+ cmd.col = color;
+ cmd.rect.x = (short)(x*8.0f);
+ cmd.rect.y = (short)(y*8.0f);
+ cmd.rect.w = (short)(w*8.0f);
+ cmd.rect.h = (short)(h*8.0f);
+ cmd.rect.r = 0;
+}
+
+static void addGfxCmdLine(float x0, float y0, float x1, float y1, float r, unsigned int color)
+{
+ if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
+ return;
+ imguiGfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
+ cmd.type = IMGUI_GFXCMD_LINE;
+ cmd.flags = 0;
+ cmd.col = color;
+ cmd.line.x0 = (short)(x0*8.0f);
+ cmd.line.y0 = (short)(y0*8.0f);
+ cmd.line.x1 = (short)(x1*8.0f);
+ cmd.line.y1 = (short)(y1*8.0f);
+ cmd.line.r = (short)(r*8.0f);
+}
+
+static void addGfxCmdRoundedRect(float x, float y, float w, float h, float r, unsigned int color)
+{
+ if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
+ return;
+ imguiGfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
+ cmd.type = IMGUI_GFXCMD_RECT;
+ cmd.flags = 0;
+ cmd.col = color;
+ cmd.rect.x = (short)(x*8.0f);
+ cmd.rect.y = (short)(y*8.0f);
+ cmd.rect.w = (short)(w*8.0f);
+ cmd.rect.h = (short)(h*8.0f);
+ cmd.rect.r = (short)(r*8.0f);
+}
+
+static void addGfxCmdTriangle(int x, int y, int w, int h, int flags, unsigned int color)
+{
+ if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
+ return;
+ imguiGfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
+ cmd.type = IMGUI_GFXCMD_TRIANGLE;
+ cmd.flags = (char)flags;
+ cmd.col = color;
+ cmd.rect.x = (short)(x*8.0f);
+ cmd.rect.y = (short)(y*8.0f);
+ cmd.rect.w = (short)(w*8.0f);
+ cmd.rect.h = (short)(h*8.0f);
+}
+
+static void addGfxCmdText(int x, int y, int align, const char* text, unsigned int color)
+{
+ if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
+ return;
+ imguiGfxCmd& cmd = g_gfxCmdQueue[g_gfxCmdQueueSize++];
+ cmd.type = IMGUI_GFXCMD_TEXT;
+ cmd.flags = 0;
+ cmd.col = color;
+ cmd.text.x = (short)x;
+ cmd.text.y = (short)y;
+ cmd.text.align = (short)align;
+ cmd.text.text = allocText(text);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+struct GuiState
+{
+ GuiState() :
+ left(false), leftPressed(false), leftReleased(false),
+ mx(-1), my(-1), scroll(0),
+ active(0), hot(0), hotToBe(0), isHot(false), isActive(false), wentActive(false),
+ dragX(0), dragY(0), dragOrig(0), widgetX(0), widgetY(0), widgetW(100),
+ insideCurrentScroll(false), areaId(0), widgetId(0)
+ {
+ }
+
+ bool left;
+ bool leftPressed, leftReleased;
+ int mx,my;
+ int scroll;
+ unsigned int active;
+ unsigned int hot;
+ unsigned int hotToBe;
+ bool isHot;
+ bool isActive;
+ bool wentActive;
+ int dragX, dragY;
+ float dragOrig;
+ int widgetX, widgetY, widgetW;
+ bool insideCurrentScroll;
+
+ unsigned int areaId;
+ unsigned int widgetId;
+};
+
+static GuiState g_state;
+
+// Begin Add Android Support
+#ifdef ANDROID
+void setStateLeft(bool bLeftDown)
+{
+ g_state.left = bLeftDown;
+}
+#endif
+// End Add Android Support
+
+inline bool anyActive()
+{
+ return g_state.active != 0;
+}
+
+inline bool isActive(unsigned int id)
+{
+ return g_state.active == id;
+}
+
+inline bool isHot(unsigned int id)
+{
+ return g_state.hot == id;
+}
+
+inline bool inRect(int x, int y, int w, int h, bool checkScroll = true)
+{
+ return (!checkScroll || g_state.insideCurrentScroll) && g_state.mx >= x && g_state.mx <= x+w && g_state.my >= y && g_state.my <= y+h;
+}
+
+inline void clearInput()
+{
+ g_state.leftPressed = false;
+ g_state.leftReleased = false;
+ g_state.scroll = 0;
+}
+
+inline void clearActive()
+{
+ g_state.active = 0;
+ // mark all UI for this frame as processed
+ clearInput();
+}
+
+inline void setActive(unsigned int id)
+{
+ g_state.active = id;
+ g_state.wentActive = true;
+}
+
+inline void setHot(unsigned int id)
+{
+ g_state.hotToBe = id;
+// Begin Add Android Support
+#ifdef ANDROID
+ g_state.hot = id;
+#endif
+// End Add Android Support
+}
+
+
+static bool buttonLogic(unsigned int id, bool over)
+{
+ bool res = false;
+ // process down
+ if (!anyActive())
+ {
+ if (over)
+ setHot(id);
+// Begin Add Android Support
+#ifdef ANDROID
+ if (isHot(id) && g_state.leftPressed && over)
+ setActive(id);
+#else
+ if (isHot(id) && g_state.leftPressed)
+ setActive(id);
+#endif
+// End Add Android Support
+ }
+
+ // if button is active, then react on left up
+ if (isActive(id))
+ {
+ g_state.isActive = true;
+ if (over)
+ setHot(id);
+ if (g_state.leftReleased)
+ {
+ if (isHot(id))
+ res = true;
+ clearActive();
+ }
+ }
+
+ if (isHot(id))
+ g_state.isHot = true;
+
+ return res;
+}
+
+static void updateInput(int mx, int my, unsigned char mbut, int scroll)
+{
+ bool left = (mbut & IMGUI_MBUT_LEFT) != 0;
+
+ g_state.mx = mx;
+ g_state.my = my;
+ g_state.leftPressed = !g_state.left && left;
+ g_state.leftReleased = g_state.left && !left;
+ g_state.left = left;
+
+ g_state.scroll = scroll;
+}
+
+void imguiBeginFrame(int mx, int my, unsigned char mbut, int scroll)
+{
+ updateInput(mx,my,mbut,scroll);
+
+ g_state.hot = g_state.hotToBe;
+ g_state.hotToBe = 0;
+
+ g_state.wentActive = false;
+ g_state.isActive = false;
+ g_state.isHot = false;
+
+ g_state.widgetX = 0;
+ g_state.widgetY = 0;
+ g_state.widgetW = 0;
+
+ g_state.areaId = 1;
+ g_state.widgetId = 1;
+
+ resetGfxCmdQueue();
+}
+
+void imguiEndFrame()
+{
+ clearInput();
+}
+
+const imguiGfxCmd* imguiGetRenderQueue()
+{
+ return g_gfxCmdQueue;
+}
+
+int imguiGetRenderQueueSize()
+{
+ return g_gfxCmdQueueSize;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+static const int BUTTON_HEIGHT = 20;
+static const int SLIDER_HEIGHT = 20;
+static const int SLIDER_MARKER_WIDTH = 10;
+static const int CHECK_SIZE = 8;
+static const int DEFAULT_SPACING = 4;
+static const int TEXT_HEIGHT = 8;
+static const int SCROLL_AREA_PADDING = 6;
+static const int INDENT_SIZE = 16;
+static const int AREA_HEADER = 28;
+
+static int g_scrollTop = 0;
+static int g_scrollBottom = 0;
+static int g_scrollRight = 0;
+static int g_scrollAreaTop = 0;
+static int* g_scrollVal = 0;
+static int g_focusTop = 0;
+static int g_focusBottom = 0;
+static unsigned int g_scrollId = 0;
+static bool g_insideScrollArea = false;
+
+bool imguiBeginScrollArea(const char* name, int x, int y, int w, int h, int* scroll)
+{
+ g_state.areaId++;
+ g_state.widgetId = 0;
+ g_scrollId = (g_state.areaId<<16) | g_state.widgetId;
+
+ g_state.widgetX = x + SCROLL_AREA_PADDING;
+ g_state.widgetY = y+h-AREA_HEADER + (*scroll);
+ g_state.widgetW = w - SCROLL_AREA_PADDING*4;
+ g_scrollTop = y-AREA_HEADER+h;
+ g_scrollBottom = y+SCROLL_AREA_PADDING;
+ g_scrollRight = x+w - SCROLL_AREA_PADDING*3;
+ g_scrollVal = scroll;
+
+ g_scrollAreaTop = g_state.widgetY;
+
+ g_focusTop = y-AREA_HEADER;
+ g_focusBottom = y-AREA_HEADER+h;
+
+ g_insideScrollArea = inRect(x, y, w, h, false);
+ g_state.insideCurrentScroll = g_insideScrollArea;
+
+ addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 6, imguiRGBA(0,0,0,192));
+
+ addGfxCmdText(x+AREA_HEADER/2, y+h-AREA_HEADER/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, name, imguiRGBA(255,255,255,128));
+
+ addGfxCmdScissor(x+SCROLL_AREA_PADDING, y+SCROLL_AREA_PADDING, w-SCROLL_AREA_PADDING*4, h-AREA_HEADER-SCROLL_AREA_PADDING);
+
+ return g_insideScrollArea;
+}
+
+void imguiEndScrollArea()
+{
+ // Disable scissoring.
+ addGfxCmdScissor(-1,-1,-1,-1);
+
+ // Draw scroll bar
+ int x = g_scrollRight+SCROLL_AREA_PADDING/2;
+ int y = g_scrollBottom;
+ int w = SCROLL_AREA_PADDING*2;
+ int h = g_scrollTop - g_scrollBottom;
+
+ int stop = g_scrollAreaTop;
+ int sbot = g_state.widgetY;
+ int sh = stop - sbot; // The scrollable area height.
+
+ float barHeight = (float)h/(float)sh;
+
+ if (barHeight < 1)
+ {
+ float barY = (float)(y - sbot)/(float)sh;
+ if (barY < 0) barY = 0;
+ if (barY > 1) barY = 1;
+
+ // Handle scroll bar logic.
+ unsigned int hid = g_scrollId;
+ int hx = x;
+ int hy = y + (int)(barY*h);
+ int hw = w;
+ int hh = (int)(barHeight*h);
+
+ const int range = h - (hh-1);
+ bool over = inRect(hx, hy, hw, hh);
+ buttonLogic(hid, over);
+ if (isActive(hid))
+ {
+ float u = (float)(hy-y) / (float)range;
+ if (g_state.wentActive)
+ {
+ g_state.dragY = g_state.my;
+ g_state.dragOrig = u;
+ }
+ if (g_state.dragY != g_state.my)
+ {
+ u = g_state.dragOrig + (g_state.my - g_state.dragY) / (float)range;
+ if (u < 0) u = 0;
+ if (u > 1) u = 1;
+ *g_scrollVal = (int)((1-u) * (sh - h));
+ }
+ }
+
+ // BG
+ addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, (float)w/2-1, imguiRGBA(0,0,0,196));
+ // Bar
+ if (isActive(hid))
+ addGfxCmdRoundedRect((float)hx, (float)hy, (float)hw, (float)hh, (float)w/2-1, imguiRGBA(255,196,0,196));
+ else
+ addGfxCmdRoundedRect((float)hx, (float)hy, (float)hw, (float)hh, (float)w/2-1, isHot(hid) ? imguiRGBA(255,196,0,96) : imguiRGBA(255,255,255,64));
+
+ // Handle mouse scrolling.
+ if (g_insideScrollArea) // && !anyActive())
+ {
+ if (g_state.scroll)
+ {
+ *g_scrollVal += 20*g_state.scroll;
+ if (*g_scrollVal < 0) *g_scrollVal = 0;
+ if (*g_scrollVal > (sh - h)) *g_scrollVal = (sh - h);
+ }
+ }
+ }
+ g_state.insideCurrentScroll = false;
+}
+
+bool imguiButton(const char* text, bool enabled)
+{
+ g_state.widgetId++;
+ unsigned int id = (g_state.areaId<<16) | g_state.widgetId;
+
+ int x = g_state.widgetX;
+ int y = g_state.widgetY - BUTTON_HEIGHT;
+ int w = g_state.widgetW;
+ int h = BUTTON_HEIGHT;
+ g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING;
+
+ bool over = enabled && inRect(x, y, w, h);
+ bool res = buttonLogic(id, over);
+
+ addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, (float)BUTTON_HEIGHT/2-1, imguiRGBA(128,128,128, isActive(id)?196:96));
+ if (enabled)
+ addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200));
+ else
+ addGfxCmdText(x+BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200));
+
+ return res;
+}
+
+bool imguiItem(const char* text, bool enabled, unsigned int color, bool forceHot)
+{
+ g_state.widgetId++;
+ unsigned int id = (g_state.areaId << 16) | g_state.widgetId;
+
+ int x = g_state.widgetX;
+ int y = g_state.widgetY - BUTTON_HEIGHT;
+ int w = g_state.widgetW;
+ int h = BUTTON_HEIGHT;
+ g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING;
+
+ bool over = enabled && inRect(x, y, w, h);
+ bool res = buttonLogic(id, over);
+
+ if (isHot(id))
+ addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 2.0f, imguiRGBA(255, 196, 0, isActive(id) ? 196 : 96));
+ else if (forceHot)
+ addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 2.0f, imguiRGBA(128, 128, 128, 96));
+
+ if (enabled)
+ addGfxCmdText(x + BUTTON_HEIGHT / 2, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, color);
+ else
+ addGfxCmdText(x + BUTTON_HEIGHT / 2, y + BUTTON_HEIGHT / 2 - TEXT_HEIGHT / 2, IMGUI_ALIGN_LEFT, text, color);
+
+ return res;
+}
+
+bool imguiCheck(const char* text, bool checked, bool enabled)
+{
+ g_state.widgetId++;
+ unsigned int id = (g_state.areaId<<16) | g_state.widgetId;
+
+ int x = g_state.widgetX;
+ int y = g_state.widgetY - BUTTON_HEIGHT;
+ int w = g_state.widgetW;
+ int h = BUTTON_HEIGHT;
+ g_state.widgetY -= BUTTON_HEIGHT + DEFAULT_SPACING;
+
+ bool over = enabled && inRect(x, y, w, h);
+ bool res = buttonLogic(id, over);
+
+ const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2;
+ const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2;
+ addGfxCmdRoundedRect((float)cx-3, (float)cy-3, (float)CHECK_SIZE+6, (float)CHECK_SIZE+6, 4, imguiRGBA(128,128,128, isActive(id)?196:96));
+ if (checked)
+ {
+ if (enabled)
+ addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE/2-1, imguiRGBA(255,255,255,isActive(id)?255:200));
+ else
+ addGfxCmdRoundedRect((float)cx, (float)cy, (float)CHECK_SIZE, (float)CHECK_SIZE, (float)CHECK_SIZE/2-1, imguiRGBA(128,128,128,200));
+ }
+
+ if (enabled)
+ addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200));
+ else
+ addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200));
+
+ return res;
+}
+
+bool imguiCollapse(const char* text, const char* subtext, bool checked, bool enabled)
+{
+ g_state.widgetId++;
+ unsigned int id = (g_state.areaId<<16) | g_state.widgetId;
+
+ int x = g_state.widgetX;
+ int y = g_state.widgetY - BUTTON_HEIGHT;
+ int w = g_state.widgetW;
+ int h = BUTTON_HEIGHT;
+ g_state.widgetY -= BUTTON_HEIGHT; // + DEFAULT_SPACING;
+
+ const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2;
+ const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2;
+
+ bool over = enabled && inRect(x, y, w, h);
+ bool res = buttonLogic(id, over);
+
+ if (checked)
+ addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 2, imguiRGBA(255,255,255,isActive(id)?255:200));
+ else
+ addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, imguiRGBA(255,255,255,isActive(id)?255:200));
+
+ if (enabled)
+ addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200));
+ else
+ addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200));
+
+ if (subtext)
+ addGfxCmdText(x+w-BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, subtext, imguiRGBA(255,255,255,128));
+
+ return res;
+}
+
+void imguiLabel(const char* text)
+{
+ int x = g_state.widgetX;
+ int y = g_state.widgetY - BUTTON_HEIGHT;
+ g_state.widgetY -= BUTTON_HEIGHT;
+ addGfxCmdText(x, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(255,255,255,255));
+}
+
+void imguiValue(const char* text)
+{
+ const int x = g_state.widgetX;
+ const int y = g_state.widgetY - BUTTON_HEIGHT;
+ const int w = g_state.widgetW;
+ g_state.widgetY -= BUTTON_HEIGHT;
+
+ addGfxCmdText(x+w-BUTTON_HEIGHT/2, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, text, imguiRGBA(255,255,255,200));
+}
+
+bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vinc, bool enabled)
+{
+ g_state.widgetId++;
+ unsigned int id = (g_state.areaId<<16) | g_state.widgetId;
+
+ int x = g_state.widgetX;
+ int y = g_state.widgetY - BUTTON_HEIGHT;
+ int w = g_state.widgetW;
+ int h = SLIDER_HEIGHT;
+ g_state.widgetY -= SLIDER_HEIGHT + DEFAULT_SPACING;
+
+ addGfxCmdRoundedRect((float)x, (float)y, (float)w, (float)h, 4.0f, imguiRGBA(0,0,0,128));
+
+ const int range = w - SLIDER_MARKER_WIDTH;
+
+ float u = (*val - vmin) / (vmax-vmin);
+ if (u < 0) u = 0;
+ if (u > 1) u = 1;
+ int m = (int)(u * range);
+
+ bool over = enabled && inRect(x+m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT);
+ bool res = buttonLogic(id, over);
+ bool valChanged = false;
+
+ if (isActive(id))
+ {
+ if (g_state.wentActive)
+ {
+ g_state.dragX = g_state.mx;
+ g_state.dragOrig = u;
+ }
+ if (g_state.dragX != g_state.mx)
+ {
+ u = g_state.dragOrig + (float)(g_state.mx - g_state.dragX) / (float)range;
+ if (u < 0) u = 0;
+ if (u > 1) u = 1;
+ *val = vmin + u*(vmax-vmin);
+ *val = floorf(*val/vinc+0.5f)*vinc; // Snap to vinc
+ m = (int)(u * range);
+ valChanged = true;
+ }
+ }
+
+ if (isActive(id))
+ addGfxCmdRoundedRect((float)(x+m), (float)y, (float)SLIDER_MARKER_WIDTH, (float)SLIDER_HEIGHT, 4.0f, imguiRGBA(255,255,255,255));
+ else
+ addGfxCmdRoundedRect((float)(x+m), (float)y, (float)SLIDER_MARKER_WIDTH, (float)SLIDER_HEIGHT, 4.0f, isHot(id) ? imguiRGBA(255,196,0,128) : imguiRGBA(255,255,255,64));
+
+ // TODO: fix this, take a look at 'nicenum'.
+ int digits = (int)(ceilf(log10f(vinc)));
+ char fmt[16];
+ snprintf(fmt, 16, "%%.%df", digits >= 0 ? 0 : -digits);
+ char msg[128];
+ snprintf(msg, 128, fmt, *val);
+
+ if (enabled)
+ {
+ addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200));
+ addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, msg, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200));
+ }
+ else
+ {
+ addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200));
+ addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, msg, imguiRGBA(128,128,128,200));
+ }
+
+ return res || valChanged;
+}
+
+
+void imguiIndent()
+{
+ g_state.widgetX += INDENT_SIZE;
+ g_state.widgetW -= INDENT_SIZE;
+}
+
+void imguiUnindent()
+{
+ g_state.widgetX -= INDENT_SIZE;
+ g_state.widgetW += INDENT_SIZE;
+}
+
+void imguiSeparator()
+{
+ g_state.widgetY -= DEFAULT_SPACING*3;
+}
+
+void imguiSeparatorLine()
+{
+ int x = g_state.widgetX;
+ int y = g_state.widgetY - DEFAULT_SPACING*2;
+ int w = g_state.widgetW;
+ int h = 1;
+ g_state.widgetY -= DEFAULT_SPACING*4;
+
+ addGfxCmdRect((float)x, (float)y, (float)w, (float)h, imguiRGBA(255,255,255,32));
+}
+
+void imguiDrawText(int x, int y, int align, const char* text, unsigned int color)
+{
+ addGfxCmdText(x, y, align, text, color);
+}
+
+void imguiDrawLine(float x0, float y0, float x1, float y1, float r, unsigned int color)
+{
+ addGfxCmdLine(x0, y0, x1, y1, r, color);
+}
+
+void imguiDrawRect(float x, float y, float w, float h, unsigned int color)
+{
+ addGfxCmdRect(x, y, w, h, color);
+}
+
+void imguiDrawRoundedRect(float x, float y, float w, float h, float r, unsigned int color)
+{
+ addGfxCmdRoundedRect(x, y, w, h, r, color);
+}
+
diff --git a/demo/imgui.h b/demo/imgui.h
new file mode 100644
index 0000000..10ff3ab
--- /dev/null
+++ b/demo/imgui.h
@@ -0,0 +1,110 @@
+//
+// Copyright (c) 2009-2010 Mikko Mononen [email protected]
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#ifndef IMGUI_H
+#define IMGUI_H
+
+enum imguiMouseButton
+{
+ IMGUI_MBUT_LEFT = 0x01,
+ IMGUI_MBUT_RIGHT = 0x02,
+};
+
+enum imguiTextAlign
+{
+ IMGUI_ALIGN_LEFT,
+ IMGUI_ALIGN_CENTER,
+ IMGUI_ALIGN_RIGHT,
+};
+
+inline unsigned int imguiRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
+{
+ return (r) | (g << 8) | (b << 16) | (a << 24);
+}
+
+struct imguiGfxRect;
+
+void imguiBeginFrame(int mx, int my, unsigned char mbut, int scroll);
+void imguiEndFrame();
+
+bool imguiBeginScrollArea(const char* name, int x, int y, int w, int h, int* scroll);
+void imguiEndScrollArea();
+
+void imguiIndent();
+void imguiUnindent();
+void imguiSeparator();
+void imguiSeparatorLine();
+
+bool imguiButton(const char* text, bool enabled = true);
+bool imguiItem(const char* text, bool enabled = true, unsigned int color = imguiRGBA(255, 255, 255, 200), bool forceHot = false);
+bool imguiCheck(const char* text, bool checked, bool enabled = true);
+bool imguiCollapse(const char* text, const char* subtext, bool checked, bool enabled = true);
+void imguiLabel(const char* text);
+void imguiValue(const char* text);
+bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vinc, bool enabled = true);
+
+void imguiDrawText(int x, int y, int align, const char* text, unsigned int color);
+void imguiDrawLine(float x0, float y0, float x1, float y1, float r, unsigned int color);
+void imguiDrawRoundedRect(float x, float y, float w, float h, float r, unsigned int color);
+void imguiDrawRect(float x, float y, float w, float h, unsigned int color);
+
+// Pull render interface.
+enum imguiGfxCmdType
+{
+ IMGUI_GFXCMD_RECT,
+ IMGUI_GFXCMD_TRIANGLE,
+ IMGUI_GFXCMD_LINE,
+ IMGUI_GFXCMD_TEXT,
+ IMGUI_GFXCMD_SCISSOR,
+};
+
+struct imguiGfxRect
+{
+ short x,y,w,h,r;
+};
+
+struct imguiGfxText
+{
+ short x,y,align;
+ const char* text;
+};
+
+struct imguiGfxLine
+{
+ short x0,y0,x1,y1,r;
+};
+
+struct imguiGfxCmd
+{
+ char type;
+ char flags;
+ char pad[2];
+ unsigned int col;
+ union
+ {
+ imguiGfxLine line;
+ imguiGfxRect rect;
+ imguiGfxText text;
+ };
+};
+
+const imguiGfxCmd* imguiGetRenderQueue();
+int imguiGetRenderQueueSize();
+
+
+#endif // IMGUI_H
diff --git a/demo/main.cpp b/demo/main.cpp
new file mode 100644
index 0000000..1ee4049
--- /dev/null
+++ b/demo/main.cpp
@@ -0,0 +1,3012 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2013-2017 NVIDIA Corporation. All rights reserved.
+
+#include "../core/types.h"
+#include "../core/maths.h"
+#include "../core/platform.h"
+#include "../core/mesh.h"
+#include "../core/voxelize.h"
+#include "../core/sdf.h"
+#include "../core/pfm.h"
+#include "../core/tga.h"
+#include "../core/perlin.h"
+#include "../core/convex.h"
+#include "../core/cloth.h"
+
+#include "../external/SDL2-2.0.4/include/SDL.h"
+
+#include "../include/NvFlex.h"
+#include "../include/NvFlexExt.h"
+#include "../include/NvFlexDevice.h"
+
+#include <iostream>
+#include <map>
+
+#include "shaders.h"
+#include "imgui.h"
+
+SDL_Window* g_window; // window handle
+unsigned int g_windowId; // window id
+
+#define SDL_CONTROLLER_BUTTON_LEFT_TRIGGER (SDL_CONTROLLER_BUTTON_MAX + 1)
+#define SDL_CONTROLLER_BUTTON_RIGHT_TRIGGER (SDL_CONTROLLER_BUTTON_MAX + 2)
+
+int GetKeyFromGameControllerButton(SDL_GameControllerButton button)
+{
+ switch (button)
+ {
+ case SDL_CONTROLLER_BUTTON_DPAD_UP: { return SDLK_q; } // -- camera translate up
+ case SDL_CONTROLLER_BUTTON_DPAD_DOWN: { return SDLK_z; } // -- camera translate down
+ case SDL_CONTROLLER_BUTTON_DPAD_LEFT: { return SDLK_h; } // -- hide GUI
+ case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: { return -1; } // -- unassigned
+ case SDL_CONTROLLER_BUTTON_START: { return SDLK_RETURN; } // -- start selected scene
+ case SDL_CONTROLLER_BUTTON_BACK: { return SDLK_ESCAPE; } // -- quit
+ case SDL_CONTROLLER_BUTTON_LEFTSHOULDER: { return SDLK_UP; } // -- select prev scene
+ case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER: { return SDLK_DOWN; } // -- select next scene
+ case SDL_CONTROLLER_BUTTON_A: { return SDLK_g; } // -- toggle gravity
+ case SDL_CONTROLLER_BUTTON_B: { return SDLK_p; } // -- pause
+ case SDL_CONTROLLER_BUTTON_X: { return SDLK_r; } // -- reset
+ case SDL_CONTROLLER_BUTTON_Y: { return SDLK_o; } // -- step sim
+ case SDL_CONTROLLER_BUTTON_RIGHT_TRIGGER: { return SDLK_SPACE; } // -- emit particles
+ default: { return -1; } // -- nop
+ };
+};
+
+//
+// Gamepad thresholds taken from XINPUT API
+//
+#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
+#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
+#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
+
+int deadzones[3] = { XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE, XINPUT_GAMEPAD_TRIGGER_THRESHOLD };
+
+inline float joyAxisFilter(int value, int stick)
+{
+ //clamp values in deadzone to zero, and remap rest of range so that it linearly rises in value from edge of deadzone toward max value.
+ if (value < -deadzones[stick])
+ return (value + deadzones[stick]) / (32768.0f - deadzones[stick]);
+ else if (value > deadzones[stick])
+ return (value - deadzones[stick]) / (32768.0f - deadzones[stick]);
+ else
+ return 0.0f;
+}
+
+SDL_GameController* g_gamecontroller = NULL;
+
+using namespace std;
+
+int g_screenWidth = 1280;
+int g_screenHeight = 720;
+int g_msaaSamples = 8;
+
+int g_numSubsteps;
+
+// a setting of -1 means Flex will use the device specified in the NVIDIA control panel
+int g_device = -1;
+char g_deviceName[256];
+bool g_vsync = true;
+
+bool g_benchmark = false;
+bool g_extensions = true;
+bool g_teamCity = false;
+bool g_interop = true;
+bool g_d3d12 = false;
+
+FluidRenderer* g_fluidRenderer;
+FluidRenderBuffers g_fluidRenderBuffers;
+DiffuseRenderBuffers g_diffuseRenderBuffers;
+
+NvFlexSolver* g_flex;
+NvFlexLibrary* g_flexLib;
+NvFlexParams g_params;
+NvFlexTimers g_timers;
+int g_numDetailTimers;
+NvFlexDetailTimer * g_detailTimers;
+
+int g_maxDiffuseParticles;
+unsigned char g_maxNeighborsPerParticle;
+int g_numExtraParticles;
+int g_numExtraMultiplier = 1;
+
+// mesh used for deformable object rendering
+Mesh* g_mesh;
+vector<int> g_meshSkinIndices;
+vector<float> g_meshSkinWeights;
+vector<Point3> g_meshRestPositions;
+const int g_numSkinWeights = 4;
+
+// mapping of collision mesh to render mesh
+std::map<NvFlexConvexMeshId, GpuMesh*> g_convexes;
+std::map<NvFlexTriangleMeshId, GpuMesh*> g_meshes;
+std::map<NvFlexDistanceFieldId, GpuMesh*> g_fields;
+
+// flag to request collision shapes be updated
+bool g_shapesChanged = false;
+
+struct SimBuffers
+{
+ NvFlexVector<Vec4> positions;
+ NvFlexVector<Vec4> restPositions;
+ NvFlexVector<Vec3> velocities;
+ NvFlexVector<int> phases;
+ NvFlexVector<float> densities;
+ NvFlexVector<Vec4> anisotropy1;
+ NvFlexVector<Vec4> anisotropy2;
+ NvFlexVector<Vec4> anisotropy3;
+ NvFlexVector<Vec4> normals;
+ NvFlexVector<Vec4> smoothPositions;
+ NvFlexVector<Vec4> diffusePositions;
+ NvFlexVector<Vec4> diffuseVelocities;
+ NvFlexVector<int> diffuseIndices;
+ NvFlexVector<int> activeIndices;
+
+ // convexes
+ NvFlexVector<NvFlexCollisionGeometry> shapeGeometry;
+ NvFlexVector<Vec4> shapePositions;
+ NvFlexVector<Quat> shapeRotations;
+ NvFlexVector<Vec4> shapePrevPositions;
+ NvFlexVector<Quat> shapePrevRotations;
+ NvFlexVector<int> shapeFlags;
+
+ // rigids
+ NvFlexVector<int> rigidOffsets;
+ NvFlexVector<int> rigidIndices;
+ NvFlexVector<int> rigidMeshSize;
+ NvFlexVector<float> rigidCoefficients;
+ NvFlexVector<Quat> rigidRotations;
+ NvFlexVector<Vec3> rigidTranslations;
+ NvFlexVector<Vec3> rigidLocalPositions;
+ NvFlexVector<Vec4> rigidLocalNormals;
+
+ // inflatables
+ NvFlexVector<int> inflatableTriOffsets;
+ NvFlexVector<int> inflatableTriCounts;
+ NvFlexVector<float> inflatableVolumes;
+ NvFlexVector<float> inflatableCoefficients;
+ NvFlexVector<float> inflatablePressures;
+
+ // springs
+ NvFlexVector<int> springIndices;
+ NvFlexVector<float> springLengths;
+ NvFlexVector<float> springStiffness;
+
+ NvFlexVector<int> triangles;
+ NvFlexVector<Vec3> triangleNormals;
+ NvFlexVector<Vec3> uvs;
+
+ SimBuffers(NvFlexLibrary* l) :
+ positions(l), restPositions(l), velocities(l), phases(l), densities(l),
+ anisotropy1(l), anisotropy2(l), anisotropy3(l), normals(l), smoothPositions(l),
+ diffusePositions(l), diffuseVelocities(l), diffuseIndices(l), activeIndices(l),
+ shapeGeometry(l), shapePositions(l), shapeRotations(l), shapePrevPositions(l),
+ shapePrevRotations(l), shapeFlags(l), rigidOffsets(l), rigidIndices(l), rigidMeshSize(l),
+ rigidCoefficients(l), rigidRotations(l), rigidTranslations(l),
+ rigidLocalPositions(l), rigidLocalNormals(l), inflatableTriOffsets(l),
+ inflatableTriCounts(l), inflatableVolumes(l), inflatableCoefficients(l),
+ inflatablePressures(l), springIndices(l), springLengths(l),
+ springStiffness(l), triangles(l), triangleNormals(l), uvs(l)
+ {}
+};
+
+SimBuffers* g_buffers;
+
+void MapBuffers(SimBuffers* buffers)
+{
+ buffers->positions.map();
+ buffers->restPositions.map();
+ buffers->velocities.map();
+ buffers->phases.map();
+ buffers->densities.map();
+ buffers->anisotropy1.map();
+ buffers->anisotropy2.map();
+ buffers->anisotropy3.map();
+ buffers->normals.map();
+ buffers->diffusePositions.map();
+ buffers->diffuseVelocities.map();
+ buffers->diffuseIndices.map();
+ buffers->smoothPositions.map();
+ buffers->activeIndices.map();
+
+ // convexes
+ buffers->shapeGeometry.map();
+ buffers->shapePositions.map();
+ buffers->shapeRotations.map();
+ buffers->shapePrevPositions.map();
+ buffers->shapePrevRotations.map();
+ buffers->shapeFlags.map();
+
+ buffers->rigidOffsets.map();
+ buffers->rigidIndices.map();
+ buffers->rigidMeshSize.map();
+ buffers->rigidCoefficients.map();
+ buffers->rigidRotations.map();
+ buffers->rigidTranslations.map();
+ buffers->rigidLocalPositions.map();
+ buffers->rigidLocalNormals.map();
+
+ buffers->springIndices.map();
+ buffers->springLengths.map();
+ buffers->springStiffness.map();
+
+ // inflatables
+ buffers->inflatableTriOffsets.map();
+ buffers->inflatableTriCounts.map();
+ buffers->inflatableVolumes.map();
+ buffers->inflatableCoefficients.map();
+ buffers->inflatablePressures.map();
+
+ buffers->triangles.map();
+ buffers->triangleNormals.map();
+ buffers->uvs.map();
+}
+
+void UnmapBuffers(SimBuffers* buffers)
+{
+ // particles
+ buffers->positions.unmap();
+ buffers->restPositions.unmap();
+ buffers->velocities.unmap();
+ buffers->phases.unmap();
+ buffers->densities.unmap();
+ buffers->anisotropy1.unmap();
+ buffers->anisotropy2.unmap();
+ buffers->anisotropy3.unmap();
+ buffers->normals.unmap();
+ buffers->diffusePositions.unmap();
+ buffers->diffuseVelocities.unmap();
+ buffers->diffuseIndices.unmap();
+ buffers->smoothPositions.unmap();
+ buffers->activeIndices.unmap();
+
+ // convexes
+ buffers->shapeGeometry.unmap();
+ buffers->shapePositions.unmap();
+ buffers->shapeRotations.unmap();
+ buffers->shapePrevPositions.unmap();
+ buffers->shapePrevRotations.unmap();
+ buffers->shapeFlags.unmap();
+
+ // rigids
+ buffers->rigidOffsets.unmap();
+ buffers->rigidIndices.unmap();
+ buffers->rigidMeshSize.unmap();
+ buffers->rigidCoefficients.unmap();
+ buffers->rigidRotations.unmap();
+ buffers->rigidTranslations.unmap();
+ buffers->rigidLocalPositions.unmap();
+ buffers->rigidLocalNormals.unmap();
+
+ // springs
+ buffers->springIndices.unmap();
+ buffers->springLengths.unmap();
+ buffers->springStiffness.unmap();
+
+ // inflatables
+ buffers->inflatableTriOffsets.unmap();
+ buffers->inflatableTriCounts.unmap();
+ buffers->inflatableVolumes.unmap();
+ buffers->inflatableCoefficients.unmap();
+ buffers->inflatablePressures.unmap();
+
+ // triangles
+ buffers->triangles.unmap();
+ buffers->triangleNormals.unmap();
+ buffers->uvs.unmap();
+
+}
+
+SimBuffers* AllocBuffers(NvFlexLibrary* lib)
+{
+ return new SimBuffers(lib);
+}
+
+void DestroyBuffers(SimBuffers* buffers)
+{
+ // particles
+ buffers->positions.destroy();
+ buffers->restPositions.destroy();
+ buffers->velocities.destroy();
+ buffers->phases.destroy();
+ buffers->densities.destroy();
+ buffers->anisotropy1.destroy();
+ buffers->anisotropy2.destroy();
+ buffers->anisotropy3.destroy();
+ buffers->normals.destroy();
+ buffers->diffusePositions.destroy();
+ buffers->diffuseVelocities.destroy();
+ buffers->diffuseIndices.destroy();
+ buffers->smoothPositions.destroy();
+ buffers->activeIndices.destroy();
+
+ // convexes
+ buffers->shapeGeometry.destroy();
+ buffers->shapePositions.destroy();
+ buffers->shapeRotations.destroy();
+ buffers->shapePrevPositions.destroy();
+ buffers->shapePrevRotations.destroy();
+ buffers->shapeFlags.destroy();
+
+ // rigids
+ buffers->rigidOffsets.destroy();
+ buffers->rigidIndices.destroy();
+ buffers->rigidMeshSize.destroy();
+ buffers->rigidCoefficients.destroy();
+ buffers->rigidRotations.destroy();
+ buffers->rigidTranslations.destroy();
+ buffers->rigidLocalPositions.destroy();
+ buffers->rigidLocalNormals.destroy();
+
+ // springs
+ buffers->springIndices.destroy();
+ buffers->springLengths.destroy();
+ buffers->springStiffness.destroy();
+
+ // inflatables
+ buffers->inflatableTriOffsets.destroy();
+ buffers->inflatableTriCounts.destroy();
+ buffers->inflatableVolumes.destroy();
+ buffers->inflatableCoefficients.destroy();
+ buffers->inflatablePressures.destroy();
+
+ // triangles
+ buffers->triangles.destroy();
+ buffers->triangleNormals.destroy();
+ buffers->uvs.destroy();
+
+ delete buffers;
+}
+
+Vec3 g_camPos(6.0f, 8.0f, 18.0f);
+Vec3 g_camAngle(0.0f, -DegToRad(20.0f), 0.0f);
+Vec3 g_camVel(0.0f);
+Vec3 g_camSmoothVel(0.0f);
+
+float g_camSpeed;
+float g_camNear;
+float g_camFar;
+
+Vec3 g_lightPos;
+Vec3 g_lightDir;
+Vec3 g_lightTarget;
+
+bool g_pause = false;
+bool g_step = false;
+bool g_capture = false;
+bool g_showHelp = true;
+bool g_tweakPanel = true;
+bool g_fullscreen = false;
+bool g_wireframe = false;
+bool g_debug = false;
+
+bool g_emit = false;
+bool g_warmup = false;
+
+float g_windTime = 0.0f;
+float g_windFrequency = 0.1f;
+float g_windStrength = 0.0f;
+
+bool g_wavePool = false;
+float g_waveTime = 0.0f;
+float g_wavePlane;
+float g_waveFrequency = 1.5f;
+float g_waveAmplitude = 1.0f;
+float g_waveFloorTilt = 0.0f;
+
+Vec3 g_sceneLower;
+Vec3 g_sceneUpper;
+
+float g_blur;
+float g_ior;
+bool g_drawEllipsoids;
+bool g_drawPoints;
+bool g_drawMesh;
+bool g_drawCloth;
+float g_expandCloth; // amount to expand cloth along normal (to account for particle radius)
+
+bool g_drawOpaque;
+int g_drawSprings; // 0: no draw, 1: draw stretch 2: draw tether
+bool g_drawBases = false;
+bool g_drawContacts = false;
+bool g_drawNormals = false;
+bool g_drawDiffuse;
+bool g_drawShapeGrid = false;
+bool g_drawDensity = false;
+bool g_drawRopes;
+float g_pointScale;
+float g_ropeScale;
+float g_drawPlaneBias; // move planes along their normal for rendering
+
+float g_diffuseScale;
+float g_diffuseMotionScale;
+bool g_diffuseShadow;
+float g_diffuseInscatter;
+float g_diffuseOutscatter;
+
+float g_dt = 1.0f / 60.0f; // the time delta used for simulation
+float g_realdt; // the real world time delta between updates
+
+float g_waitTime; // the CPU time spent waiting for the GPU
+float g_updateTime; // the CPU time spent on Flex
+float g_renderTime; // the CPU time spent calling OpenGL to render the scene
+ // the above times don't include waiting for vsync
+float g_simLatency; // the time the GPU spent between the first and last NvFlexUpdateSolver() operation. Because some GPUs context switch, this can include graphics time.
+
+int g_scene = 0;
+int g_selectedScene = g_scene;
+int g_levelScroll; // offset for level selection scroll area
+bool g_resetScene = false; //if the user clicks the reset button or presses the reset key this is set to true;
+
+int g_frame = 0;
+int g_numSolidParticles = 0;
+
+int g_mouseParticle = -1;
+float g_mouseT = 0.0f;
+Vec3 g_mousePos;
+float g_mouseMass;
+bool g_mousePicked = false;
+
+// mouse
+int g_lastx;
+int g_lasty;
+int g_lastb = -1;
+
+bool g_profile = false;
+
+ShadowMap* g_shadowMap;
+
+Vec4 g_fluidColor;
+Vec4 g_diffuseColor;
+Vec3 g_meshColor;
+Vec3 g_clearColor;
+float g_lightDistance;
+float g_fogDistance;
+
+FILE* g_ffmpeg;
+
+void DrawShapes();
+
+class Scene;
+vector<Scene*> g_scenes;
+
+struct Emitter
+{
+ Emitter() : mSpeed(0.0f), mEnabled(false), mLeftOver(0.0f), mWidth(8) {}
+
+ Vec3 mPos;
+ Vec3 mDir;
+ Vec3 mRight;
+ float mSpeed;
+ bool mEnabled;
+ float mLeftOver;
+ int mWidth;
+};
+
+vector<Emitter> g_emitters(1); // first emitter is the camera 'gun'
+
+struct Rope
+{
+ std::vector<int> mIndices;
+};
+
+vector<Rope> g_ropes;
+
+inline float sqr(float x) { return x*x; }
+
+#include "helpers.h"
+#include "scenes.h"
+#include "benchmark.h"
+
+void Init(int scene, bool centerCamera = true)
+{
+ RandInit();
+
+ if (g_flex)
+ {
+ if (g_buffers)
+ DestroyBuffers(g_buffers);
+
+ DestroyFluidRenderBuffers(g_fluidRenderBuffers);
+ DestroyDiffuseRenderBuffers(g_diffuseRenderBuffers);
+
+ for (auto& iter : g_meshes)
+ {
+ NvFlexDestroyTriangleMesh(g_flexLib, iter.first);
+ DestroyGpuMesh(iter.second);
+ }
+
+ for (auto& iter : g_fields)
+ {
+ NvFlexDestroyDistanceField(g_flexLib, iter.first);
+ DestroyGpuMesh(iter.second);
+ }
+
+ for (auto& iter : g_convexes)
+ {
+ NvFlexDestroyConvexMesh(g_flexLib, iter.first);
+ DestroyGpuMesh(iter.second);
+ }
+
+
+ g_fields.clear();
+ g_meshes.clear();
+ g_convexes.clear();
+
+ NvFlexDestroySolver(g_flex);
+ g_flex = NULL;
+ }
+
+ // alloc buffers
+ g_buffers = AllocBuffers(g_flexLib);
+
+ // map during initialization
+ MapBuffers(g_buffers);
+
+ g_buffers->positions.resize(0);
+ g_buffers->velocities.resize(0);
+ g_buffers->phases.resize(0);
+
+ g_buffers->rigidOffsets.resize(0);
+ g_buffers->rigidIndices.resize(0);
+ g_buffers->rigidMeshSize.resize(0);
+ g_buffers->rigidRotations.resize(0);
+ g_buffers->rigidTranslations.resize(0);
+ g_buffers->rigidCoefficients.resize(0);
+ g_buffers->rigidLocalPositions.resize(0);
+ g_buffers->rigidLocalNormals.resize(0);
+
+ g_buffers->springIndices.resize(0);
+ g_buffers->springLengths.resize(0);
+ g_buffers->springStiffness.resize(0);
+ g_buffers->triangles.resize(0);
+ g_buffers->triangleNormals.resize(0);
+ g_buffers->uvs.resize(0);
+
+ g_meshSkinIndices.resize(0);
+ g_meshSkinWeights.resize(0);
+
+ g_emitters.resize(1);
+ g_emitters[0].mEnabled = false;
+ g_emitters[0].mSpeed = 1.0f;
+
+ g_buffers->shapeGeometry.resize(0);
+ g_buffers->shapePositions.resize(0);
+ g_buffers->shapeRotations.resize(0);
+ g_buffers->shapePrevPositions.resize(0);
+ g_buffers->shapePrevRotations.resize(0);
+ g_buffers->shapeFlags.resize(0);
+
+ g_ropes.resize(0);
+
+ // remove collision shapes
+ delete g_mesh; g_mesh = NULL;
+
+ g_frame = 0;
+ g_pause = false;
+
+ g_dt = 1.0f / 60.0f;
+ g_waveTime = 0.0f;
+ g_windTime = 0.0f;
+ g_windStrength = 1.0f;
+
+ g_blur = 1.0f;
+ g_fluidColor = Vec4(0.1f, 0.4f, 0.8f, 1.0f);
+ g_meshColor = Vec3(0.9f, 0.9f, 0.9f);
+ g_drawEllipsoids = false;
+ g_drawPoints = true;
+ g_drawCloth = true;
+ g_expandCloth = 0.0f;
+
+ g_drawOpaque = false;
+ g_drawSprings = false;
+ g_drawDiffuse = false;
+ g_drawMesh = true;
+ g_drawRopes = true;
+ g_drawDensity = false;
+ g_ior = 1.0f;
+ g_lightDistance = 2.0f;
+ g_fogDistance = 0.005f;
+
+ g_camSpeed = 0.075f;
+ g_camNear = 0.01f;
+ g_camFar = 1000.0f;
+
+ g_pointScale = 1.0f;
+ g_ropeScale = 1.0f;
+ g_drawPlaneBias = 0.0f;
+
+ // sim params
+ g_params.gravity[0] = 0.0f;
+ g_params.gravity[1] = -9.8f;
+ g_params.gravity[2] = 0.0f;
+
+ g_params.wind[0] = 0.0f;
+ g_params.wind[1] = 0.0f;
+ g_params.wind[2] = 0.0f;
+
+ g_params.radius = 0.15f;
+ g_params.viscosity = 0.0f;
+ g_params.dynamicFriction = 0.0f;
+ g_params.staticFriction = 0.0f;
+ g_params.particleFriction = 0.0f; // scale friction between particles by default
+ g_params.freeSurfaceDrag = 0.0f;
+ g_params.drag = 0.0f;
+ g_params.lift = 0.0f;
+ g_params.numIterations = 3;
+ g_params.fluidRestDistance = 0.0f;
+ g_params.solidRestDistance = 0.0f;
+
+ g_params.anisotropyScale = 1.0f;
+ g_params.anisotropyMin = 0.1f;
+ g_params.anisotropyMax = 2.0f;
+ g_params.smoothing = 1.0f;
+
+ g_params.dissipation = 0.0f;
+ g_params.damping = 0.0f;
+ g_params.particleCollisionMargin = 0.0f;
+ g_params.shapeCollisionMargin = 0.0f;
+ g_params.collisionDistance = 0.0f;
+ g_params.plasticThreshold = 0.0f;
+ g_params.plasticCreep = 0.0f;
+ g_params.fluid = false;
+ g_params.sleepThreshold = 0.0f;
+ g_params.shockPropagation = 0.0f;
+ g_params.restitution = 0.0f;
+
+ g_params.maxSpeed = FLT_MAX;
+ g_params.maxAcceleration = 100.0f; // approximately 10x gravity
+
+ g_params.relaxationMode = eNvFlexRelaxationLocal;
+ g_params.relaxationFactor = 1.0f;
+ g_params.solidPressure = 1.0f;
+ g_params.adhesion = 0.0f;
+ g_params.cohesion = 0.025f;
+ g_params.surfaceTension = 0.0f;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.buoyancy = 1.0f;
+ g_params.diffuseThreshold = 100.0f;
+ g_params.diffuseBuoyancy = 1.0f;
+ g_params.diffuseDrag = 0.8f;
+ g_params.diffuseBallistic = 16;
+ g_params.diffuseSortAxis[0] = 0.0f;
+ g_params.diffuseSortAxis[1] = 0.0f;
+ g_params.diffuseSortAxis[2] = 0.0f;
+ g_params.diffuseLifetime = 2.0f;
+
+ g_numSubsteps = 2;
+
+ // planes created after particles
+ g_params.numPlanes = 1;
+
+ g_diffuseScale = 0.5f;
+ g_diffuseColor = 1.0f;
+ g_diffuseMotionScale = 1.0f;
+ g_diffuseShadow = false;
+ g_diffuseInscatter = 0.8f;
+ g_diffuseOutscatter = 0.53f;
+
+ // reset phase 0 particle color to blue
+ extern Colour gColors[];
+ gColors[0] = Colour(0.0f, 0.5f, 1.0f);
+
+ g_numSolidParticles = 0;
+
+ g_waveFrequency = 1.5f;
+ g_waveAmplitude = 1.5f;
+ g_waveFloorTilt = 0.0f;
+ g_emit = false;
+ g_warmup = false;
+
+ g_mouseParticle = -1;
+
+ g_maxDiffuseParticles = 0; // number of diffuse particles
+ g_maxNeighborsPerParticle = 96;
+ g_numExtraParticles = 0; // number of particles allocated but not made active
+
+ g_sceneLower = FLT_MAX;
+ g_sceneUpper = -FLT_MAX;
+
+ // create scene
+ g_scenes[g_scene]->Initialize();
+
+ uint32_t numParticles = g_buffers->positions.size();
+ uint32_t maxParticles = numParticles + g_numExtraParticles*g_numExtraMultiplier;
+
+ // by default solid particles use the maximum radius
+ if (g_params.fluid && g_params.solidRestDistance == 0.0f)
+ g_params.solidRestDistance = g_params.fluidRestDistance;
+ else
+ g_params.solidRestDistance = g_params.radius;
+
+ // collision distance with shapes half the radius
+ if (g_params.collisionDistance == 0.0f)
+ {
+ g_params.collisionDistance = g_params.radius*0.5f;
+
+ if (g_params.fluid)
+ g_params.collisionDistance = g_params.fluidRestDistance*0.5f;
+ }
+
+ // default particle friction to 10% of shape friction
+ if (g_params.particleFriction == 0.0f)
+ g_params.particleFriction = g_params.dynamicFriction*0.1f;
+
+ // add a margin for detecting contacts between particles and shapes
+ if (g_params.shapeCollisionMargin == 0.0f)
+ g_params.shapeCollisionMargin = g_params.collisionDistance*0.5f;
+
+ // calculate particle bounds
+ Vec3 particleLower, particleUpper;
+ GetParticleBounds(particleLower, particleUpper);
+
+ // accommodate shapes
+ Vec3 shapeLower, shapeUpper;
+ GetShapeBounds(shapeLower, shapeUpper);
+
+ // update bounds
+ g_sceneLower = Min(Min(g_sceneLower, particleLower), shapeLower);
+ g_sceneUpper = Max(Max(g_sceneUpper, particleUpper), shapeUpper);
+
+ g_sceneLower -= g_params.collisionDistance;
+ g_sceneUpper += g_params.collisionDistance;
+
+ // update collision planes to match flexs
+ Vec3 up = Normalize(Vec3(-g_waveFloorTilt, 1.0f, 0.0f));
+
+ (Vec4&)g_params.planes[0] = Vec4(up.x, up.y, up.z, 0.0f);
+ (Vec4&)g_params.planes[1] = Vec4(0.0f, 0.0f, 1.0f, -g_sceneLower.z);
+ (Vec4&)g_params.planes[2] = Vec4(1.0f, 0.0f, 0.0f, -g_sceneLower.x);
+ (Vec4&)g_params.planes[3] = Vec4(-1.0f, 0.0f, 0.0f, g_sceneUpper.x);
+ (Vec4&)g_params.planes[4] = Vec4(0.0f, 0.0f, -1.0f, g_sceneUpper.z);
+ (Vec4&)g_params.planes[5] = Vec4(0.0f, -1.0f, 0.0f, g_sceneUpper.y);
+
+ g_wavePlane = g_params.planes[2][3];
+
+ g_buffers->diffusePositions.resize(g_maxDiffuseParticles);
+ g_buffers->diffuseVelocities.resize(g_maxDiffuseParticles);
+ g_buffers->diffuseIndices.resize(g_maxDiffuseParticles);
+
+ // for fluid rendering these are the Laplacian smoothed positions
+ g_buffers->smoothPositions.resize(maxParticles);
+
+ g_buffers->normals.resize(0);
+ g_buffers->normals.resize(maxParticles);
+
+ // initialize normals (just for rendering before simulation starts)
+ int numTris = g_buffers->triangles.size() / 3;
+ for (int i = 0; i < numTris; ++i)
+ {
+ Vec3 v0 = Vec3(g_buffers->positions[g_buffers->triangles[i * 3 + 0]]);
+ Vec3 v1 = Vec3(g_buffers->positions[g_buffers->triangles[i * 3 + 1]]);
+ Vec3 v2 = Vec3(g_buffers->positions[g_buffers->triangles[i * 3 + 2]]);
+
+ Vec3 n = Cross(v1 - v0, v2 - v0);
+
+ g_buffers->normals[g_buffers->triangles[i * 3 + 0]] += Vec4(n, 0.0f);
+ g_buffers->normals[g_buffers->triangles[i * 3 + 1]] += Vec4(n, 0.0f);
+ g_buffers->normals[g_buffers->triangles[i * 3 + 2]] += Vec4(n, 0.0f);
+ }
+
+ for (int i = 0; i < int(maxParticles); ++i)
+ g_buffers->normals[i] = Vec4(SafeNormalize(Vec3(g_buffers->normals[i]), Vec3(0.0f, 1.0f, 0.0f)), 0.0f);
+
+
+ // save mesh positions for skinning
+ if (g_mesh)
+ {
+ g_meshRestPositions = g_mesh->m_positions;
+ }
+ else
+ {
+ g_meshRestPositions.resize(0);
+ }
+
+ // main create method for the Flex solver
+ g_flex = NvFlexCreateSolver(g_flexLib, maxParticles, g_maxDiffuseParticles, g_maxNeighborsPerParticle);
+
+ // give scene a chance to do some post solver initialization
+ g_scenes[g_scene]->PostInitialize();
+
+ // center camera on particles
+ if (centerCamera)
+ {
+ g_camPos = Vec3((g_sceneLower.x + g_sceneUpper.x)*0.5f, min(g_sceneUpper.y*1.25f, 6.0f), g_sceneUpper.z + min(g_sceneUpper.y, 6.0f)*2.0f);
+ g_camAngle = Vec3(0.0f, -DegToRad(15.0f), 0.0f);
+
+ // give scene a chance to modify camera position
+ g_scenes[g_scene]->CenterCamera();
+ }
+
+ // create active indices (just a contiguous block for the demo)
+ g_buffers->activeIndices.resize(g_buffers->positions.size());
+ for (int i = 0; i < g_buffers->activeIndices.size(); ++i)
+ g_buffers->activeIndices[i] = i;
+
+ // resize particle buffers to fit
+ g_buffers->positions.resize(maxParticles);
+ g_buffers->velocities.resize(maxParticles);
+ g_buffers->phases.resize(maxParticles);
+
+ g_buffers->densities.resize(maxParticles);
+ g_buffers->anisotropy1.resize(maxParticles);
+ g_buffers->anisotropy2.resize(maxParticles);
+ g_buffers->anisotropy3.resize(maxParticles);
+
+ // save rest positions
+ g_buffers->restPositions.resize(g_buffers->positions.size());
+ for (int i = 0; i < g_buffers->positions.size(); ++i)
+ g_buffers->restPositions[i] = g_buffers->positions[i];
+
+ // builds rigids constraints
+ if (g_buffers->rigidOffsets.size())
+ {
+ assert(g_buffers->rigidOffsets.size() > 1);
+
+ const int numRigids = g_buffers->rigidOffsets.size() - 1;
+
+ // calculate local rest space positions
+ g_buffers->rigidLocalPositions.resize(g_buffers->rigidOffsets.back());
+ CalculateRigidLocalPositions(&g_buffers->positions[0], g_buffers->positions.size(), &g_buffers->rigidOffsets[0], &g_buffers->rigidIndices[0], numRigids, &g_buffers->rigidLocalPositions[0]);
+
+ g_buffers->rigidRotations.resize(g_buffers->rigidOffsets.size() - 1, Quat());
+ g_buffers->rigidTranslations.resize(g_buffers->rigidOffsets.size() - 1, Vec3());
+
+ }
+
+ // unmap so we can start transferring data to GPU
+ UnmapBuffers(g_buffers);
+
+ //-----------------------------
+ // Send data to Flex
+
+ NvFlexSetParams(g_flex, &g_params);
+ NvFlexSetParticles(g_flex, g_buffers->positions.buffer, numParticles);
+ NvFlexSetVelocities(g_flex, g_buffers->velocities.buffer, numParticles);
+ NvFlexSetNormals(g_flex, g_buffers->normals.buffer, numParticles);
+ NvFlexSetPhases(g_flex, g_buffers->phases.buffer, g_buffers->phases.size());
+ NvFlexSetRestParticles(g_flex, g_buffers->restPositions.buffer, g_buffers->restPositions.size());
+
+ NvFlexSetActive(g_flex, g_buffers->activeIndices.buffer, numParticles);
+
+ // springs
+ if (g_buffers->springIndices.size())
+ {
+ assert((g_buffers->springIndices.size() & 1) == 0);
+ assert((g_buffers->springIndices.size() / 2) == g_buffers->springLengths.size());
+
+ NvFlexSetSprings(g_flex, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size());
+ }
+
+ // rigids
+ if (g_buffers->rigidOffsets.size())
+ {
+ NvFlexSetRigids(g_flex, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size());
+ }
+
+ // inflatables
+ if (g_buffers->inflatableTriOffsets.size())
+ {
+ NvFlexSetInflatables(g_flex, g_buffers->inflatableTriOffsets.buffer, g_buffers->inflatableTriCounts.buffer, g_buffers->inflatableVolumes.buffer, g_buffers->inflatablePressures.buffer, g_buffers->inflatableCoefficients.buffer, g_buffers->inflatableTriOffsets.size());
+ }
+
+ // dynamic triangles
+ if (g_buffers->triangles.size())
+ {
+ NvFlexSetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3);
+ }
+
+ // collision shapes
+ if (g_buffers->shapeFlags.size())
+ {
+ NvFlexSetShapes(
+ g_flex,
+ g_buffers->shapeGeometry.buffer,
+ g_buffers->shapePositions.buffer,
+ g_buffers->shapeRotations.buffer,
+ g_buffers->shapePrevPositions.buffer,
+ g_buffers->shapePrevRotations.buffer,
+ g_buffers->shapeFlags.buffer,
+ int(g_buffers->shapeFlags.size()));
+ }
+
+ // create render buffers
+ g_fluidRenderBuffers = CreateFluidRenderBuffers(maxParticles, g_interop);
+ g_diffuseRenderBuffers = CreateDiffuseRenderBuffers(g_maxDiffuseParticles, g_interop);
+
+ // perform initial sim warm up
+ if (g_warmup)
+ {
+ printf("Warming up sim..\n");
+
+ // warm it up (relax positions to reach rest density without affecting velocity)
+ NvFlexParams copy = g_params;
+ copy.numIterations = 4;
+
+ NvFlexSetParams(g_flex, &copy);
+
+ const int kWarmupIterations = 100;
+
+ for (int i = 0; i < kWarmupIterations; ++i)
+ {
+ NvFlexUpdateSolver(g_flex, 0.0001f, 1, false);
+ NvFlexSetVelocities(g_flex, g_buffers->velocities.buffer, maxParticles);
+ }
+
+ // udpate host copy
+ NvFlexGetParticles(g_flex, g_buffers->positions.buffer, g_buffers->positions.size());
+ NvFlexGetSmoothParticles(g_flex, g_buffers->smoothPositions.buffer, g_buffers->smoothPositions.size());
+ NvFlexGetAnisotropy(g_flex, g_buffers->anisotropy1.buffer, g_buffers->anisotropy2.buffer, g_buffers->anisotropy3.buffer);
+
+ printf("Finished warm up.\n");
+ }
+}
+
+void Reset()
+{
+ Init(g_scene, false);
+}
+
+void Shutdown()
+{
+ // free buffers
+ DestroyBuffers(g_buffers);
+
+ for (auto& iter : g_meshes)
+ {
+ NvFlexDestroyTriangleMesh(g_flexLib, iter.first);
+ DestroyGpuMesh(iter.second);
+ }
+
+ for (auto& iter : g_fields)
+ {
+ NvFlexDestroyDistanceField(g_flexLib, iter.first);
+ DestroyGpuMesh(iter.second);
+ }
+
+ for (auto& iter : g_convexes)
+ {
+ NvFlexDestroyConvexMesh(g_flexLib, iter.first);
+ DestroyGpuMesh(iter.second);
+ }
+
+ g_fields.clear();
+ g_meshes.clear();
+
+ NvFlexDestroySolver(g_flex);
+ NvFlexShutdown(g_flexLib);
+
+#if _WIN32
+ if (g_ffmpeg)
+ _pclose(g_ffmpeg);
+#endif
+}
+
+void UpdateEmitters()
+{
+ float spin = DegToRad(15.0f);
+
+ const Vec3 forward(-sinf(g_camAngle.x + spin)*cosf(g_camAngle.y), sinf(g_camAngle.y), -cosf(g_camAngle.x + spin)*cosf(g_camAngle.y));
+ const Vec3 right(Normalize(Cross(forward, Vec3(0.0f, 1.0f, 0.0f))));
+
+ g_emitters[0].mDir = Normalize(forward + Vec3(0.0, 0.4f, 0.0f));
+ g_emitters[0].mRight = right;
+ g_emitters[0].mPos = g_camPos + forward*1.f + Vec3(0.0f, 0.2f, 0.0f) + right*0.65f;
+
+ // process emitters
+ if (g_emit)
+ {
+ int activeCount = NvFlexGetActiveCount(g_flex);
+
+ size_t e = 0;
+
+ // skip camera emitter when moving forward or things get messy
+ if (g_camSmoothVel.z >= 0.025f)
+ e = 1;
+
+ for (; e < g_emitters.size(); ++e)
+ {
+ if (!g_emitters[e].mEnabled)
+ continue;
+
+ Vec3 emitterDir = g_emitters[e].mDir;
+ Vec3 emitterRight = g_emitters[e].mRight;
+ Vec3 emitterPos = g_emitters[e].mPos;
+
+ float r;
+ int phase;
+
+ if (g_params.fluid)
+ {
+ r = g_params.fluidRestDistance;
+ phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid);
+ }
+ else
+ {
+ r = g_params.solidRestDistance;
+ phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide);
+ }
+
+ float numParticles = (g_emitters[e].mSpeed / r)*g_dt;
+
+ // whole number to emit
+ int n = int(numParticles + g_emitters[e].mLeftOver);
+
+ if (n)
+ g_emitters[e].mLeftOver = (numParticles + g_emitters[e].mLeftOver) - n;
+ else
+ g_emitters[e].mLeftOver += numParticles;
+
+ // create a grid of particles (n particles thick)
+ for (int k = 0; k < n; ++k)
+ {
+ int emitterWidth = g_emitters[e].mWidth;
+ int numParticles = emitterWidth*emitterWidth;
+ for (int i = 0; i < numParticles; ++i)
+ {
+ float x = float(i%emitterWidth) - float(emitterWidth/2);
+ float y = float((i / emitterWidth) % emitterWidth) - float(emitterWidth/2);
+
+ if ((sqr(x) + sqr(y)) <= (emitterWidth / 2)*(emitterWidth / 2))
+ {
+ Vec3 up = Normalize(Cross(emitterDir, emitterRight));
+ Vec3 offset = r*(emitterRight*x + up*y) + float(k)*emitterDir*r;
+
+ if (activeCount < g_buffers->positions.size())
+ {
+ g_buffers->positions[activeCount] = Vec4(emitterPos + offset, 1.0f);
+ g_buffers->velocities[activeCount] = emitterDir*g_emitters[e].mSpeed;
+ g_buffers->phases[activeCount] = phase;
+
+ g_buffers->activeIndices.push_back(activeCount);
+
+ activeCount++;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void UpdateCamera()
+{
+ Vec3 forward(-sinf(g_camAngle.x)*cosf(g_camAngle.y), sinf(g_camAngle.y), -cosf(g_camAngle.x)*cosf(g_camAngle.y));
+ Vec3 right(Normalize(Cross(forward, Vec3(0.0f, 1.0f, 0.0f))));
+
+ g_camSmoothVel = Lerp(g_camSmoothVel, g_camVel, 0.1f);
+ g_camPos += (forward*g_camSmoothVel.z + right*g_camSmoothVel.x + Cross(right, forward)*g_camSmoothVel.y);
+}
+
+void UpdateMouse()
+{
+ // mouse button is up release particle
+ if (g_lastb == -1)
+ {
+ if (g_mouseParticle != -1)
+ {
+ // restore particle mass
+ g_buffers->positions[g_mouseParticle].w = g_mouseMass;
+
+ // deselect
+ g_mouseParticle = -1;
+ }
+ }
+
+ // mouse went down, pick new particle
+ if (g_mousePicked)
+ {
+ assert(g_mouseParticle == -1);
+
+ Vec3 origin, dir;
+ GetViewRay(g_lastx, g_screenHeight - g_lasty, origin, dir);
+
+ const int numActive = NvFlexGetActiveCount(g_flex);
+
+ g_mouseParticle = PickParticle(origin, dir, &g_buffers->positions[0], &g_buffers->phases[0], numActive, g_params.radius*0.8f, g_mouseT);
+
+ if (g_mouseParticle != -1)
+ {
+ printf("picked: %d, mass: %f v: %f %f %f\n", g_mouseParticle, g_buffers->positions[g_mouseParticle].w, g_buffers->velocities[g_mouseParticle].x, g_buffers->velocities[g_mouseParticle].y, g_buffers->velocities[g_mouseParticle].z);
+
+ g_mousePos = origin + dir*g_mouseT;
+ g_mouseMass = g_buffers->positions[g_mouseParticle].w;
+ g_buffers->positions[g_mouseParticle].w = 0.0f; // increase picked particle's mass to force it towards the point
+ }
+
+ g_mousePicked = false;
+ }
+
+ // update picked particle position
+ if (g_mouseParticle != -1)
+ {
+ Vec3 p = Lerp(Vec3(g_buffers->positions[g_mouseParticle]), g_mousePos, 0.8f);
+ Vec3 delta = p - Vec3(g_buffers->positions[g_mouseParticle]);
+
+ g_buffers->positions[g_mouseParticle].x = p.x;
+ g_buffers->positions[g_mouseParticle].y = p.y;
+ g_buffers->positions[g_mouseParticle].z = p.z;
+
+ g_buffers->velocities[g_mouseParticle].x = delta.x / g_dt;
+ g_buffers->velocities[g_mouseParticle].y = delta.y / g_dt;
+ g_buffers->velocities[g_mouseParticle].z = delta.z / g_dt;
+ }
+}
+
+void UpdateWind()
+{
+ g_windTime += g_dt;
+
+ const Vec3 kWindDir = Vec3(3.0f, 15.0f, 0.0f);
+ const float kNoise = Perlin1D(g_windTime*g_windFrequency, 10, 0.25f);
+ Vec3 wind = g_windStrength*kWindDir*Vec3(kNoise, fabsf(kNoise), 0.0f);
+
+ g_params.wind[0] = wind.x;
+ g_params.wind[1] = wind.y;
+ g_params.wind[2] = wind.z;
+
+ if (g_wavePool)
+ {
+ g_waveTime += g_dt;
+
+ g_params.planes[2][3] = g_wavePlane + (sinf(float(g_waveTime)*g_waveFrequency - kPi*0.5f)*0.5f + 0.5f)*g_waveAmplitude;
+ }
+}
+
+void SyncScene()
+{
+ // let the scene send updates to flex directly
+ g_scenes[g_scene]->Sync();
+}
+
+void UpdateScene()
+{
+ // give scene a chance to make changes to particle buffers
+ g_scenes[g_scene]->Update();
+}
+
+void RenderScene()
+{
+ const int numParticles = NvFlexGetActiveCount(g_flex);
+ const int numDiffuse = NvFlexGetDiffuseParticles(g_flex, NULL, NULL, NULL);
+
+ //---------------------------------------------------
+ // use VBO buffer wrappers to allow Flex to write directly to the OpenGL buffers
+ // Flex will take care of any CUDA interop mapping/unmapping during the get() operations
+
+ if (numParticles)
+ {
+
+ if (g_interop)
+ {
+ // copy data directly from solver to the renderer buffers
+ UpdateFluidRenderBuffers(g_fluidRenderBuffers, g_flex, g_drawEllipsoids, g_drawDensity);
+ }
+ else
+ {
+ // copy particle data to GPU render device
+
+ if (g_drawEllipsoids)
+ {
+ // if fluid surface rendering then update with smooth positions and anisotropy
+ UpdateFluidRenderBuffers(g_fluidRenderBuffers,
+ &g_buffers->smoothPositions[0],
+ (g_drawDensity) ? &g_buffers->densities[0] : (float*)&g_buffers->phases[0],
+ &g_buffers->anisotropy1[0],
+ &g_buffers->anisotropy2[0],
+ &g_buffers->anisotropy3[0],
+ g_buffers->positions.size(),
+ &g_buffers->activeIndices[0],
+ numParticles);
+ }
+ else
+ {
+ // otherwise just send regular positions and no anisotropy
+ UpdateFluidRenderBuffers(g_fluidRenderBuffers,
+ &g_buffers->positions[0],
+ (float*)&g_buffers->phases[0],
+ NULL, NULL, NULL,
+ g_buffers->positions.size(),
+ &g_buffers->activeIndices[0],
+ numParticles);
+ }
+ }
+ }
+
+ if (numDiffuse)
+ {
+ if (g_interop)
+ {
+ // copy data directly from solver to the renderer buffers
+ UpdateDiffuseRenderBuffers(g_diffuseRenderBuffers, g_flex);
+ }
+ else
+ {
+ // copy diffuse particle data from host to GPU render device
+ UpdateDiffuseRenderBuffers(g_diffuseRenderBuffers,
+ &g_buffers->diffusePositions[0],
+ &g_buffers->diffuseVelocities[0],
+ &g_buffers->diffuseIndices[0],
+ numDiffuse);
+ }
+ }
+
+ //---------------------------------------
+ // setup view and state
+
+ float fov = kPi / 4.0f;
+ float aspect = float(g_screenWidth) / g_screenHeight;
+
+ Matrix44 proj = ProjectionMatrix(RadToDeg(fov), aspect, g_camNear, g_camFar);
+ Matrix44 view = RotationMatrix(-g_camAngle.x, Vec3(0.0f, 1.0f, 0.0f))*RotationMatrix(-g_camAngle.y, Vec3(cosf(-g_camAngle.x), 0.0f, sinf(-g_camAngle.x)))*TranslationMatrix(-Point3(g_camPos));
+
+ //------------------------------------
+ // lighting pass
+
+ // expand scene bounds to fit most scenes
+ g_sceneLower = Min(g_sceneLower, Vec3(-2.0f, 0.0f, -2.0f));
+ g_sceneUpper = Max(g_sceneUpper, Vec3(2.0f, 2.0f, 2.0f));
+
+ Vec3 sceneExtents = g_sceneUpper - g_sceneLower;
+ Vec3 sceneCenter = 0.5f*(g_sceneUpper + g_sceneLower);
+
+ g_lightDir = Normalize(Vec3(5.0f, 15.0f, 7.5f));
+ g_lightPos = sceneCenter + g_lightDir*Length(sceneExtents)*g_lightDistance;
+ g_lightTarget = sceneCenter;
+
+ // calculate tight bounds for shadow frustum
+ float lightFov = 2.0f*atanf(Length(g_sceneUpper - sceneCenter) / Length(g_lightPos - sceneCenter));
+
+ // scale and clamp fov for aesthetics
+ lightFov = Clamp(lightFov, DegToRad(25.0f), DegToRad(65.0f));
+
+ Matrix44 lightPerspective = ProjectionMatrix(RadToDeg(lightFov), 1.0f, 1.0f, 1000.0f);
+ Matrix44 lightView = LookAtMatrix(Point3(g_lightPos), Point3(g_lightTarget));
+ Matrix44 lightTransform = lightPerspective*lightView;
+
+ // non-fluid particles maintain radius distance (not 2.0f*radius) so multiply by a half
+ float radius = g_params.solidRestDistance;
+
+ // fluid particles overlap twice as much again, so half the radius again
+ if (g_params.fluid)
+ radius = g_params.fluidRestDistance;
+
+ radius *= 0.5f;
+ radius *= g_pointScale;
+
+ //-------------------------------------
+ // shadowing pass
+
+ if (g_meshSkinIndices.size())
+ SkinMesh();
+
+ // create shadow maps
+ ShadowBegin(g_shadowMap);
+
+ SetView(lightView, lightPerspective);
+ SetCullMode(false);
+
+ // give scene a chance to do custom drawing
+ g_scenes[g_scene]->Draw(1);
+
+ if (g_drawMesh)
+ DrawMesh(g_mesh, g_meshColor);
+
+ DrawShapes();
+
+ if (g_drawCloth && g_buffers->triangles.size())
+ {
+ DrawCloth(&g_buffers->positions[0], &g_buffers->normals[0], g_buffers->uvs.size() ? &g_buffers->uvs[0].x : NULL, &g_buffers->triangles[0], g_buffers->triangles.size() / 3, g_buffers->positions.size(), 3, g_expandCloth);
+ }
+
+ if (g_drawRopes)
+ {
+ for (size_t i = 0; i < g_ropes.size(); ++i)
+ DrawRope(&g_buffers->positions[0], &g_ropes[i].mIndices[0], g_ropes[i].mIndices.size(), radius*g_ropeScale, i);
+ }
+
+ int shadowParticles = numParticles;
+ int shadowParticlesOffset = 0;
+
+ if (!g_drawPoints)
+ {
+ shadowParticles = 0;
+
+ if (g_drawEllipsoids && g_params.fluid)
+ {
+ shadowParticles = numParticles - g_numSolidParticles;
+ shadowParticlesOffset = g_numSolidParticles;
+ }
+ }
+ else
+ {
+ int offset = g_drawMesh ? g_numSolidParticles : 0;
+
+ shadowParticles = numParticles - offset;
+ shadowParticlesOffset = offset;
+ }
+
+ if (g_buffers->activeIndices.size())
+ DrawPoints(g_fluidRenderBuffers.mPositionVBO, g_fluidRenderBuffers.mDensityVBO, g_fluidRenderBuffers.mIndices, shadowParticles, shadowParticlesOffset, radius, 2048, 1.0f, lightFov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity);
+
+ ShadowEnd();
+
+ //----------------
+ // lighting pass
+
+ BindSolidShader(g_lightPos, g_lightTarget, lightTransform, g_shadowMap, 0.0f, Vec4(g_clearColor, g_fogDistance));
+
+ SetView(view, proj);
+ SetCullMode(true);
+
+ DrawPlanes((Vec4*)g_params.planes, g_params.numPlanes, g_drawPlaneBias);
+
+ if (g_drawMesh)
+ DrawMesh(g_mesh, g_meshColor);
+
+
+ DrawShapes();
+
+ if (g_drawCloth && g_buffers->triangles.size())
+ DrawCloth(&g_buffers->positions[0], &g_buffers->normals[0], g_buffers->uvs.size() ? &g_buffers->uvs[0].x : NULL, &g_buffers->triangles[0], g_buffers->triangles.size() / 3, g_buffers->positions.size(), 3, g_expandCloth);
+
+ if (g_drawRopes)
+ {
+ for (size_t i = 0; i < g_ropes.size(); ++i)
+ DrawRope(&g_buffers->positions[0], &g_ropes[i].mIndices[0], g_ropes[i].mIndices.size(), g_params.radius*0.5f*g_ropeScale, i);
+ }
+
+ // give scene a chance to do custom drawing
+ g_scenes[g_scene]->Draw(0);
+
+ UnbindSolidShader();
+
+
+ // first pass of diffuse particles (behind fluid surface)
+ if (g_drawDiffuse)
+ RenderDiffuse(g_fluidRenderer, g_diffuseRenderBuffers, numDiffuse, radius*g_diffuseScale, float(g_screenWidth), aspect, fov, g_diffuseColor, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_diffuseMotionScale, g_diffuseInscatter, g_diffuseOutscatter, g_diffuseShadow, false);
+
+ if (g_drawEllipsoids && g_params.fluid)
+ {
+ // draw solid particles separately
+ if (g_numSolidParticles && g_drawPoints)
+ DrawPoints(g_fluidRenderBuffers.mPositionVBO, g_fluidRenderBuffers.mDensityVBO, g_fluidRenderBuffers.mIndices, g_numSolidParticles, 0, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity);
+
+ // render fluid surface
+ RenderEllipsoids(g_fluidRenderer, g_fluidRenderBuffers, numParticles - g_numSolidParticles, g_numSolidParticles, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_fluidColor, g_blur, g_ior, g_drawOpaque);
+
+ // second pass of diffuse particles for particles in front of fluid surface
+ if (g_drawDiffuse)
+ RenderDiffuse(g_fluidRenderer, g_diffuseRenderBuffers, numDiffuse, radius*g_diffuseScale, float(g_screenWidth), aspect, fov, g_diffuseColor, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_diffuseMotionScale, g_diffuseInscatter, g_diffuseOutscatter, g_diffuseShadow, true);
+ }
+ else
+ {
+ // draw all particles as spheres
+ if (g_drawPoints)
+ {
+ int offset = g_drawMesh ? g_numSolidParticles : 0;
+
+ if (g_buffers->activeIndices.size())
+ DrawPoints(g_fluidRenderBuffers.mPositionVBO, g_fluidRenderBuffers.mDensityVBO, g_fluidRenderBuffers.mIndices, numParticles - offset, offset, radius, float(g_screenWidth), aspect, fov, g_lightPos, g_lightTarget, lightTransform, g_shadowMap, g_drawDensity);
+ }
+ }
+
+}
+
+void RenderDebug()
+{
+ if (g_mouseParticle != -1)
+ {
+ // draw mouse spring
+ BeginLines();
+ DrawLine(g_mousePos, Vec3(g_buffers->positions[g_mouseParticle]), Vec4(1.0f));
+ EndLines();
+ }
+
+ // springs
+ if (g_drawSprings)
+ {
+ Vec4 color;
+
+ if (g_drawSprings == 1)
+ {
+ // stretch
+ color = Vec4(0.0f, 0.0f, 1.0f, 0.8f);
+ }
+ if (g_drawSprings == 2)
+ {
+ // tether
+ color = Vec4(0.0f, 1.0f, 0.0f, 0.8f);
+ }
+
+ BeginLines();
+
+ int start = 0;
+
+ for (int i = start; i < g_buffers->springLengths.size(); ++i)
+ {
+ if (g_drawSprings == 1 && g_buffers->springStiffness[i] < 0.0f)
+ continue;
+ if (g_drawSprings == 2 && g_buffers->springStiffness[i] > 0.0f)
+ continue;
+
+ int a = g_buffers->springIndices[i * 2];
+ int b = g_buffers->springIndices[i * 2 + 1];
+
+ DrawLine(Vec3(g_buffers->positions[a]), Vec3(g_buffers->positions[b]), color);
+ }
+
+ EndLines();
+ }
+
+ // visualize contacts against the environment
+ if (g_drawContacts)
+ {
+ const int maxContactsPerParticle = 6;
+
+ NvFlexVector<Vec4> contactPlanes(g_flexLib, g_buffers->positions.size()*maxContactsPerParticle);
+ NvFlexVector<Vec4> contactVelocities(g_flexLib, g_buffers->positions.size()*maxContactsPerParticle);
+ NvFlexVector<int> contactIndices(g_flexLib, g_buffers->positions.size());
+ NvFlexVector<unsigned int> contactCounts(g_flexLib, g_buffers->positions.size());
+
+ NvFlexGetContacts(g_flex, contactPlanes.buffer, contactVelocities.buffer, contactIndices.buffer, contactCounts.buffer);
+
+ // ensure transfers have finished
+ contactPlanes.map();
+ contactVelocities.map();
+ contactIndices.map();
+ contactCounts.map();
+
+ BeginLines();
+
+ for (int i = 0; i < int(g_buffers->activeIndices.size()); ++i)
+ {
+ const int contactIndex = contactIndices[g_buffers->activeIndices[i]];
+ const unsigned int count = contactCounts[contactIndex];
+
+ const float scale = 0.1f;
+
+ for (unsigned int c = 0; c < count; ++c)
+ {
+ Vec4 plane = contactPlanes[contactIndex*maxContactsPerParticle + c];
+
+ DrawLine(Vec3(g_buffers->positions[g_buffers->activeIndices[i]]),
+ Vec3(g_buffers->positions[g_buffers->activeIndices[i]]) + Vec3(plane)*scale,
+ Vec4(0.0f, 1.0f, 0.0f, 0.0f));
+ }
+ }
+
+ EndLines();
+ }
+
+ if (g_drawBases)
+ {
+ for (int i = 0; i < int(g_buffers->rigidRotations.size()); ++i)
+ {
+ BeginLines();
+
+ float size = 0.1f;
+
+ for (int b = 0; b < 3; ++b)
+ {
+ Vec3 color;
+ color[b] = 1.0f;
+
+ Matrix33 frame(g_buffers->rigidRotations[i]);
+
+ DrawLine(Vec3(g_buffers->rigidTranslations[i]),
+ Vec3(g_buffers->rigidTranslations[i] + frame.cols[b] * size),
+ Vec4(color, 0.0f));
+ }
+
+ EndLines();
+ }
+ }
+
+ if (g_drawNormals)
+ {
+ NvFlexGetNormals(g_flex, g_buffers->normals.buffer, g_buffers->normals.size());
+
+ BeginLines();
+
+ for (int i = 0; i < g_buffers->normals.size(); ++i)
+ {
+ DrawLine(Vec3(g_buffers->positions[i]),
+ Vec3(g_buffers->positions[i] - g_buffers->normals[i] * g_buffers->normals[i].w),
+ Vec4(0.0f, 1.0f, 0.0f, 0.0f));
+ }
+
+ EndLines();
+ }
+}
+
+void DrawShapes()
+{
+ for (int i = 0; i < g_buffers->shapeFlags.size(); ++i)
+ {
+ const int flags = g_buffers->shapeFlags[i];
+
+ // unpack flags
+ int type = int(flags&eNvFlexShapeFlagTypeMask);
+ //bool dynamic = int(flags&eNvFlexShapeFlagDynamic) > 0;
+
+ Vec3 color = Vec3(0.9f);
+
+ if (flags & eNvFlexShapeFlagTrigger)
+ {
+ color = Vec3(0.6f, 1.0, 0.6f);
+
+ SetFillMode(true);
+ }
+
+ // render with prev positions to match particle update order
+ // can also think of this as current/next
+ const Quat rotation = g_buffers->shapePrevRotations[i];
+ const Vec3 position = Vec3(g_buffers->shapePrevPositions[i]);
+
+ NvFlexCollisionGeometry geo = g_buffers->shapeGeometry[i];
+
+ if (type == eNvFlexShapeSphere)
+ {
+ Mesh* sphere = CreateSphere(20, 20, geo.sphere.radius);
+
+ Matrix44 xform = TranslationMatrix(Point3(position))*RotationMatrix(Quat(rotation));
+ sphere->Transform(xform);
+
+ DrawMesh(sphere, Vec3(color));
+
+ delete sphere;
+ }
+ else if (type == eNvFlexShapeCapsule)
+ {
+ Mesh* capsule = CreateCapsule(10, 20, geo.capsule.radius, geo.capsule.halfHeight);
+
+ // transform to world space
+ Matrix44 xform = TranslationMatrix(Point3(position))*RotationMatrix(Quat(rotation))*RotationMatrix(DegToRad(-90.0f), Vec3(0.0f, 0.0f, 1.0f));
+ capsule->Transform(xform);
+
+ DrawMesh(capsule, Vec3(color));
+
+ delete capsule;
+ }
+ else if (type == eNvFlexShapeBox)
+ {
+ Mesh* box = CreateCubeMesh();
+
+ Matrix44 xform = TranslationMatrix(Point3(position))*RotationMatrix(Quat(rotation))*ScaleMatrix(Vec3(geo.box.halfExtents)*2.0f);
+ box->Transform(xform);
+
+ DrawMesh(box, Vec3(color));
+ delete box;
+ }
+ else if (type == eNvFlexShapeConvexMesh)
+ {
+ if (g_convexes.find(geo.convexMesh.mesh) != g_convexes.end())
+ {
+ GpuMesh* m = g_convexes[geo.convexMesh.mesh];
+
+ if (m)
+ {
+ Matrix44 xform = TranslationMatrix(Point3(g_buffers->shapePositions[i]))*RotationMatrix(Quat(g_buffers->shapeRotations[i]))*ScaleMatrix(geo.convexMesh.scale);
+ DrawGpuMesh(m, xform, Vec3(color));
+ }
+ }
+ }
+ else if (type == eNvFlexShapeTriangleMesh)
+ {
+ if (g_meshes.find(geo.triMesh.mesh) != g_meshes.end())
+ {
+ GpuMesh* m = g_meshes[geo.triMesh.mesh];
+
+ if (m)
+ {
+ Matrix44 xform = TranslationMatrix(Point3(position))*RotationMatrix(Quat(rotation))*ScaleMatrix(geo.triMesh.scale);
+ DrawGpuMesh(m, xform, Vec3(color));
+ }
+ }
+ }
+ else if (type == eNvFlexShapeSDF)
+ {
+ if (g_fields.find(geo.sdf.field) != g_fields.end())
+ {
+ GpuMesh* m = g_fields[geo.sdf.field];
+
+ if (m)
+ {
+ Matrix44 xform = TranslationMatrix(Point3(position))*RotationMatrix(Quat(rotation))*ScaleMatrix(geo.sdf.scale);
+ DrawGpuMesh(m, xform, Vec3(color));
+ }
+ }
+ }
+ }
+
+ SetFillMode(g_wireframe);
+}
+
+
+// returns the new scene if one is selected
+int DoUI()
+{
+ // gui may set a new scene
+ int newScene = -1;
+
+ if (g_showHelp)
+ {
+ const int numParticles = NvFlexGetActiveCount(g_flex);
+ const int numDiffuse = NvFlexGetDiffuseParticles(g_flex, NULL, NULL, NULL);
+
+ int x = g_screenWidth - 200;
+ int y = g_screenHeight - 23;
+
+ // imgui
+ unsigned char button = 0;
+ if (g_lastb == SDL_BUTTON_LEFT)
+ button = IMGUI_MBUT_LEFT;
+ else if (g_lastb == SDL_BUTTON_RIGHT)
+ button = IMGUI_MBUT_RIGHT;
+
+ imguiBeginFrame(g_lastx, g_screenHeight - g_lasty, button, 0);
+
+ x += 180;
+
+ int fontHeight = 13;
+
+ if (1)
+ {
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Frame: %d", g_frame); y -= fontHeight * 2;
+
+ if (!g_ffmpeg)
+ {
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Frame Time: %.2fms", g_realdt*1000.0f); y -= fontHeight * 2;
+
+ // If detailed profiling is enabled, then these timers will contain the overhead of the detail timers, so we won't display them.
+ if (!g_profile)
+ {
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Sim Time (CPU): %.2fms", g_updateTime*1000.0f); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(0.97f, 0.59f, 0.27f), IMGUI_ALIGN_RIGHT, "Sim Latency (GPU): %.2fms", g_simLatency); y -= fontHeight * 2;
+ }
+ else
+ {
+ y -= fontHeight * 3;
+ }
+ }
+
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Particle Count: %d", numParticles); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Diffuse Count: %d", numDiffuse); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Rigid Count: %d", g_buffers->rigidOffsets.size() > 0 ? g_buffers->rigidOffsets.size() - 1 : 0); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Spring Count: %d", g_buffers->springLengths.size()); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Num Substeps: %d", g_numSubsteps); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Num Iterations: %d", g_params.numIterations); y -= fontHeight * 2;
+
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Device: %s", g_deviceName); y -= fontHeight * 2;
+ }
+
+ if (g_profile)
+ {
+ DrawImguiString(x, y, Vec3(0.97f, 0.59f, 0.27f), IMGUI_ALIGN_RIGHT, "Total GPU Sim Latency: %.2fms", g_timers.total); y -= fontHeight * 2;
+
+ DrawImguiString(x, y, Vec3(0.0f, 1.0f, 0.0f), IMGUI_ALIGN_RIGHT, "GPU Latencies"); y -= fontHeight;
+
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Predict: %.2fms", g_timers.predict); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Create Cell Indices: %.2fms", g_timers.createCellIndices); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Sort Cell Indices: %.2fms", g_timers.sortCellIndices); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Reorder: %.2fms", g_timers.reorder); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "CreateGrid: %.2fms", g_timers.createGrid); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Collide Particles: %.2fms", g_timers.collideParticles); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Collide Shapes: %.2fms", g_timers.collideShapes); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Collide Triangles: %.2fms", g_timers.collideTriangles); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Calculate Density: %.2fms", g_timers.calculateDensity); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Solve Densities: %.2fms", g_timers.solveDensities); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Solve Velocities: %.2fms", g_timers.solveVelocities); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Solve Rigids: %.2fms", g_timers.solveShapes); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Solve Springs: %.2fms", g_timers.solveSprings); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Solve Inflatables: %.2fms", g_timers.solveInflatables); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Solve Contacts: %.2fms", g_timers.solveContacts); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Apply Deltas: %.2fms", g_timers.applyDeltas); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Finalize: %.2fms", g_timers.finalize); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Update Triangles: %.2fms", g_timers.updateTriangles); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Update Normals: %.2fms", g_timers.updateNormals); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Update Bounds: %.2fms", g_timers.updateBounds); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Calculate Anisotropy: %.2fms", g_timers.calculateAnisotropy); y -= fontHeight;
+ DrawImguiString(x, y, Vec3(1.0f), IMGUI_ALIGN_RIGHT, "Update Diffuse: %.2fms", g_timers.updateDiffuse); y -= fontHeight * 2;
+ }
+
+ x -= 180;
+
+ int uiOffset = 250;
+ int uiBorder = 20;
+ int uiWidth = 200;
+ int uiHeight = g_screenHeight - uiOffset - uiBorder * 3;
+ int uiLeft = uiBorder;
+
+ if (g_tweakPanel)
+ imguiBeginScrollArea("Scene", uiLeft, g_screenHeight - uiBorder - uiOffset, uiWidth, uiOffset, &g_levelScroll);
+ else
+ imguiBeginScrollArea("Scene", uiLeft, uiBorder, uiWidth, g_screenHeight - uiBorder - uiBorder, &g_levelScroll);
+
+ for (int i = 0; i < int(g_scenes.size()); ++i)
+ {
+ unsigned int color = g_scene == i ? imguiRGBA(255, 151, 61, 255) : imguiRGBA(255, 255, 255, 200);
+ if (imguiItem(g_scenes[i]->GetName(), true, color, i == g_selectedScene))
+ {
+ newScene = i;
+ }
+ }
+
+ imguiEndScrollArea();
+
+ if (g_tweakPanel)
+ {
+ static int scroll = 0;
+
+ imguiBeginScrollArea("Options", uiLeft, g_screenHeight - uiBorder - uiHeight - uiOffset - uiBorder, uiWidth, uiHeight, &scroll);
+ imguiSeparatorLine();
+
+ // global options
+ imguiLabel("Global");
+ if (imguiCheck("Emit particles", g_emit))
+ g_emit = !g_emit;
+
+ if (imguiCheck("Pause", g_pause))
+ g_pause = !g_pause;
+
+ imguiSeparatorLine();
+
+ if (imguiCheck("Wireframe", g_wireframe))
+ g_wireframe = !g_wireframe;
+
+ if (imguiCheck("Draw Points", g_drawPoints))
+ g_drawPoints = !g_drawPoints;
+
+ if (imguiCheck("Draw Fluid", g_drawEllipsoids))
+ g_drawEllipsoids = !g_drawEllipsoids;
+
+ if (imguiCheck("Draw Mesh", g_drawMesh))
+ {
+ g_drawMesh = !g_drawMesh;
+ g_drawRopes = !g_drawRopes;
+ }
+
+ if (imguiCheck("Draw Basis", g_drawBases))
+ g_drawBases = !g_drawBases;
+
+ if (imguiCheck("Draw Springs", bool(g_drawSprings != 0)))
+ g_drawSprings = (g_drawSprings) ? 0 : 1;
+
+ if (imguiCheck("Draw Contacts", g_drawContacts))
+ g_drawContacts = !g_drawContacts;
+
+ imguiSeparatorLine();
+
+ // scene options
+ g_scenes[g_scene]->DoGui();
+
+ if (imguiButton("Reset Scene"))
+ g_resetScene = true;
+
+ imguiSeparatorLine();
+
+ float n = float(g_numSubsteps);
+ if (imguiSlider("Num Substeps", &n, 1, 10, 1))
+ g_numSubsteps = int(n);
+
+ n = float(g_params.numIterations);
+ if (imguiSlider("Num Iterations", &n, 1, 20, 1))
+ g_params.numIterations = int(n);
+
+ imguiSeparatorLine();
+ imguiSlider("Gravity X", &g_params.gravity[0], -50.0f, 50.0f, 1.0f);
+ imguiSlider("Gravity Y", &g_params.gravity[1], -50.0f, 50.0f, 1.0f);
+ imguiSlider("Gravity Z", &g_params.gravity[2], -50.0f, 50.0f, 1.0f);
+
+ imguiSeparatorLine();
+ imguiSlider("Radius", &g_params.radius, 0.01f, 0.5f, 0.01f);
+ imguiSlider("Solid Radius", &g_params.solidRestDistance, 0.0f, 0.5f, 0.001f);
+ imguiSlider("Fluid Radius", &g_params.fluidRestDistance, 0.0f, 0.5f, 0.001f);
+
+ // common params
+ imguiSeparatorLine();
+ imguiSlider("Dynamic Friction", &g_params.dynamicFriction, 0.0f, 1.0f, 0.01f);
+ imguiSlider("Static Friction", &g_params.staticFriction, 0.0f, 1.0f, 0.01f);
+ imguiSlider("Particle Friction", &g_params.particleFriction, 0.0f, 1.0f, 0.01f);
+ imguiSlider("Restitution", &g_params.restitution, 0.0f, 1.0f, 0.01f);
+ imguiSlider("SleepThreshold", &g_params.sleepThreshold, 0.0f, 1.0f, 0.01f);
+ imguiSlider("Shock Propagation", &g_params.shockPropagation, 0.0f, 10.0f, 0.01f);
+ imguiSlider("Damping", &g_params.damping, 0.0f, 10.0f, 0.01f);
+ imguiSlider("Dissipation", &g_params.dissipation, 0.0f, 0.01f, 0.0001f);
+ imguiSlider("SOR", &g_params.relaxationFactor, 0.0f, 5.0f, 0.01f);
+
+ imguiSlider("Collision Distance", &g_params.collisionDistance, 0.0f, 0.5f, 0.001f);
+ imguiSlider("Collision Margin", &g_params.shapeCollisionMargin, 0.0f, 5.0f, 0.01f);
+
+ // rigid params
+ imguiSeparatorLine();
+ imguiSlider("Plastic Creep", &g_params.plasticCreep, 0.0f, 1.0f, 0.001f);
+ imguiSlider("Plastic Threshold", &g_params.plasticThreshold, 0.0f, 0.5f, 0.001f);
+
+ // cloth params
+ imguiSeparatorLine();
+ imguiSlider("Wind", &g_windStrength, -1.0f, 1.0f, 0.01f);
+ imguiSlider("Drag", &g_params.drag, 0.0f, 1.0f, 0.01f);
+ imguiSlider("Lift", &g_params.lift, 0.0f, 1.0f, 0.01f);
+ imguiSeparatorLine();
+
+ // fluid params
+ if (imguiCheck("Fluid", g_params.fluid))
+ g_params.fluid = !g_params.fluid;
+
+ imguiSlider("Adhesion", &g_params.adhesion, 0.0f, 10.0f, 0.01f);
+ imguiSlider("Cohesion", &g_params.cohesion, 0.0f, 0.2f, 0.0001f);
+ imguiSlider("Surface Tension", &g_params.surfaceTension, 0.0f, 50.0f, 0.01f);
+ imguiSlider("Viscosity", &g_params.viscosity, 0.0f, 120.0f, 0.01f);
+ imguiSlider("Vorticicty Confinement", &g_params.vorticityConfinement, 0.0f, 120.0f, 0.1f);
+ imguiSlider("Solid Pressure", &g_params.solidPressure, 0.0f, 1.0f, 0.01f);
+ imguiSlider("Surface Drag", &g_params.freeSurfaceDrag, 0.0f, 1.0f, 0.01f);
+ imguiSlider("Buoyancy", &g_params.buoyancy, -1.0f, 1.0f, 0.01f);
+
+ imguiSeparatorLine();
+ imguiSlider("Anisotropy Scale", &g_params.anisotropyScale, 0.0f, 30.0f, 0.01f);
+ imguiSlider("Smoothing", &g_params.smoothing, 0.0f, 1.0f, 0.01f);
+
+ // diffuse params
+ imguiSeparatorLine();
+ imguiSlider("Diffuse Threshold", &g_params.diffuseThreshold, 0.0f, 1000.0f, 1.0f);
+ imguiSlider("Diffuse Buoyancy", &g_params.diffuseBuoyancy, 0.0f, 2.0f, 0.01f);
+ imguiSlider("Diffuse Drag", &g_params.diffuseDrag, 0.0f, 2.0f, 0.01f);
+ imguiSlider("Diffuse Scale", &g_diffuseScale, 0.0f, 1.5f, 0.01f);
+ imguiSlider("Diffuse Alpha", &g_diffuseColor.w, 0.0f, 3.0f, 0.01f);
+ imguiSlider("Diffuse Inscatter", &g_diffuseInscatter, 0.0f, 2.0f, 0.01f);
+ imguiSlider("Diffuse Outscatter", &g_diffuseOutscatter, 0.0f, 2.0f, 0.01f);
+ imguiSlider("Diffuse Motion Blur", &g_diffuseMotionScale, 0.0f, 5.0f, 0.1f);
+
+ n = float(g_params.diffuseBallistic);
+ if (imguiSlider("Diffuse Ballistic", &n, 1, 40, 1))
+ g_params.diffuseBallistic = int(n);
+
+ imguiEndScrollArea();
+ }
+ imguiEndFrame();
+
+ // kick render commands
+ imguiGraphDraw();
+ }
+
+ // update benchmark and change scene if one is requested
+ if (g_benchmark)
+ newScene = BenchmarkUpdate();
+
+ return newScene;
+}
+
+void UpdateFrame()
+{
+ static double lastTime;
+
+ // real elapsed frame time
+ double frameBeginTime = GetSeconds();
+
+ g_realdt = float(frameBeginTime - lastTime);
+ lastTime = frameBeginTime;
+
+ // do gamepad input polling
+ double currentTime = frameBeginTime;
+ static double lastJoyTime = currentTime;
+
+ if (g_gamecontroller && currentTime - lastJoyTime > g_dt)
+ {
+ lastJoyTime = currentTime;
+
+ int leftStickX = SDL_GameControllerGetAxis(g_gamecontroller, SDL_CONTROLLER_AXIS_LEFTX);
+ int leftStickY = SDL_GameControllerGetAxis(g_gamecontroller, SDL_CONTROLLER_AXIS_LEFTY);
+ int rightStickX = SDL_GameControllerGetAxis(g_gamecontroller, SDL_CONTROLLER_AXIS_RIGHTX);
+ int rightStickY = SDL_GameControllerGetAxis(g_gamecontroller, SDL_CONTROLLER_AXIS_RIGHTY);
+ int leftTrigger = SDL_GameControllerGetAxis(g_gamecontroller, SDL_CONTROLLER_AXIS_TRIGGERLEFT);
+ int rightTrigger = SDL_GameControllerGetAxis(g_gamecontroller, SDL_CONTROLLER_AXIS_TRIGGERRIGHT);
+
+ Vec2 leftStick(joyAxisFilter(leftStickX, 0), joyAxisFilter(leftStickY, 0));
+ Vec2 rightStick(joyAxisFilter(rightStickX, 1), joyAxisFilter(rightStickY, 1));
+ Vec2 trigger(leftTrigger / 32768.0f, rightTrigger / 32768.0f);
+
+ if (leftStick.x != 0.0f || leftStick.y != 0.0f ||
+ rightStick.x != 0.0f || rightStick.y != 0.0f)
+ {
+ // note constant factor to speed up analog control compared to digital because it is more controllable.
+ g_camVel.z = -4 * g_camSpeed * leftStick.y;
+ g_camVel.x = 4 * g_camSpeed * leftStick.x;
+
+ // cam orientation
+ g_camAngle.x -= rightStick.x * 0.05f;
+ g_camAngle.y -= rightStick.y * 0.05f;
+ }
+
+ // Handle left stick motion
+ static bool bLeftStick = false;
+
+ if ((leftStick.x != 0.0f || leftStick.y != 0.0f) && !bLeftStick)
+ {
+ bLeftStick = true;
+ }
+ else if ((leftStick.x == 0.0f && leftStick.y == 0.0f) && bLeftStick)
+ {
+ bLeftStick = false;
+ g_camVel.z = -4 * g_camSpeed * leftStick.y;
+ g_camVel.x = 4 * g_camSpeed * leftStick.x;
+ }
+
+ // Handle triggers as controller button events
+ void ControllerButtonEvent(SDL_ControllerButtonEvent event);
+
+ static bool bLeftTrigger = false;
+ static bool bRightTrigger = false;
+ SDL_ControllerButtonEvent e;
+
+ if (!bLeftTrigger && trigger.x > 0.0f)
+ {
+ e.type = SDL_CONTROLLERBUTTONDOWN;
+ e.button = SDL_CONTROLLER_BUTTON_LEFT_TRIGGER;
+ ControllerButtonEvent(e);
+ bLeftTrigger = true;
+ }
+ else if (bLeftTrigger && trigger.x == 0.0f)
+ {
+ e.type = SDL_CONTROLLERBUTTONUP;
+ e.button = SDL_CONTROLLER_BUTTON_LEFT_TRIGGER;
+ ControllerButtonEvent(e);
+ bLeftTrigger = false;
+ }
+
+ if (!bRightTrigger && trigger.y > 0.0f)
+ {
+ e.type = SDL_CONTROLLERBUTTONDOWN;
+ e.button = SDL_CONTROLLER_BUTTON_RIGHT_TRIGGER;
+ ControllerButtonEvent(e);
+ bRightTrigger = true;
+ }
+ else if (bRightTrigger && trigger.y == 0.0f)
+ {
+ e.type = SDL_CONTROLLERBUTTONDOWN;
+ e.button = SDL_CONTROLLER_BUTTON_RIGHT_TRIGGER;
+ ControllerButtonEvent(e);
+ bRightTrigger = false;
+ }
+ }
+
+ //-------------------------------------------------------------------
+ // Scene Update
+
+ double waitBeginTime = GetSeconds();
+
+ MapBuffers(g_buffers);
+
+ double waitEndTime = GetSeconds();
+
+ UpdateCamera();
+
+ if (!g_pause || g_step)
+ {
+ UpdateEmitters();
+ UpdateMouse();
+ UpdateWind();
+ UpdateScene();
+ }
+
+ //-------------------------------------------------------------------
+ // Render
+
+ double renderBeginTime = GetSeconds();
+
+ if (g_profile && (!g_pause || g_step)) {
+ if (g_benchmark) {
+ g_numDetailTimers = NvFlexGetDetailTimers(g_flex, &g_detailTimers);
+ }
+ else {
+ memset(&g_timers, 0, sizeof(g_timers));
+ NvFlexGetTimers(g_flex, &g_timers);
+ }
+ }
+
+ float newSimLatency = NvFlexGetDeviceLatency(g_flex);
+
+ StartFrame(Vec4(g_clearColor, 1.0f));
+
+ // main scene render
+ RenderScene();
+ RenderDebug();
+
+ EndFrame();
+
+ const int newScene = DoUI();
+
+ UnmapBuffers(g_buffers);
+
+ // move mouse particle (must be done here as GetViewRay() uses the GL projection state)
+ if (g_mouseParticle != -1)
+ {
+ Vec3 origin, dir;
+ GetViewRay(g_lastx, g_screenHeight - g_lasty, origin, dir);
+
+ g_mousePos = origin + dir*g_mouseT;
+ }
+
+ if (g_capture)
+ {
+ TgaImage img;
+ img.m_width = g_screenWidth;
+ img.m_height = g_screenHeight;
+ img.m_data = new uint32_t[g_screenWidth*g_screenHeight];
+
+ ReadFrame((int*)img.m_data, g_screenWidth, g_screenHeight);
+
+ fwrite(img.m_data, sizeof(uint32_t)*g_screenWidth*g_screenHeight, 1, g_ffmpeg);
+
+ delete[] img.m_data;
+ }
+
+ double renderEndTime = GetSeconds();
+
+ // if user requested a scene reset process it now
+ if (g_resetScene)
+ {
+ Reset();
+ g_resetScene = false;
+ }
+
+ // if gui requested a scene change process it now
+ if (newScene != -1)
+ {
+ g_scene = newScene;
+ Init(g_scene);
+ return;
+ }
+
+
+
+ //-------------------------------------------------------------------
+ // Flex Update
+
+ double updateBeginTime = GetSeconds();
+
+ // send any particle updates to the solver
+ NvFlexSetParticles(g_flex, g_buffers->positions.buffer, g_buffers->positions.size());
+ NvFlexSetVelocities(g_flex, g_buffers->velocities.buffer, g_buffers->velocities.size());
+ NvFlexSetPhases(g_flex, g_buffers->phases.buffer, g_buffers->phases.size());
+ NvFlexSetActive(g_flex, g_buffers->activeIndices.buffer, g_buffers->activeIndices.size());
+
+ // allow scene to update constraints etc
+ SyncScene();
+
+ if (g_shapesChanged)
+ {
+ NvFlexSetShapes(
+ g_flex,
+ g_buffers->shapeGeometry.buffer,
+ g_buffers->shapePositions.buffer,
+ g_buffers->shapeRotations.buffer,
+ g_buffers->shapePrevPositions.buffer,
+ g_buffers->shapePrevRotations.buffer,
+ g_buffers->shapeFlags.buffer,
+ int(g_buffers->shapeFlags.size()));
+
+ g_shapesChanged = false;
+ }
+
+ if (!g_pause || g_step)
+ {
+ // tick solver
+ NvFlexSetParams(g_flex, &g_params);
+ NvFlexUpdateSolver(g_flex, g_dt, g_numSubsteps, g_profile);
+
+ g_frame++;
+ g_step = false;
+ }
+
+ // read back base particle data
+ // Note that flexGet calls don't wait for the GPU, they just queue a GPU copy
+ // to be executed later.
+ // When we're ready to read the fetched buffers we'll Map them, and that's when
+ // the CPU will wait for the GPU flex update and GPU copy to finish.
+ NvFlexGetParticles(g_flex, g_buffers->positions.buffer, g_buffers->positions.size());
+ NvFlexGetVelocities(g_flex, g_buffers->velocities.buffer, g_buffers->velocities.size());
+ NvFlexGetNormals(g_flex, g_buffers->normals.buffer, g_buffers->normals.size());
+
+ // readback triangle normals
+ if (g_buffers->triangles.size())
+ NvFlexGetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3);
+
+ // readback rigid transforms
+ if (g_buffers->rigidOffsets.size())
+ NvFlexGetRigidTransforms(g_flex, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer);
+
+ if (!g_interop)
+ {
+ // if not using interop then we read back fluid data to host
+ if (g_drawEllipsoids)
+ {
+ NvFlexGetSmoothParticles(g_flex, g_buffers->smoothPositions.buffer, g_buffers->smoothPositions.size());
+ NvFlexGetAnisotropy(g_flex, g_buffers->anisotropy1.buffer, g_buffers->anisotropy2.buffer, g_buffers->anisotropy3.buffer);
+ }
+
+ // read back diffuse data to host
+ if (g_drawDensity)
+ NvFlexGetDensities(g_flex, g_buffers->densities.buffer, g_buffers->positions.size());
+
+ if (g_diffuseRenderBuffers.mNumDiffuseParticles)
+ {
+ NvFlexGetDiffuseParticles(g_flex, g_buffers->diffusePositions.buffer, g_buffers->diffuseVelocities.buffer, g_buffers->diffuseIndices.buffer);
+ }
+ }
+
+ double updateEndTime = GetSeconds();
+
+ //-------------------------------------------------------
+ // Update the on-screen timers
+
+ float newUpdateTime = float(updateEndTime - updateBeginTime);
+ float newRenderTime = float(renderEndTime - renderBeginTime);
+ float newWaitTime = float(waitBeginTime - waitEndTime);
+
+ // Exponential filter to make the display easier to read
+ const float timerSmoothing = 0.05f;
+
+ g_updateTime = (g_updateTime == 0.0f) ? newUpdateTime : Lerp(g_updateTime, newUpdateTime, timerSmoothing);
+ g_renderTime = (g_renderTime == 0.0f) ? newRenderTime : Lerp(g_renderTime, newRenderTime, timerSmoothing);
+ g_waitTime = (g_waitTime == 0.0f) ? newWaitTime : Lerp(g_waitTime, newWaitTime, timerSmoothing);
+ g_simLatency = (g_simLatency == 0.0f) ? newSimLatency : Lerp(g_simLatency, newSimLatency, timerSmoothing);
+
+ PresentFrame(g_vsync);
+}
+
+void ReshapeWindow(int width, int height)
+{
+ if (!g_benchmark)
+ printf("Reshaping\n");
+
+ ReshapeRender(g_window);
+
+ if (!g_fluidRenderer || (width != g_screenWidth || height != g_screenHeight))
+ {
+ if (g_fluidRenderer)
+ DestroyFluidRenderer(g_fluidRenderer);
+ g_fluidRenderer = CreateFluidRenderer(width, height);
+ }
+
+ g_screenWidth = width;
+ g_screenHeight = height;
+}
+
+void InputArrowKeysDown(int key, int x, int y)
+{
+ switch (key)
+ {
+ case SDLK_DOWN:
+ {
+ if (g_selectedScene < int(g_scenes.size()) - 1)
+ g_selectedScene++;
+
+ // update scroll UI to center on selected scene
+ g_levelScroll = max((g_selectedScene - 4) * 24, 0);
+ break;
+ }
+ case SDLK_UP:
+ {
+ if (g_selectedScene > 0)
+ g_selectedScene--;
+
+ // update scroll UI to center on selected scene
+ g_levelScroll = max((g_selectedScene - 4) * 24, 0);
+ break;
+ }
+ case SDLK_LEFT:
+ {
+ if (g_scene > 0)
+ --g_scene;
+ Init(g_scene);
+
+ // update scroll UI to center on selected scene
+ g_levelScroll = max((g_scene - 4) * 24, 0);
+ break;
+ }
+ case SDLK_RIGHT:
+ {
+ if (g_scene < int(g_scenes.size()) - 1)
+ ++g_scene;
+ Init(g_scene);
+
+ // update scroll UI to center on selected scene
+ g_levelScroll = max((g_scene - 4) * 24, 0);
+ break;
+ }
+ }
+}
+
+void InputArrowKeysUp(int key, int x, int y)
+{
+}
+
+bool InputKeyboardDown(unsigned char key, int x, int y)
+{
+ if (key > '0' && key <= '9')
+ {
+ g_scene = key - '0' - 1;
+ Init(g_scene);
+ return false;
+ }
+
+ float kSpeed = g_camSpeed;
+
+ switch (key)
+ {
+ case 'w':
+ {
+ g_camVel.z = kSpeed;
+ break;
+ }
+ case 's':
+ {
+ g_camVel.z = -kSpeed;
+ break;
+ }
+ case 'a':
+ {
+ g_camVel.x = -kSpeed;
+ break;
+ }
+ case 'd':
+ {
+ g_camVel.x = kSpeed;
+ break;
+ }
+ case 'q':
+ {
+ g_camVel.y = kSpeed;
+ break;
+ }
+ case 'z':
+ {
+ //g_drawCloth = !g_drawCloth;
+ g_camVel.y = -kSpeed;
+ break;
+ }
+
+ case 'u':
+ {
+#ifndef ANDROID
+ if (g_fullscreen)
+ {
+ SDL_SetWindowFullscreen(g_window, 0);
+ ReshapeWindow(1280, 720);
+ g_fullscreen = false;
+ }
+ else
+ {
+ SDL_SetWindowFullscreen(g_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+ g_fullscreen = true;
+ }
+#endif
+ break;
+ }
+ case 'r':
+ {
+ g_resetScene = true;
+ break;
+ }
+ case 'y':
+ {
+ g_wavePool = !g_wavePool;
+ break;
+ }
+ case 'c':
+ {
+#if _WIN32
+ if (!g_ffmpeg)
+ {
+ // open ffmpeg stream
+
+ int i = 0;
+ char buf[255];
+ FILE* f = NULL;
+
+ do
+ {
+ sprintf(buf, "../../movies/output%d.mp4", i);
+ f = fopen(buf, "rb");
+ if (f)
+ fclose(f);
+
+ ++i;
+ } while (f);
+
+ const char* str = "ffmpeg -r 60 -f rawvideo -pix_fmt rgba -s 1280x720 -i - "
+ "-threads 0 -preset fast -y -crf 19 -pix_fmt yuv420p -tune animation -vf vflip %s";
+
+ char cmd[1024];
+ sprintf(cmd, str, buf);
+
+ g_ffmpeg = _popen(cmd, "wb");
+ assert(g_ffmpeg);
+ }
+ else
+ {
+ _pclose(g_ffmpeg);
+ g_ffmpeg = NULL;
+ }
+
+ g_capture = !g_capture;
+ g_frame = 0;
+#endif
+ break;
+ }
+ case 'p':
+ {
+ g_pause = !g_pause;
+ break;
+ }
+ case 'o':
+ {
+ g_step = true;
+ break;
+ }
+ case 'h':
+ {
+ g_showHelp = !g_showHelp;
+ break;
+ }
+ case 'e':
+ {
+ g_drawEllipsoids = !g_drawEllipsoids;
+ break;
+ }
+ case 't':
+ {
+ g_drawOpaque = !g_drawOpaque;
+ break;
+ }
+ case 'v':
+ {
+ g_drawPoints = !g_drawPoints;
+ break;
+ }
+ case 'f':
+ {
+ g_drawSprings = (g_drawSprings + 1) % 3;
+ break;
+ }
+ case 'i':
+ {
+ g_drawDiffuse = !g_drawDiffuse;
+ break;
+ }
+ case 'm':
+ {
+ g_drawMesh = !g_drawMesh;
+ break;
+ }
+ case 'n':
+ {
+ g_drawRopes = !g_drawRopes;
+ break;
+ }
+ case 'j':
+ {
+ g_windTime = 0.0f;
+ g_windStrength = 1.5f;
+ g_windFrequency = 0.2f;
+ break;
+ }
+ case '.':
+ {
+ g_profile = !g_profile;
+ break;
+ }
+ case 'g':
+ {
+ if (g_params.gravity[1] != 0.0f)
+ g_params.gravity[1] = 0.0f;
+ else
+ g_params.gravity[1] = -9.8f;
+
+ break;
+ }
+ case '-':
+ {
+ if (g_params.numPlanes)
+ g_params.numPlanes--;
+
+ break;
+ }
+ case ' ':
+ {
+ g_emit = !g_emit;
+ break;
+ }
+ case ';':
+ {
+ g_debug = !g_debug;
+ break;
+ }
+ case 13:
+ {
+ g_scene = g_selectedScene;
+ Init(g_scene);
+ break;
+ }
+ case 27:
+ {
+ // return quit = true
+ return true;
+ }
+ };
+
+ g_scenes[g_scene]->KeyDown(key);
+
+ return false;
+}
+
+void InputKeyboardUp(unsigned char key, int x, int y)
+{
+ switch (key)
+ {
+ case 'w':
+ case 's':
+ {
+ g_camVel.z = 0.0f;
+ break;
+ }
+ case 'a':
+ case 'd':
+ {
+ g_camVel.x = 0.0f;
+ break;
+ }
+ case 'q':
+ case 'z':
+ {
+ g_camVel.y = 0.0f;
+ break;
+ }
+ };
+}
+
+void MouseFunc(int b, int state, int x, int y)
+{
+ switch (state)
+ {
+ case SDL_RELEASED:
+ {
+ g_lastx = x;
+ g_lasty = y;
+ g_lastb = -1;
+
+ break;
+ }
+ case SDL_PRESSED:
+ {
+ g_lastx = x;
+ g_lasty = y;
+ g_lastb = b;
+#ifdef ANDROID
+ extern void setStateLeft(bool bLeftDown);
+ setStateLeft(false);
+#else
+ if ((SDL_GetModState() & KMOD_LSHIFT) && g_lastb == SDL_BUTTON_LEFT)
+ {
+ // record that we need to update the picked particle
+ g_mousePicked = true;
+ }
+#endif
+ break;
+ }
+ };
+}
+
+void MousePassiveMotionFunc(int x, int y)
+{
+ g_lastx = x;
+ g_lasty = y;
+}
+
+void MouseMotionFunc(unsigned state, int x, int y)
+{
+ float dx = float(x - g_lastx);
+ float dy = float(y - g_lasty);
+
+ g_lastx = x;
+ g_lasty = y;
+
+ if (state & SDL_BUTTON_RMASK)
+ {
+ const float kSensitivity = DegToRad(0.1f);
+ const float kMaxDelta = FLT_MAX;
+
+ g_camAngle.x -= Clamp(dx*kSensitivity, -kMaxDelta, kMaxDelta);
+ g_camAngle.y -= Clamp(dy*kSensitivity, -kMaxDelta, kMaxDelta);
+ }
+}
+
+bool g_Error = false;
+
+void ErrorCallback(NvFlexErrorSeverity, const char* msg, const char* file, int line)
+{
+ printf("Flex: %s - %s:%d\n", msg, file, line);
+ g_Error = true;
+ //assert(0); asserts are bad for TeamCity
+}
+
+void ControllerButtonEvent(SDL_ControllerButtonEvent event)
+{
+ // map controller buttons to keyboard keys
+ if (event.type == SDL_CONTROLLERBUTTONDOWN)
+ {
+ InputKeyboardDown(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0);
+ InputArrowKeysDown(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0);
+
+ if (event.button == SDL_CONTROLLER_BUTTON_LEFT_TRIGGER)
+ {
+ // Handle picking events using the game controller
+ g_lastx = g_screenWidth / 2;
+ g_lasty = g_screenHeight / 2;
+ g_lastb = 1;
+
+ // record that we need to update the picked particle
+ g_mousePicked = true;
+ }
+ }
+ else
+ {
+ InputKeyboardUp(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0);
+ InputArrowKeysUp(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0);
+
+ if (event.button == SDL_CONTROLLER_BUTTON_LEFT_TRIGGER)
+ {
+ // Handle picking events using the game controller
+ g_lastx = g_screenWidth / 2;
+ g_lasty = g_screenHeight / 2;
+ g_lastb = -1;
+ }
+ }
+}
+
+void ControllerDeviceUpdate()
+{
+ if (SDL_NumJoysticks() > 0)
+ {
+ SDL_JoystickEventState(SDL_ENABLE);
+ if (SDL_IsGameController(0))
+ {
+ g_gamecontroller = SDL_GameControllerOpen(0);
+ }
+ }
+}
+
+void SDLInit(const char* title)
+{
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) < 0) // Initialize SDL's Video subsystem and game controllers
+ printf("Unable to initialize SDL");
+
+ // Create our window centered
+ g_window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
+ g_screenWidth, g_screenHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
+
+ g_windowId = SDL_GetWindowID(g_window);
+}
+
+void SDLMainLoop()
+{
+ bool quit = false;
+ SDL_Event e;
+ while (!quit)
+ {
+ UpdateFrame();
+
+ while (SDL_PollEvent(&e))
+ {
+ switch (e.type)
+ {
+ case SDL_QUIT:
+ quit = true;
+ break;
+
+ case SDL_KEYDOWN:
+ if (e.key.keysym.sym < 256 && (e.key.keysym.mod == KMOD_NONE || (e.key.keysym.mod & KMOD_NUM)))
+ quit = InputKeyboardDown(e.key.keysym.sym, 0, 0);
+ InputArrowKeysDown(e.key.keysym.sym, 0, 0);
+ break;
+
+ case SDL_KEYUP:
+ if (e.key.keysym.sym < 256 && (e.key.keysym.mod == 0 || (e.key.keysym.mod & KMOD_NUM)))
+ InputKeyboardUp(e.key.keysym.sym, 0, 0);
+ InputArrowKeysUp(e.key.keysym.sym, 0, 0);
+ break;
+
+ case SDL_MOUSEMOTION:
+ if (e.motion.state)
+ MouseMotionFunc(e.motion.state, e.motion.x, e.motion.y);
+ else
+ MousePassiveMotionFunc(e.motion.x, e.motion.y);
+ break;
+
+ case SDL_MOUSEBUTTONDOWN:
+ case SDL_MOUSEBUTTONUP:
+ MouseFunc(e.button.button, e.button.state, e.motion.x, e.motion.y);
+ break;
+
+ case SDL_WINDOWEVENT:
+ if (e.window.windowID == g_windowId)
+ {
+ if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
+ ReshapeWindow(e.window.data1, e.window.data2);
+ }
+ break;
+
+ case SDL_WINDOWEVENT_LEAVE:
+ g_camVel = Vec3(0.0f, 0.0f, 0.0f);
+ break;
+
+ case SDL_CONTROLLERBUTTONUP:
+ case SDL_CONTROLLERBUTTONDOWN:
+ ControllerButtonEvent(e.cbutton);
+ break;
+
+ case SDL_JOYDEVICEADDED:
+ case SDL_JOYDEVICEREMOVED:
+ ControllerDeviceUpdate();
+ break;
+ }
+ }
+ }
+}
+
+
+int main(int argc, char* argv[])
+{
+ // process command line args
+ for (int i = 1; i < argc; ++i)
+ {
+ int d;
+ if (sscanf(argv[i], "-device=%d", &d))
+ g_device = d;
+
+ if (sscanf(argv[i], "-extensions=%d", &d))
+ g_extensions = d != 0;
+
+ if (strstr(argv[i], "-benchmark"))
+ {
+ g_benchmark = true;
+ g_profile = true;
+ }
+
+ if (strstr(argv[i], "-d3d12"))
+ g_d3d12 = true;
+
+ if (strstr(argv[i], "-tc"))
+ g_teamCity = true;
+
+ if (sscanf(argv[i], "-msaa=%d", &d))
+ g_msaaSamples = d;
+
+ int w = 1280;
+ int h = 720;
+ if (sscanf(argv[i], "-fullscreen=%dx%d", &w, &h) == 2)
+ {
+ g_screenWidth = w;
+ g_screenHeight = h;
+ g_fullscreen = true;
+ }
+ else if (strstr(argv[i], "-fullscreen"))
+ {
+ g_screenWidth = w;
+ g_screenHeight = h;
+ g_fullscreen = true;
+ }
+
+ if (sscanf(argv[i], "-vsync=%d", &d))
+ g_vsync = d != 0;
+
+ if (sscanf(argv[i], "-multiplier=%d", &d) == 1)
+ {
+ g_numExtraMultiplier = d;
+ }
+
+ if (strstr(argv[i], "-disabletweak"))
+ {
+ g_tweakPanel = false;
+ }
+
+ if (strstr(argv[i], "-disableinterop"))
+ {
+ g_interop = false;
+ }
+ }
+
+ // opening scene
+ g_scenes.push_back(new PotPourri("Pot Pourri"));
+
+
+ // soft body scenes
+ SoftBody* softOctopus = new SoftBody("Soft Octopus", "../../data/softs/octopus.obj");
+ softOctopus->mScale = Vec3(32.0f);
+ softOctopus->mClusterSpacing = 2.75f;
+ softOctopus->mClusterRadius = 3.0f;
+ softOctopus->mClusterStiffness = 0.15f;
+ softOctopus->mSurfaceSampling = 1.0f;
+ softOctopus->mStack[1] = 3;
+
+ SoftBody* softRope = new SoftBody("Soft Rope", "../../data/rope.obj");
+ softRope->mScale = Vec3(50.0f);
+ softRope->mClusterSpacing = 1.5f;
+ softRope->mClusterRadius = 0.0f;
+ softRope->mClusterStiffness = 0.55f;
+
+ SoftBody* softBowl = new SoftBody("Soft Bowl", "../../data/bowl_high.ply");
+ softBowl->mScale = Vec3(10.0f);
+ softBowl->mClusterSpacing = 2.0f;
+ softBowl->mClusterRadius = 2.0f;
+ softBowl->mClusterStiffness = 0.55f;
+
+ SoftBody* softCloth = new SoftBody("Soft Cloth", "../../data/box_ultra_high.ply");
+ softCloth->mScale = Vec3(20.0f, 0.2f, 20.0f);
+ softCloth->mRadius = 0.05f;
+ softCloth->mClusterSpacing = 1.0f;
+ softCloth->mClusterRadius = 2.0f;
+ softCloth->mClusterStiffness = 0.2f;
+ softCloth->mLinkRadius = 2.0f;
+ softCloth->mLinkStiffness = 1.0f;
+ softCloth->mSkinningFalloff = 1.0f;
+ softCloth->mSkinningMaxDistance = 100.f;
+
+ SoftBodyFixed* softRod = new SoftBodyFixed("Soft Rod", "../../data/box_very_high.ply");
+ softRod->mScale = Vec3(20.0f, 2.0f, 2.0f);
+ softRod->mOffset = Vec3(-0.3f, 1.0f, 0.0f);
+ softRod->mClusterSpacing = 2.0f;
+ softRod->mClusterRadius = 2.0f;
+ softRod->mClusterStiffness = 0.225f;
+ softRod->mStack[2] = 3;
+
+ SoftBody* softTeapot = new SoftBody("Soft Teapot", "../../data/teapot.ply");
+ softTeapot->mScale = Vec3(25.0f);
+ softTeapot->mClusterSpacing = 3.0f;
+ softTeapot->mClusterRadius = 0.0f;
+ softTeapot->mClusterStiffness = 0.1f;
+
+ SoftBody* softArmadillo = new SoftBody("Soft Armadillo", "../../data/armadillo.ply");
+ softArmadillo->mScale = Vec3(25.0f);
+ softArmadillo->mClusterSpacing = 3.0f;
+ softArmadillo->mClusterRadius = 0.0f;
+
+ SoftBody* softBunny = new SoftBody("Soft Bunny", "../../data/bunny.ply");
+ softBunny->mScale = Vec3(20.0f);
+ softBunny->mClusterSpacing = 3.5f;
+ softBunny->mClusterRadius = 0.0f;
+ softBunny->mClusterStiffness = 0.2f;
+
+ SoftBody* plasticBunnies = new SoftBody("Plastic Bunnies", "../../data/bunny.ply");
+ plasticBunnies->mScale = Vec3(10.0f);
+ plasticBunnies->mClusterSpacing = 1.0f;
+ plasticBunnies->mClusterRadius = 0.0f;
+ plasticBunnies->mClusterStiffness = 0.0f;
+ plasticBunnies->mGlobalStiffness = 1.0f;
+ plasticBunnies->mPlasticThreshold = 0.0015f;
+ plasticBunnies->mPlasticCreep = 0.15f;
+ plasticBunnies->mRelaxationFactor = 1.0f;
+ plasticBunnies->mOffset[1] = 5.0f;
+ plasticBunnies->mStack[1] = 10;
+ plasticBunnies->mPlinth = true;
+
+ g_scenes.push_back(softOctopus);
+ g_scenes.push_back(softTeapot);
+ g_scenes.push_back(softRope);
+ g_scenes.push_back(softCloth);
+ g_scenes.push_back(softBowl);
+ g_scenes.push_back(softRod);
+ g_scenes.push_back(softArmadillo);
+ g_scenes.push_back(softBunny);
+ g_scenes.push_back(plasticBunnies);
+
+
+ // collision scenes
+ g_scenes.push_back(new FrictionRamp("Friction Ramp"));
+ g_scenes.push_back(new FrictionMovingShape("Friction Moving Box", 0));
+ g_scenes.push_back(new FrictionMovingShape("Friction Moving Sphere", 1));
+ g_scenes.push_back(new FrictionMovingShape("Friction Moving Capsule", 2));
+ g_scenes.push_back(new ShapeCollision("Shape Collision"));
+ g_scenes.push_back(new TriangleCollision("Triangle Collision"));
+ g_scenes.push_back(new LocalSpaceFluid("Local Space Fluid"));
+ g_scenes.push_back(new LocalSpaceCloth("Local Space Cloth"));
+ g_scenes.push_back(new CCDFluid("World Space Fluid"));
+
+
+ // cloth scenes
+ g_scenes.push_back(new EnvironmentalCloth("Env Cloth Small", 6, 6, 40, 16));
+ g_scenes.push_back(new EnvironmentalCloth("Env Cloth Large", 16, 32, 10, 3));
+ g_scenes.push_back(new FlagCloth("Flag Cloth"));
+ g_scenes.push_back(new Inflatable("Inflatables"));
+ g_scenes.push_back(new ClothLayers("Cloth Layers"));
+ g_scenes.push_back(new SphereCloth("Sphere Cloth"));
+ g_scenes.push_back(new Tearing("Tearing"));
+ g_scenes.push_back(new Pasta("Pasta"));
+
+
+ // game mesh scenes
+ g_scenes.push_back(new GameMesh("Game Mesh Rigid", 0));
+ g_scenes.push_back(new GameMesh("Game Mesh Particles", 1));
+ g_scenes.push_back(new GameMesh("Game Mesh Fluid", 2));
+ g_scenes.push_back(new GameMesh("Game Mesh Cloth", 3));
+ g_scenes.push_back(new RigidDebris("Rigid Debris"));
+
+ // viscous fluids
+ g_scenes.push_back(new Viscosity("Viscosity Low", 0.5f));
+ g_scenes.push_back(new Viscosity("Viscosity Med", 3.0f));
+ g_scenes.push_back(new Viscosity("Viscosity High", 5.0f, 0.12f));
+ g_scenes.push_back(new Adhesion("Adhesion"));
+ g_scenes.push_back(new GooGun("Goo Gun", true));
+
+ // regular fluids
+ g_scenes.push_back(new Buoyancy("Buoyancy"));
+ g_scenes.push_back(new Melting("Melting"));
+ g_scenes.push_back(new SurfaceTension("Surface Tension Low", 0.0f));
+ g_scenes.push_back(new SurfaceTension("Surface Tension Med", 10.0f));
+ g_scenes.push_back(new SurfaceTension("Surface Tension High", 20.0f));
+ g_scenes.push_back(new DamBreak("DamBreak 5cm", 0.05f));
+ g_scenes.push_back(new DamBreak("DamBreak 10cm", 0.1f));
+ g_scenes.push_back(new DamBreak("DamBreak 15cm", 0.15f));
+ g_scenes.push_back(new RockPool("Rock Pool"));
+ g_scenes.push_back(new RayleighTaylor2D("Rayleigh Taylor 2D"));
+
+ // misc feature scenes
+ g_scenes.push_back(new TriggerVolume("Trigger Volume"));
+ g_scenes.push_back(new ForceField("Force Field"));
+ g_scenes.push_back(new InitialOverlap("Initial Overlap"));
+
+ // rigid body scenes
+ g_scenes.push_back(new RigidPile("Rigid2", 2));
+ g_scenes.push_back(new RigidPile("Rigid4", 4));
+ g_scenes.push_back(new RigidPile("Rigid8", 12));
+ g_scenes.push_back(new BananaPile("Bananas"));
+ g_scenes.push_back(new LowDimensionalShapes("Low Dimensional Shapes"));
+ g_scenes.push_back(new PlasticStack("Plastic Stack"));
+
+ // granular scenes
+ g_scenes.push_back(new GranularPile("Granular Pile"));
+
+ // coupling scenes
+ g_scenes.push_back(new ParachutingBunnies("Parachuting Bunnies"));
+ g_scenes.push_back(new WaterBalloon("Water Balloons"));
+ g_scenes.push_back(new RigidFluidCoupling("Rigid Fluid Coupling"));
+ g_scenes.push_back(new FluidBlock("Fluid Block"));
+ g_scenes.push_back(new FluidClothCoupling("Fluid Cloth Coupling Water", false));
+ g_scenes.push_back(new FluidClothCoupling("Fluid Cloth Coupling Goo", true));
+ g_scenes.push_back(new BunnyBath("Bunny Bath Dam", true));
+
+ // init gl
+#ifndef ANDROID
+
+#if FLEX_DX
+ const char* title = "Flex Demo (Direct Compute)";
+#else
+ const char* title = "Flex Demo (CUDA)";
+#endif
+
+ SDLInit(title);
+
+ InitRender(g_window, g_fullscreen, g_msaaSamples);
+
+ if (g_fullscreen)
+ SDL_SetWindowFullscreen(g_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+
+ ReshapeWindow(g_screenWidth, g_screenHeight);
+
+#endif // ifndef ANDROID
+
+#if !FLEX_DX
+
+ // use the PhysX GPU selected from the NVIDIA control panel
+ if (g_device == -1)
+ g_device = NvFlexDeviceGetSuggestedOrdinal();
+
+ // Create an optimized CUDA context for Flex and set it on the
+ // calling thread. This is an optional call, it is fine to use
+ // a regular CUDA context, although creating one through this API
+ // is recommended for best performance.
+ bool success = NvFlexDeviceCreateCudaContext(g_device);
+
+ if (!success)
+ {
+ printf("Error creating CUDA context.\n");
+ exit(-1);
+ }
+
+#endif
+
+ NvFlexInitDesc desc;
+ desc.deviceIndex = g_device;
+ desc.enableExtensions = g_extensions;
+ desc.renderDevice = 0;
+ desc.renderContext = 0;
+ desc.computeType = eNvFlexCUDA;
+
+#if FLEX_DX
+
+ if (g_d3d12)
+ desc.computeType = eNvFlexD3D12;
+ else
+ desc.computeType = eNvFlexD3D11;
+
+ if (g_device == -1 && !g_d3d12)
+ {
+ // use the renderer device
+ GetRenderDevice((ID3D11Device**)&desc.renderDevice,
+ (ID3D11DeviceContext**)&desc.renderContext);
+ }
+ else
+ {
+ // disable shared resources
+ g_interop = false;
+ }
+
+#endif
+
+ // Init Flex library, note that no CUDA methods should be called before this
+ // point to ensure we get the device context we want
+ g_flexLib = NvFlexInit(NV_FLEX_VERSION, ErrorCallback, &desc);
+
+ if (g_Error || g_flexLib == NULL)
+ {
+ printf("Could not initialize Flex, exiting.\n");
+ exit(-1);
+ }
+
+ // store device name
+ strcpy(g_deviceName, NvFlexGetDeviceName(g_flexLib));
+ printf("Compute Device: %s\n\n", g_deviceName);
+
+ if (g_benchmark)
+ BenchmarkInit();
+
+
+ // create shadow maps
+ g_shadowMap = ShadowCreate();
+
+ // init default scene
+ Init(g_scene);
+
+ SDLMainLoop();
+
+ if (g_fluidRenderer)
+ DestroyFluidRenderer(g_fluidRenderer);
+
+ DestroyFluidRenderBuffers(g_fluidRenderBuffers);
+ DestroyDiffuseRenderBuffers(g_diffuseRenderBuffers);
+
+ ShadowDestroy(g_shadowMap);
+ DestroyRender();
+
+ Shutdown();
+
+ SDL_DestroyWindow(g_window);
+ SDL_Quit();
+
+ return 0;
+}
diff --git a/demo/opengl/imguiRenderGL.cpp b/demo/opengl/imguiRenderGL.cpp
new file mode 100644
index 0000000..bfb961e
--- /dev/null
+++ b/demo/opengl/imguiRenderGL.cpp
@@ -0,0 +1,484 @@
+//
+// Copyright (c) 2009-2010 Mikko Mononen [email protected]
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include <stdio.h>
+
+#include "../imgui.h"
+
+#include "shader.h"
+
+// Some math headers don't have PI defined.
+static const float PI = 3.14159265f;
+
+void imguifree(void* ptr, void* userptr);
+void* imguimalloc(size_t size, void* userptr);
+
+#define STBTT_malloc(x,y) imguimalloc(x,y)
+#define STBTT_free(x,y) imguifree(x,y)
+#define STB_TRUETYPE_IMPLEMENTATION
+#include "../stb_truetype.h"
+
+void imguifree(void* ptr, void* /*userptr*/)
+{
+ free(ptr);
+}
+
+void* imguimalloc(size_t size, void* /*userptr*/)
+{
+ return malloc(size);
+}
+
+static const unsigned TEMP_COORD_COUNT = 100;
+static float g_tempCoords[TEMP_COORD_COUNT*2];
+static float g_tempNormals[TEMP_COORD_COUNT*2];
+
+static const int CIRCLE_VERTS = 8*4;
+static float g_circleVerts[CIRCLE_VERTS*2];
+
+static stbtt_bakedchar g_cdata[96]; // ASCII 32..126 is 95 glyphs
+static GLuint g_ftex = 0;
+
+inline unsigned int RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
+{
+ return (r) | (g << 8) | (b << 16) | (a << 24);
+}
+
+static void drawPolygon(const float* coords, unsigned numCoords, float r, unsigned int col)
+{
+ if (numCoords > TEMP_COORD_COUNT) numCoords = TEMP_COORD_COUNT;
+
+ for (unsigned i = 0, j = numCoords-1; i < numCoords; j=i++)
+ {
+ const float* v0 = &coords[j*2];
+ const float* v1 = &coords[i*2];
+ float dx = v1[0] - v0[0];
+ float dy = v1[1] - v0[1];
+ float d = sqrtf(dx*dx+dy*dy);
+ if (d > 0)
+ {
+ d = 1.0f/d;
+ dx *= d;
+ dy *= d;
+ }
+ g_tempNormals[j*2+0] = dy;
+ g_tempNormals[j*2+1] = -dx;
+ }
+
+ for (unsigned i = 0, j = numCoords-1; i < numCoords; j=i++)
+ {
+ float dlx0 = g_tempNormals[j*2+0];
+ float dly0 = g_tempNormals[j*2+1];
+ float dlx1 = g_tempNormals[i*2+0];
+ float dly1 = g_tempNormals[i*2+1];
+ float dmx = (dlx0 + dlx1) * 0.5f;
+ float dmy = (dly0 + dly1) * 0.5f;
+ float dmr2 = dmx*dmx + dmy*dmy;
+ if (dmr2 > 0.000001f)
+ {
+ float scale = 1.0f / dmr2;
+ if (scale > 10.0f) scale = 10.0f;
+ dmx *= scale;
+ dmy *= scale;
+ }
+ g_tempCoords[i*2+0] = coords[i*2+0]+dmx*r;
+ g_tempCoords[i*2+1] = coords[i*2+1]+dmy*r;
+ }
+
+ unsigned int colTrans = RGBA(col&0xff, (col>>8)&0xff, (col>>16)&0xff, 0);
+
+ glBegin(GL_TRIANGLES);
+
+ glColor4ubv((GLubyte*)&col);
+
+ for (unsigned i = 0, j = numCoords-1; i < numCoords; j=i++)
+ {
+ glVertex2fv(&coords[i*2]);
+ glVertex2fv(&coords[j*2]);
+ glColor4ubv((GLubyte*)&colTrans);
+ glVertex2fv(&g_tempCoords[j*2]);
+
+ glVertex2fv(&g_tempCoords[j*2]);
+ glVertex2fv(&g_tempCoords[i*2]);
+
+ glColor4ubv((GLubyte*)&col);
+ glVertex2fv(&coords[i*2]);
+ }
+
+ glColor4ubv((GLubyte*)&col);
+ for (unsigned i = 2; i < numCoords; ++i)
+ {
+ glVertex2fv(&coords[0]);
+ glVertex2fv(&coords[(i-1)*2]);
+ glVertex2fv(&coords[i*2]);
+ }
+
+ glEnd();
+}
+
+static void drawRect(float x, float y, float w, float h, float fth, unsigned int col)
+{
+ float verts[4*2] =
+ {
+ x+0.5f, y+0.5f,
+ x+w-0.5f, y+0.5f,
+ x+w-0.5f, y+h-0.5f,
+ x+0.5f, y+h-0.5f,
+ };
+ drawPolygon(verts, 4, fth, col);
+}
+
+/*
+static void drawEllipse(float x, float y, float w, float h, float fth, unsigned int col)
+{
+ float verts[CIRCLE_VERTS*2];
+ const float* cverts = g_circleVerts;
+ float* v = verts;
+
+ for (int i = 0; i < CIRCLE_VERTS; ++i)
+ {
+ *v++ = x + cverts[i*2]*w;
+ *v++ = y + cverts[i*2+1]*h;
+ }
+
+ drawPolygon(verts, CIRCLE_VERTS, fth, col);
+}
+*/
+
+static void drawRoundedRect(float x, float y, float w, float h, float r, float fth, unsigned int col)
+{
+ const unsigned n = CIRCLE_VERTS/4;
+ float verts[(n+1)*4*2];
+ const float* cverts = g_circleVerts;
+ float* v = verts;
+
+ for (unsigned i = 0; i <= n; ++i)
+ {
+ *v++ = x+w-r + cverts[i*2]*r;
+ *v++ = y+h-r + cverts[i*2+1]*r;
+ }
+
+ for (unsigned i = n; i <= n*2; ++i)
+ {
+ *v++ = x+r + cverts[i*2]*r;
+ *v++ = y+h-r + cverts[i*2+1]*r;
+ }
+
+ for (unsigned i = n*2; i <= n*3; ++i)
+ {
+ *v++ = x+r + cverts[i*2]*r;
+ *v++ = y+r + cverts[i*2+1]*r;
+ }
+
+ for (unsigned i = n*3; i < n*4; ++i)
+ {
+ *v++ = x+w-r + cverts[i*2]*r;
+ *v++ = y+r + cverts[i*2+1]*r;
+ }
+ *v++ = x+w-r + cverts[0]*r;
+ *v++ = y+r + cverts[1]*r;
+
+ drawPolygon(verts, (n+1)*4, fth, col);
+}
+
+
+static void drawLine(float x0, float y0, float x1, float y1, float r, float fth, unsigned int col)
+{
+ float dx = x1-x0;
+ float dy = y1-y0;
+ float d = sqrtf(dx*dx+dy*dy);
+ if (d > 0.0001f)
+ {
+ d = 1.0f/d;
+ dx *= d;
+ dy *= d;
+ }
+ float nx = dy;
+ float ny = -dx;
+ float verts[4*2];
+ r -= fth;
+ r *= 0.5f;
+ if (r < 0.01f) r = 0.01f;
+ dx *= r;
+ dy *= r;
+ nx *= r;
+ ny *= r;
+
+ verts[0] = x0-dx-nx;
+ verts[1] = y0-dy-ny;
+
+ verts[2] = x0-dx+nx;
+ verts[3] = y0-dy+ny;
+
+ verts[4] = x1+dx+nx;
+ verts[5] = y1+dy+ny;
+
+ verts[6] = x1+dx-nx;
+ verts[7] = y1+dy-ny;
+
+ drawPolygon(verts, 4, fth, col);
+}
+
+
+bool imguiRenderGLInit(const char* fontpath)
+{
+ for (int i = 0; i < CIRCLE_VERTS; ++i)
+ {
+ float a = (float)i / (float)CIRCLE_VERTS * PI * 2;
+ g_circleVerts[i * 2 + 0] = cosf(a);
+ g_circleVerts[i * 2 + 1] = sinf(a);
+ }
+
+ // Load font.
+ FILE* fp = fopen(fontpath, "rb");
+ if (!fp) return false;
+ fseek(fp, 0, SEEK_END);
+ int size = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+
+ unsigned char* ttfBuffer = (unsigned char*)malloc(size);
+ if (!ttfBuffer)
+ {
+ fclose(fp);
+ return false;
+ }
+
+ size_t len = fread(ttfBuffer, 1, size, fp);
+ (void)len;
+
+ fclose(fp);
+ fp = 0;
+
+ unsigned char* bmap = (unsigned char*)malloc(512 * 512);
+ if (!bmap)
+ {
+ free(ttfBuffer);
+ return false;
+ }
+
+ stbtt_BakeFontBitmap(ttfBuffer, 0, 15.0f, bmap, 512, 512, 32, 96, g_cdata);
+
+ // can free ttf_buffer at this point
+ glVerify(glGenTextures(1, &g_ftex));
+ glVerify(glBindTexture(GL_TEXTURE_2D, g_ftex));
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 512, 512, 0, GL_ALPHA, GL_UNSIGNED_BYTE, bmap));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+
+ free(ttfBuffer);
+ free(bmap);
+
+ return true;
+}
+
+void imguiRenderGLDestroy()
+{
+ if (g_ftex)
+ {
+ glDeleteTextures(1, &g_ftex);
+ g_ftex = 0;
+ }
+}
+
+static void getBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index,
+ float *xpos, float *ypos, stbtt_aligned_quad *q)
+{
+ stbtt_bakedchar *b = chardata + char_index;
+ int round_x = STBTT_ifloor(*xpos + b->xoff);
+ int round_y = STBTT_ifloor(*ypos - b->yoff);
+
+ q->x0 = (float)round_x;
+ q->y0 = (float)round_y;
+ q->x1 = (float)round_x + b->x1 - b->x0;
+ q->y1 = (float)round_y - b->y1 + b->y0;
+
+ q->s0 = b->x0 / (float)pw;
+ q->t0 = b->y0 / (float)pw;
+ q->s1 = b->x1 / (float)ph;
+ q->t1 = b->y1 / (float)ph;
+
+ *xpos += b->xadvance;
+}
+
+static const float g_tabStops[4] = {150, 210, 270, 330};
+
+static float getTextLength(stbtt_bakedchar *chardata, const char* text)
+{
+ float xpos = 0;
+ float len = 0;
+ while (*text)
+ {
+ int c = (unsigned char)*text;
+ if (c == '\t')
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ if (xpos < g_tabStops[i])
+ {
+ xpos = g_tabStops[i];
+ break;
+ }
+ }
+ }
+ else if (c >= 32 && c < 128)
+ {
+ stbtt_bakedchar *b = chardata + c-32;
+ int round_x = STBTT_ifloor((xpos + b->xoff) + 0.5);
+ len = round_x + b->x1 - b->x0 + 0.5f;
+ xpos += b->xadvance;
+ }
+ ++text;
+ }
+ return len;
+}
+
+static void drawText(float x, float y, const char *text, int align, unsigned int col)
+{
+ if (!g_ftex) return;
+ if (!text) return;
+
+ if (align == IMGUI_ALIGN_CENTER)
+ x -= getTextLength(g_cdata, text)/2;
+ else if (align == IMGUI_ALIGN_RIGHT)
+ x -= getTextLength(g_cdata, text);
+
+ glColor4ub(col&0xff, (col>>8)&0xff, (col>>16)&0xff, (col>>24)&0xff);
+
+ glEnable(GL_TEXTURE_2D);
+
+ // assume orthographic projection with units = screen pixels, origin at top left
+ glBindTexture(GL_TEXTURE_2D, g_ftex);
+
+ glBegin(GL_TRIANGLES);
+
+ const float ox = x;
+
+ while (*text)
+ {
+ int c = (unsigned char)*text;
+ if (c == '\t')
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ if (x < g_tabStops[i]+ox)
+ {
+ x = g_tabStops[i]+ox;
+ break;
+ }
+ }
+ }
+ else if (c >= 32 && c < 128)
+ {
+ stbtt_aligned_quad q;
+ getBakedQuad(g_cdata, 512,512, c-32, &x,&y,&q);
+
+ glTexCoord2f(q.s0, q.t0);
+ glVertex2f(q.x0, q.y0);
+ glTexCoord2f(q.s1, q.t1);
+ glVertex2f(q.x1, q.y1);
+ glTexCoord2f(q.s1, q.t0);
+ glVertex2f(q.x1, q.y0);
+
+ glTexCoord2f(q.s0, q.t0);
+ glVertex2f(q.x0, q.y0);
+ glTexCoord2f(q.s0, q.t1);
+ glVertex2f(q.x0, q.y1);
+ glTexCoord2f(q.s1, q.t1);
+ glVertex2f(q.x1, q.y1);
+ }
+ ++text;
+ }
+
+ glEnd();
+ glDisable(GL_TEXTURE_2D);
+}
+
+
+void imguiRenderGLDraw()
+{
+ const imguiGfxCmd* q = imguiGetRenderQueue();
+ int nq = imguiGetRenderQueueSize();
+
+ const float s = 1.0f/8.0f;
+
+ glDisable(GL_SCISSOR_TEST);
+ for (int i = 0; i < nq; ++i)
+ {
+ const imguiGfxCmd& cmd = q[i];
+ if (cmd.type == IMGUI_GFXCMD_RECT)
+ {
+ if (cmd.rect.r == 0)
+ {
+ drawRect((float)cmd.rect.x*s+0.5f, (float)cmd.rect.y*s+0.5f,
+ (float)cmd.rect.w*s-1, (float)cmd.rect.h*s-1,
+ 1.0f, cmd.col);
+ }
+ else
+ {
+ drawRoundedRect((float)cmd.rect.x*s+0.5f, (float)cmd.rect.y*s+0.5f,
+ (float)cmd.rect.w*s-1, (float)cmd.rect.h*s-1,
+ (float)cmd.rect.r*s, 1.0f, cmd.col);
+ }
+ }
+ else if (cmd.type == IMGUI_GFXCMD_LINE)
+ {
+ drawLine(cmd.line.x0*s, cmd.line.y0*s, cmd.line.x1*s, cmd.line.y1*s, cmd.line.r*s, 1.0f, cmd.col);
+ }
+ else if (cmd.type == IMGUI_GFXCMD_TRIANGLE)
+ {
+ if (cmd.flags == 1)
+ {
+ const float verts[3*2] =
+ {
+ (float)cmd.rect.x*s+0.5f, (float)cmd.rect.y*s+0.5f,
+ (float)cmd.rect.x*s+0.5f+(float)cmd.rect.w*s-1, (float)cmd.rect.y*s+0.5f+(float)cmd.rect.h*s/2-0.5f,
+ (float)cmd.rect.x*s+0.5f, (float)cmd.rect.y*s+0.5f+(float)cmd.rect.h*s-1,
+ };
+ drawPolygon(verts, 3, 1.0f, cmd.col);
+ }
+ if (cmd.flags == 2)
+ {
+ const float verts[3*2] =
+ {
+ (float)cmd.rect.x*s+0.5f, (float)cmd.rect.y*s+0.5f+(float)cmd.rect.h*s-1,
+ (float)cmd.rect.x*s+0.5f+(float)cmd.rect.w*s/2-0.5f, (float)cmd.rect.y*s+0.5f,
+ (float)cmd.rect.x*s+0.5f+(float)cmd.rect.w*s-1, (float)cmd.rect.y*s+0.5f+(float)cmd.rect.h*s-1,
+ };
+ drawPolygon(verts, 3, 1.0f, cmd.col);
+ }
+ }
+ else if (cmd.type == IMGUI_GFXCMD_TEXT)
+ {
+ drawText(cmd.text.x, cmd.text.y, cmd.text.text, cmd.text.align, cmd.col);
+ }
+ else if (cmd.type == IMGUI_GFXCMD_SCISSOR)
+ {
+ if (cmd.flags)
+ {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(cmd.rect.x, cmd.rect.y, cmd.rect.w, cmd.rect.h);
+ }
+ else
+ {
+ glDisable(GL_SCISSOR_TEST);
+ }
+ }
+ }
+ glDisable(GL_SCISSOR_TEST);
+}
diff --git a/demo/opengl/imguiRenderGL.h b/demo/opengl/imguiRenderGL.h
new file mode 100644
index 0000000..b148341
--- /dev/null
+++ b/demo/opengl/imguiRenderGL.h
@@ -0,0 +1,26 @@
+//
+// Copyright (c) 2009-2010 Mikko Mononen [email protected]
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#ifndef IMGUI_RENDER_GL_H
+#define IMGUI_RENDER_GL_H
+
+bool imguiRenderGLInit(const char* fontpath);
+void imguiRenderGLDestroy();
+void imguiRenderGLDraw();
+
+#endif // IMGUI_RENDER_GL_H \ No newline at end of file
diff --git a/demo/opengl/shader.cpp b/demo/opengl/shader.cpp
new file mode 100644
index 0000000..3c7640f
--- /dev/null
+++ b/demo/opengl/shader.cpp
@@ -0,0 +1,248 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 20132017 NVIDIA Corporation. All rights reserved.
+
+#include "shader.h"
+
+#include "../../core/types.h"
+#include "../../core/maths.h"
+#include "../../core/platform.h"
+#include "../../core/tga.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#define WITH_GLEW
+
+void GlslPrintShaderLog(GLuint obj)
+{
+#if !PLATFORM_IOS
+ int infologLength = 0;
+ int charsWritten = 0;
+ char *infoLog;
+
+ GLint result;
+ glGetShaderiv(obj, GL_COMPILE_STATUS, &result);
+
+ // only print log if compile fails
+ if (result == GL_FALSE)
+ {
+ glGetShaderiv(obj, GL_INFO_LOG_LENGTH,&infologLength);
+
+ if (infologLength > 1)
+ {
+ infoLog = (char *)malloc(infologLength);
+ glGetShaderInfoLog(obj, infologLength, &charsWritten, infoLog);
+ printf("%s\n",infoLog);
+ free(infoLog);
+ }
+ }
+#endif
+}
+
+void glAssert(const char* msg, long line, const char* file)
+{
+ struct glError
+ {
+ GLenum code;
+ const char* name;
+ };
+
+ static const glError errors[] = { {GL_NO_ERROR, "No Error"},
+ {GL_INVALID_ENUM, "Invalid Enum"},
+ {GL_INVALID_VALUE, "Invalid Value"},
+ {GL_INVALID_OPERATION, "Invalid Operation"}
+#if OGL1
+ ,{GL_STACK_OVERFLOW, "Stack Overflow"},
+ {GL_STACK_UNDERFLOW, "Stack Underflow"},
+ {GL_OUT_OF_MEMORY, "Out Of Memory"}
+#endif
+ };
+
+ GLenum e = glGetError();
+
+ if (e == GL_NO_ERROR)
+ {
+ return;
+ }
+ else
+ {
+ const char* errorName = "Unknown error";
+
+ // find error message
+ for (uint32_t i=0; i < sizeof(errors)/sizeof(glError); i++)
+ {
+ if (errors[i].code == e)
+ {
+ errorName = errors[i].name;
+ }
+ }
+
+ printf("OpenGL: %s - error %s in %s at line %d\n", msg, errorName, file, int(line));
+ assert(0);
+ }
+}
+
+void PreProcessShader(const char* filename, std::string& source)
+{
+ // load source
+ FILE* f = fopen(filename, "r");
+
+ if (!f)
+ {
+ printf("Could not open shader file for reading: %s\n", filename);
+ return;
+ }
+
+ // add lines one at a time handling include files recursively
+ while (!feof(f))
+ {
+ char buf[1024];
+
+ if (fgets(buf, 1024, f) != NULL)
+ {
+ // test for #include
+ if (strncmp(buf, "#include", 8) == 0)
+ {
+ const char* begin = strchr(buf, '\"');
+ const char* end = strrchr(buf, '\"');
+
+ if (begin && end && (begin != end))
+ {
+ // lookup file relative to current file
+ PreProcessShader((StripFilename(filename) + std::string(begin+1, end)).c_str(), source);
+ }
+ }
+ else
+ {
+ // add line to output
+ source += buf;
+ }
+ }
+ }
+
+ fclose(f);
+}
+
+GLuint CompileProgram(const char *vsource, const char *fsource, const char* gsource)
+{
+ GLuint vertexShader = GLuint(-1);
+ GLuint geometryShader = GLuint(-1);
+ GLuint fragmentShader = GLuint(-1);
+
+ GLuint program = glCreateProgram();
+
+ if (vsource)
+ {
+ vertexShader = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vertexShader, 1, &vsource, 0);
+ glCompileShader(vertexShader);
+ GlslPrintShaderLog(vertexShader);
+ glAttachShader(program, vertexShader);
+ }
+
+ if (fsource)
+ {
+ fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(fragmentShader, 1, &fsource, 0);
+ glCompileShader(fragmentShader);
+ GlslPrintShaderLog(fragmentShader);
+ glAttachShader(program, fragmentShader);
+ }
+
+ if (gsource)
+ {
+ geometryShader = glCreateShader(GL_GEOMETRY_SHADER);
+ glShaderSource(geometryShader, 1, &gsource, 0);
+ glCompileShader(geometryShader);
+ GlslPrintShaderLog(geometryShader);
+
+ // hack, force billboard gs mode
+ glAttachShader(program, geometryShader);
+ glProgramParameteriEXT ( program, GL_GEOMETRY_VERTICES_OUT_EXT, 4 ) ;
+ glProgramParameteriEXT ( program, GL_GEOMETRY_INPUT_TYPE_EXT, GL_POINTS ) ;
+ glProgramParameteriEXT ( program, GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_TRIANGLE_STRIP ) ;
+ }
+
+ glLinkProgram(program);
+
+ // check if program linked
+ GLint success = 0;
+ glGetProgramiv(program, GL_LINK_STATUS, &success);
+
+ if (!success) {
+ char temp[256];
+ glGetProgramInfoLog(program, 256, 0, temp);
+ printf("Failed to link program:\n%s\n", temp);
+ glDeleteProgram(program);
+ program = 0;
+ }
+
+ return program;
+}
+
+void DrawPlane(const Vec4& p, bool color)
+{
+ Vec3 u, v;
+ BasisFromVector(Vec3(p.x, p.y, p.z), &u, &v);
+
+ Vec3 c = Vec3(p.x, p.y, p.z)*-p.w;
+
+ glBegin(GL_QUADS);
+
+ if (color)
+ glColor3fv(p*0.5f + Vec4(0.5f, 0.5f, 0.5f, 0.5f));
+
+ float kSize = 200.0f;
+
+ // draw a grid of quads, otherwise z precision suffers
+ for (int x = -3; x <= 3; ++x)
+ {
+ for (int y = -3; y <= 3; ++y)
+ {
+ Vec3 coff = c + u*float(x)*kSize*2.0f + v*float(y)*kSize*2.0f;
+
+ glTexCoord2f(1.0f, 1.0f);
+ glNormal3f(p.x, p.y, p.z);
+ glVertex3fv(coff + u*kSize + v*kSize);
+
+ glTexCoord2f(0.0f, 1.0f);
+ glNormal3f(p.x, p.y, p.z);
+ glVertex3fv(coff - u*kSize + v*kSize);
+
+ glTexCoord2f(0.0f, 0.0f);
+ glNormal3f(p.x, p.y, p.z);
+ glVertex3fv(coff - u*kSize - v*kSize);
+
+ glTexCoord2f(1.0f, 0.0f);
+ glNormal3f(p.x, p.y, p.z);
+ glVertex3fv(coff + u*kSize - v*kSize);
+ }
+ }
+
+ glEnd();
+}
+
diff --git a/demo/opengl/shader.h b/demo/opengl/shader.h
new file mode 100644
index 0000000..dd9468a
--- /dev/null
+++ b/demo/opengl/shader.h
@@ -0,0 +1,84 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 20132017 NVIDIA Corporation. All rights reserved.
+
+#pragma once
+
+#include "../../core/maths.h"
+
+#if _WIN32
+
+#define ENABLE_SIMPLE_FLUID 0
+
+#include "../../external/glew/include/gl/glew.h"
+#include "../../external/SDL2-2.0.4/include/SDL.h"
+
+#pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
+#pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
+
+#include <gl/GL.h>
+#include <gl/GLU.h>
+
+// Begin Add Android Support
+#elif ANDROID
+#include <GL/Regal.h>
+// End Add Android Support
+
+#elif __linux__
+#include <external/glew/include/GL/glew.h>
+#include <GL/gl.h>
+#include <GL/freeglut.h>
+
+#elif __APPLE__
+#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
+#include <opengl/gl3.h>
+#include <glut/glut.h>
+#elif PLATFORM_IOS
+
+#if OGL1
+#import <OpenGLES/EAGL.h>
+#import <OpenGLES/ES1/gl.h>
+#import <OpenGLES/ES1/glext.h>
+#else
+#import <OpenGLES/ES2/gl.h>
+#import <OpenGLES/ES2/glext.h>
+#endif
+
+#endif
+
+#include <vector>
+
+#if defined(NDEBUG)
+#define glVerify(x) x
+#else
+#define glVerify(x) {x; glAssert(#x, __LINE__, __FILE__);}
+void glAssert(const char* msg, long line, const char* file);
+#endif
+
+GLuint CompileProgram(const char *vsource=NULL, const char *fsource=NULL, const char* gsource=NULL);
+
+void DrawPlane(const Vec4& p, bool color=true);
+
diff --git a/demo/opengl/shadersGL.cpp b/demo/opengl/shadersGL.cpp
new file mode 100644
index 0000000..b4023db
--- /dev/null
+++ b/demo/opengl/shadersGL.cpp
@@ -0,0 +1,2772 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 20132017 NVIDIA Corporation. All rights reserved.
+
+#include "../shaders.h"
+
+#include "../../core/mesh.h"
+#include "../../core/tga.h"
+#include "../../core/platform.h"
+#include "../../core/extrude.h"
+
+#include "../../external/SDL2-2.0.4/include/SDL.h"
+
+#include "imguiRenderGL.h"
+
+#include "shader.h"
+
+#ifdef ANDROID
+#include "android/Log.h"
+#include "android/AndroidDefine.h"
+#include "android/AndroidMatrixTool.h"
+#endif
+
+#define CudaCheck(x) { cudaError_t err = x; if (err != cudaSuccess) { printf("Cuda error: %d in %s at %s:%d\n", err, #x, __FILE__, __LINE__); assert(0); } }
+
+namespace
+{
+
+int g_msaaSamples;
+GLuint g_msaaFbo;
+GLuint g_msaaColorBuf;
+GLuint g_msaaDepthBuf;
+
+int g_screenWidth;
+int g_screenHeight;
+
+SDL_Window* g_window;
+
+static float gSpotMin = 0.5f;
+static float gSpotMax = 1.0f;
+float gShadowBias = 0.05f;
+
+} // anonymous namespace
+
+Colour gColors[] =
+{
+ Colour(0.0f, 0.5f, 1.0f),
+ Colour(0.797f, 0.354f, 0.000f),
+ Colour(0.092f, 0.465f, 0.820f),
+ Colour(0.000f, 0.349f, 0.173f),
+ Colour(0.875f, 0.782f, 0.051f),
+ Colour(0.000f, 0.170f, 0.453f),
+ Colour(0.673f, 0.111f, 0.000f),
+ Colour(0.612f, 0.194f, 0.394f)
+};
+
+
+struct ShadowMap
+{
+ GLuint texture;
+ GLuint framebuffer;
+};
+
+
+void InitRender(SDL_Window* window, bool fullscreen, int msaaSamples)
+{
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
+
+ //SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
+
+ // Turn on double buffering with a 24bit Z buffer.
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
+
+ SDL_GL_CreateContext(window);
+
+ // This makes our buffer swap syncronized with the monitor's vertical refresh
+ SDL_GL_SetSwapInterval(1);
+
+ glewExperimental = GL_TRUE;
+ glewInit();
+
+ imguiRenderGLInit(GetFilePathByPlatform("../../data/DroidSans.ttf").c_str());
+
+ g_msaaSamples = msaaSamples;
+ g_window = window;
+}
+
+void DestroyRender()
+{
+
+}
+
+void StartFrame(Vec4 clearColor)
+{
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_BLEND);
+
+ glPointSize(5.0f);
+
+ glVerify(glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, g_msaaFbo));
+ glVerify(glClearColor(powf(clearColor.x, 1.0f / 2.2f), powf(clearColor.y, 1.0f / 2.2f), powf(clearColor.z, 1.0f / 2.2f), 0.0f));
+ glVerify(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
+
+
+}
+
+void EndFrame()
+{
+ if (g_msaaFbo)
+ {
+ // blit the msaa buffer to the window
+ glVerify(glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, g_msaaFbo));
+ glVerify(glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0));
+ glVerify(glBlitFramebuffer(0, 0, g_screenWidth, g_screenHeight, 0, 0, g_screenWidth, g_screenHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR));
+ }
+
+ // render help to back buffer
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, 0));
+ glVerify(glClear(GL_DEPTH_BUFFER_BIT));
+
+}
+
+void SetView(Matrix44 view, Matrix44 proj)
+{
+ glMatrixMode(GL_PROJECTION);
+ glLoadMatrixf(proj);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadMatrixf(view);
+}
+
+void SetFillMode(bool wireframe)
+{
+ glPolygonMode(GL_FRONT_AND_BACK, wireframe?GL_LINE:GL_FILL);
+}
+
+void SetCullMode(bool enabled)
+{
+ if (enabled)
+ glEnable(GL_CULL_FACE);
+ else
+ glDisable(GL_CULL_FACE);
+}
+
+
+void imguiGraphDraw()
+{
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+ glActiveTexture(GL_TEXTURE0);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_RECTANGLE_ARB);
+ glActiveTexture(GL_TEXTURE1);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE2);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE3);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE4);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_CUBE_MAP);
+ glActiveTexture(GL_TEXTURE5);
+ glDisable(GL_TEXTURE_2D);
+
+ glActiveTexture(GL_TEXTURE0);
+
+ glDisable(GL_BLEND);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_BLEND);
+ glDisable(GL_POINT_SPRITE);
+
+ // save scene camera transform
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+
+ const Matrix44 ortho = OrthographicMatrix(0.0f, float(g_screenWidth), 0.0f, float(g_screenHeight), -1.0f, 1.0f);
+
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadMatrixf(ortho);
+
+ glUseProgram(0);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable(GL_TEXTURE_2D);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ imguiRenderGLDraw();
+
+ // restore camera transform (for picking)
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+}
+
+void ReshapeRender(SDL_Window* window)
+{
+ int width, height;
+ SDL_GetWindowSize(window, &width, &height);
+
+ if (g_msaaSamples)
+ {
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, 0));
+
+ if (g_msaaFbo)
+ {
+ glVerify(glDeleteFramebuffers(1, &g_msaaFbo));
+ glVerify(glDeleteRenderbuffers(1, &g_msaaColorBuf));
+ glVerify(glDeleteRenderbuffers(1, &g_msaaDepthBuf));
+ }
+
+ int samples;
+ glGetIntegerv(GL_MAX_SAMPLES_EXT, &samples);
+
+ // clamp samples to 4 to avoid problems with point sprite scaling
+ samples = Min(samples, Min(g_msaaSamples, 4));
+
+ glVerify(glGenFramebuffers(1, &g_msaaFbo));
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, g_msaaFbo));
+
+ glVerify(glGenRenderbuffers(1, &g_msaaColorBuf));
+ glVerify(glBindRenderbuffer(GL_RENDERBUFFER, g_msaaColorBuf));
+ glVerify(glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_RGBA8, width, height));
+
+ glVerify(glGenRenderbuffers(1, &g_msaaDepthBuf));
+ glVerify(glBindRenderbuffer(GL_RENDERBUFFER, g_msaaDepthBuf));
+ glVerify(glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_DEPTH_COMPONENT, width, height));
+ glVerify(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, g_msaaDepthBuf));
+
+ glVerify(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, g_msaaColorBuf));
+
+ glVerify(glCheckFramebufferStatus(GL_FRAMEBUFFER));
+
+ glEnable(GL_MULTISAMPLE);
+ }
+
+ g_screenWidth = width;
+ g_screenHeight = height;
+}
+
+void GetViewRay(int x, int y, Vec3& origin, Vec3& dir)
+{
+ double modelview[16];
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
+
+ double projection[16];
+ glGetDoublev(GL_PROJECTION_MATRIX, projection);
+
+ int viewport[4];
+ glGetIntegerv(GL_VIEWPORT, viewport);
+
+ double nearPos[3];
+// Begin Add Android Support
+#ifdef ANDROID
+ glhUnProjectf(double(x), double(y), 0.0f, modelview, projection, viewport, nearPos);
+#else
+ gluUnProject(double(x), double(y), 0.0f, modelview, projection, viewport, &nearPos[0], &nearPos[1], &nearPos[2]);
+#endif
+// End Add Android Support
+
+ double farPos[3];
+// Begin Add Android Support
+#ifdef ANDROID
+ glhUnProjectf(double(x), double(y), 1.0f, modelview, projection, viewport, farPos);
+#else
+ gluUnProject(double(x), double(y), 1.0f, modelview, projection, viewport, &farPos[0], &farPos[1], &farPos[2]);
+#endif
+// End Add Android Support
+
+ origin = Vec3(float(nearPos[0]), float(nearPos[1]), float(nearPos[2]));
+ dir = Normalize(Vec3(float(farPos[0]-nearPos[0]), float(farPos[1]-nearPos[1]), float(farPos[2]-nearPos[2])));
+}
+
+void ReadFrame(int* backbuffer, int width, int height)
+{
+ glVerify(glReadBuffer(GL_BACK));
+ glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, backbuffer);
+}
+
+void PresentFrame(bool fullsync)
+{
+#ifndef ANDROID
+ SDL_GL_SetSwapInterval(fullsync);
+ glFinish();
+ SDL_GL_SwapWindow(g_window);
+#endif
+
+}
+
+
+// fixes some banding artifacts with repeated blending during thickness and diffuse rendering
+#define USE_HDR_DIFFUSE_BLEND 0
+
+// vertex shader
+const char *vertexPointShader = "#version 130\n" STRINGIFY(
+
+uniform float pointRadius; // point size in world space
+uniform float pointScale; // scale to calculate size in pixels
+
+uniform mat4 lightTransform;
+uniform vec3 lightDir;
+uniform vec3 lightDirView;
+
+uniform vec4 colors[8];
+
+uniform vec4 transmission;
+uniform int mode;
+
+//in int density;
+in float density;
+in int phase;
+in vec4 velocity;
+
+void main()
+{
+ // calculate window-space point size
+ vec4 viewPos = gl_ModelViewMatrix*vec4(gl_Vertex.xyz, 1.0);
+
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
+ gl_PointSize = -pointScale * (pointRadius / viewPos.z);
+
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[1] = lightTransform*vec4(gl_Vertex.xyz-lightDir*pointRadius*2.0, 1.0);
+ gl_TexCoord[2] = gl_ModelViewMatrix*vec4(lightDir, 0.0);
+
+ if (mode == 1)
+ {
+ // density visualization
+ if (density < 0.0f)
+ gl_TexCoord[3].xyz = mix(vec3(0.1, 0.1, 1.0), vec3(0.1, 1.0, 1.0), -density);
+ else
+ gl_TexCoord[3].xyz = mix(vec3(1.0, 1.0, 1.0), vec3(0.1, 0.2, 1.0), density);
+ }
+ else if (mode == 2)
+ {
+ gl_PointSize *= clamp(gl_Vertex.w*0.25, 0.0f, 1.0);
+
+ gl_TexCoord[3].xyzw = vec4(clamp(gl_Vertex.w*0.05, 0.0f, 1.0));
+ }
+ else
+ {
+ gl_TexCoord[3].xyz = mix(colors[phase % 8].xyz*2.0, vec3(1.0), 0.1);
+ }
+
+ gl_TexCoord[4].xyz = gl_Vertex.xyz;
+ gl_TexCoord[5].xyz = viewPos.xyz;
+}
+);
+
+// pixel shader for rendering points as shaded spheres
+const char *fragmentPointShader = STRINGIFY(
+
+uniform vec3 lightDir;
+uniform vec3 lightPos;
+uniform float spotMin;
+uniform float spotMax;
+uniform int mode;
+
+uniform sampler2DShadow shadowTex;
+uniform vec2 shadowTaps[12];
+uniform float pointRadius; // point size in world space
+
+// sample shadow map
+float shadowSample()
+{
+ vec3 pos = vec3(gl_TexCoord[1].xyz/gl_TexCoord[1].w);
+ vec3 uvw = (pos.xyz*0.5)+vec3(0.5);
+
+ // user clip
+ if (uvw.x < 0.0 || uvw.x > 1.0)
+ return 1.0;
+ if (uvw.y < 0.0 || uvw.y > 1.0)
+ return 1.0;
+
+ float s = 0.0;
+ float radius = 0.002;
+
+ for (int i=0; i < 8; i++)
+ {
+ s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i]*radius, uvw.z)).r;
+ }
+
+ s /= 8.0;
+ return s;
+}
+
+float sqr(float x) { return x*x; }
+
+void main()
+{
+ // calculate normal from texture coordinates
+ vec3 normal;
+ normal.xy = gl_TexCoord[0].xy*vec2(2.0, -2.0) + vec2(-1.0, 1.0);
+ float mag = dot(normal.xy, normal.xy);
+ if (mag > 1.0) discard; // kill pixels outside circle
+ normal.z = sqrt(1.0-mag);
+
+ if (mode == 2)
+ {
+ float alpha = normal.z*gl_TexCoord[3].w;
+ gl_FragColor.xyz = gl_TexCoord[3].xyz*alpha;
+ gl_FragColor.w = alpha;
+ return;
+ }
+
+ // calculate lighting
+ float shadow = shadowSample();
+
+ vec3 lVec = normalize(gl_TexCoord[4].xyz-(lightPos));
+ vec3 lPos = vec3(gl_TexCoord[1].xyz/gl_TexCoord[1].w);
+ float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05);
+
+ vec3 diffuse = vec3(0.9, 0.9, 0.9);
+ vec3 reflectance = gl_TexCoord[3].xyz;
+
+ vec3 Lo = diffuse*reflectance*max(0.0, sqr(-dot(gl_TexCoord[2].xyz, normal)*0.5 + 0.5))*max(0.2,shadow)*attenuation;
+
+ gl_FragColor = vec4(pow(Lo, vec3(1.0/2.2)), 1.0);
+
+ vec3 eyePos = gl_TexCoord[5].xyz + normal*pointRadius;//*2.0;
+ vec4 ndcPos = gl_ProjectionMatrix * vec4(eyePos, 1.0);
+ ndcPos.z /= ndcPos.w;
+ gl_FragDepth = ndcPos.z*0.5 + 0.5;
+}
+);
+
+// vertex shader
+const char *vertexShader = "#version 130\n" STRINGIFY(
+
+uniform mat4 lightTransform;
+uniform vec3 lightDir;
+uniform float bias;
+uniform vec4 clipPlane;
+uniform float expand;
+
+uniform mat4 objectTransform;
+
+void main()
+{
+ vec3 n = normalize((objectTransform*vec4(gl_Normal, 0.0)).xyz);
+ vec3 p = (objectTransform*vec4(gl_Vertex.xyz, 1.0)).xyz;
+
+ // calculate window-space point size
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(p + expand*n, 1.0);
+
+ gl_TexCoord[0].xyz = n;
+ gl_TexCoord[1] = lightTransform*vec4(p + n*bias, 1.0);
+ gl_TexCoord[2] = gl_ModelViewMatrix*vec4(lightDir, 0.0);
+ gl_TexCoord[3].xyz = p;
+ gl_TexCoord[4] = gl_Color;
+ gl_TexCoord[5] = gl_MultiTexCoord0;
+ gl_TexCoord[6] = gl_SecondaryColor;
+ gl_TexCoord[7] = gl_ModelViewMatrix*vec4(gl_Vertex.xyz, 1.0);
+
+ gl_ClipDistance[0] = dot(clipPlane,vec4(gl_Vertex.xyz, 1.0));
+}
+);
+
+const char *passThroughShader = STRINGIFY(
+
+void main()
+{
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
+
+}
+);
+
+// pixel shader for rendering points as shaded spheres
+const char *fragmentShader = STRINGIFY(
+
+uniform vec3 lightDir;
+uniform vec3 lightPos;
+uniform float spotMin;
+uniform float spotMax;
+uniform vec3 color;
+uniform vec4 fogColor;
+
+uniform sampler2DShadow shadowTex;
+uniform vec2 shadowTaps[12];
+
+uniform sampler2D tex;
+uniform bool sky;
+
+uniform bool grid;
+uniform bool texture;
+
+float sqr(float x) { return x*x; }
+
+// sample shadow map
+float shadowSample()
+{
+ vec3 pos = vec3(gl_TexCoord[1].xyz/gl_TexCoord[1].w);
+ vec3 uvw = (pos.xyz*0.5)+vec3(0.5);
+
+ // user clip
+ if (uvw.x < 0.0 || uvw.x > 1.0)
+ return 1.0;
+ if (uvw.y < 0.0 || uvw.y > 1.0)
+ return 1.0;
+
+ float s = 0.0;
+ float radius = 0.002;
+
+ const int numTaps = 12;
+
+ for (int i=0; i < numTaps; i++)
+ {
+ s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i]*radius, uvw.z)).r;
+ }
+
+ s /= numTaps;
+ return s;
+}
+
+float filterwidth(vec2 v)
+{
+ vec2 fw = max(abs(dFdx(v)), abs(dFdy(v)));
+ return max(fw.x, fw.y);
+}
+
+vec2 bump(vec2 x)
+{
+ return (floor((x)/2) + 2.f * max(((x)/2) - floor((x)/2) - .5f, 0.f));
+}
+
+float checker(vec2 uv)
+{
+ float width = filterwidth(uv);
+ vec2 p0 = uv - 0.5 * width;
+ vec2 p1 = uv + 0.5 * width;
+
+ vec2 i = (bump(p1) - bump(p0)) / width;
+ return i.x * i.y + (1 - i.x) * (1 - i.y);
+}
+
+void main()
+{
+ // calculate lighting
+ float shadow = max(shadowSample(), 0.5);
+
+ vec3 lVec = normalize(gl_TexCoord[3].xyz-(lightPos));
+ vec3 lPos = vec3(gl_TexCoord[1].xyz/gl_TexCoord[1].w);
+ float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05);
+
+ vec3 n = gl_TexCoord[0].xyz;
+ vec3 color = gl_TexCoord[4].xyz;
+
+ if (!gl_FrontFacing)
+ {
+ color = gl_TexCoord[6].xyz;
+ n *= -1.0f;
+ }
+
+ if (grid && (n.y >0.995))
+ {
+ color *= 1.0 - 0.25 * checker(vec2(gl_TexCoord[3].x, gl_TexCoord[3].z));
+ }
+ else if (grid && abs(n.z) > 0.995)
+ {
+ color *= 1.0 - 0.25 * checker(vec2(gl_TexCoord[3].y, gl_TexCoord[3].x));
+ }
+
+ if (texture)
+ {
+ color = texture2D(tex, gl_TexCoord[5].xy).xyz;
+ }
+
+ // direct light term
+ float wrap = 0.0;
+ vec3 diffuse = color*vec3(1.0, 1.0, 1.0)*max(0.0, (-dot(lightDir, n)+wrap)/(1.0+wrap)*shadow)*attenuation;
+
+ // wrap ambient term aligned with light dir
+ vec3 light = vec3(0.03, 0.025, 0.025)*1.5;
+ vec3 dark = vec3(0.025, 0.025, 0.03);
+ vec3 ambient = 4.0*color*mix(dark, light, -dot(lightDir, n)*0.5 + 0.5)*attenuation;
+
+ vec3 fog = mix(vec3(fogColor), diffuse + ambient, exp(gl_TexCoord[7].z*fogColor.w));
+
+ gl_FragColor = vec4(pow(fog, vec3(1.0/2.2)), 1.0);
+}
+);
+
+void ShadowApply(GLint sprogram, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, GLuint shadowTex)
+{
+ GLint uLightTransform = glGetUniformLocation(sprogram, "lightTransform");
+ glUniformMatrix4fv(uLightTransform, 1, false, lightTransform);
+
+ GLint uLightPos = glGetUniformLocation(sprogram, "lightPos");
+ glUniform3fv(uLightPos, 1, lightPos);
+
+ GLint uLightDir = glGetUniformLocation(sprogram, "lightDir");
+ glUniform3fv(uLightDir, 1, Normalize(lightTarget-lightPos));
+
+ GLint uBias = glGetUniformLocation(sprogram, "bias");
+ glUniform1f(uBias, gShadowBias);
+
+ const Vec2 taps[] =
+ {
+ Vec2(-0.326212f,-0.40581f),Vec2(-0.840144f,-0.07358f),
+ Vec2(-0.695914f,0.457137f),Vec2(-0.203345f,0.620716f),
+ Vec2(0.96234f,-0.194983f),Vec2(0.473434f,-0.480026f),
+ Vec2(0.519456f,0.767022f),Vec2(0.185461f,-0.893124f),
+ Vec2(0.507431f,0.064425f),Vec2(0.89642f,0.412458f),
+ Vec2(-0.32194f,-0.932615f),Vec2(-0.791559f,-0.59771f)
+ };
+
+ GLint uShadowTaps = glGetUniformLocation(sprogram, "shadowTaps");
+ glUniform2fv(uShadowTaps, 12, &taps[0].x);
+
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, shadowTex);
+
+}
+
+void DrawPoints(GLuint positions, GLuint colors, GLuint indices, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, bool showDensity)
+{
+ static int sprogram = -1;
+ if (sprogram == -1)
+ {
+ sprogram = CompileProgram(vertexPointShader, fragmentPointShader);
+ }
+
+ if (sprogram)
+ {
+ glEnable(GL_POINT_SPRITE);
+ glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
+ glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+ //glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+
+ int mode = 0;
+ if (showDensity)
+ mode = 1;
+ if (shadowMap == NULL)
+ mode = 2;
+
+ glVerify(glUseProgram(sprogram));
+ glVerify(glUniform1f( glGetUniformLocation(sprogram, "pointRadius"), radius));
+ glVerify(glUniform1f( glGetUniformLocation(sprogram, "pointScale"), screenWidth/screenAspect * (1.0f / (tanf(fov*0.5f)))));
+ glVerify(glUniform1f( glGetUniformLocation(sprogram, "spotMin"), gSpotMin));
+ glVerify(glUniform1f( glGetUniformLocation(sprogram, "spotMax"), gSpotMax));
+ glVerify(glUniform1i( glGetUniformLocation(sprogram, "mode"), mode));
+ glVerify(glUniform4fv( glGetUniformLocation(sprogram, "colors"), 8, (float*)&gColors[0].r));
+
+ // set shadow parameters
+ ShadowApply(sprogram, lightPos, lightTarget, lightTransform, shadowMap->texture);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glBindBuffer(GL_ARRAY_BUFFER, positions);
+ glVertexPointer(4, GL_FLOAT, 0, 0);
+
+ int d = glGetAttribLocation(sprogram, "density");
+ int p = glGetAttribLocation(sprogram, "phase");
+
+ if (d != -1)
+ {
+ glVerify(glEnableVertexAttribArray(d));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, colors));
+ glVerify(glVertexAttribPointer(d, 1, GL_FLOAT, GL_FALSE, 0, 0)); // densities
+ }
+
+ if (p != -1)
+ {
+ glVerify(glEnableVertexAttribArray(p));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, colors));
+ glVerify(glVertexAttribIPointer(p, 1, GL_INT, 0, 0)); // phases
+ }
+
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices));
+
+ glVerify(glDrawElements(GL_POINTS, n, GL_UNSIGNED_INT, (const void*)(offset*sizeof(int))));
+
+ glVerify(glUseProgram(0));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+ glVerify(glDisableClientState(GL_VERTEX_ARRAY));
+
+ if (d != -1)
+ glVerify(glDisableVertexAttribArray(d));
+ if (p != -1)
+ glVerify(glDisableVertexAttribArray(p));
+
+ glDisable(GL_POINT_SPRITE);
+ glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
+ }
+}
+void DrawPlane(const Vec4& p);
+
+static GLuint s_diffuseProgram = GLuint(-1);
+static GLuint s_shadowProgram = GLuint(-1);
+
+#ifdef ANDROID
+void ResetProgramId()
+{
+ s_diffuseProgram = GLuint(-1);
+ s_shadowProgram = GLuint(-1);
+}
+#endif
+
+static const int kShadowResolution = 2048;
+
+ShadowMap* ShadowCreate()
+{
+ GLuint texture;
+ GLuint framebuffer;
+
+ glVerify(glGenFramebuffers(1, &framebuffer));
+ glVerify(glGenTextures(1, &texture));
+ glVerify(glBindTexture(GL_TEXTURE_2D, texture));
+
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+
+ // This is to allow usage of shadow2DProj function in the shader
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY));
+
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, kShadowResolution, kShadowResolution, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL));
+
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, framebuffer));
+
+ glVerify(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texture, 0));
+
+ ShadowMap* map = new ShadowMap();
+ map->texture = texture;
+ map->framebuffer = framebuffer;
+
+ return map;
+
+}
+
+void ShadowDestroy(ShadowMap* map)
+{
+ glVerify(glDeleteTextures(1, &map->texture));
+ glVerify(glDeleteFramebuffers(1, &map->framebuffer));
+
+ delete map;
+}
+
+void ShadowBegin(ShadowMap* map)
+{
+ glEnable(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(8.f, 8.f);
+
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, map->framebuffer));
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_DEPTH_BUFFER_BIT);
+ glViewport(0, 0, kShadowResolution, kShadowResolution);
+
+ // draw back faces (for teapot)
+ glDisable(GL_CULL_FACE);
+
+ // bind shadow shader
+ if (s_shadowProgram == GLuint(-1))
+ s_shadowProgram = CompileProgram(vertexShader, passThroughShader);
+
+ glUseProgram(s_shadowProgram);
+ glVerify(glUniformMatrix4fv(glGetUniformLocation(s_shadowProgram, "objectTransform"), 1, false, Matrix44::kIdentity));
+}
+
+void ShadowEnd()
+{
+ glDisable(GL_POLYGON_OFFSET_FILL);
+
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, g_msaaFbo));
+
+ glEnable(GL_CULL_FACE);
+ glUseProgram(0);
+}
+
+void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor)
+{
+ glVerify(glViewport(0, 0, g_screenWidth, g_screenHeight));
+
+ if (s_diffuseProgram == GLuint(-1))
+ s_diffuseProgram = CompileProgram(vertexShader, fragmentShader);
+
+ if (s_diffuseProgram)
+ {
+ glDepthMask(GL_TRUE);
+ glEnable(GL_DEPTH_TEST);
+
+ glVerify(glUseProgram(s_diffuseProgram));
+ glVerify(glUniform1i(glGetUniformLocation(s_diffuseProgram, "grid"), 0));
+ glVerify(glUniform1f( glGetUniformLocation(s_diffuseProgram, "spotMin"), gSpotMin));
+ glVerify(glUniform1f( glGetUniformLocation(s_diffuseProgram, "spotMax"), gSpotMax));
+ glVerify(glUniform4fv( glGetUniformLocation(s_diffuseProgram, "fogColor"), 1, fogColor));
+
+ glVerify(glUniformMatrix4fv( glGetUniformLocation(s_diffuseProgram, "objectTransform"), 1, false, Matrix44::kIdentity));
+
+ // set shadow parameters
+ ShadowApply(s_diffuseProgram, lightPos, lightTarget, lightTransform, shadowMap->texture);
+ }
+}
+
+void UnbindSolidShader()
+{
+ glActiveTexture(GL_TEXTURE1);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0);
+
+ glUseProgram(0);
+}
+
+void DrawPlanes(Vec4* planes, int n, float bias)
+{
+ // diffuse
+ glColor3f(0.9f, 0.9f, 0.9f);
+
+ GLint uBias = glGetUniformLocation(s_diffuseProgram, "bias");
+ glVerify(glUniform1f(uBias, 0.0f));
+ GLint uGrid = glGetUniformLocation(s_diffuseProgram, "grid");
+ glVerify(glUniform1i(uGrid, 1));
+ GLint uExpand = glGetUniformLocation(s_diffuseProgram, "expand");
+ glVerify(glUniform1f(uExpand, 0.0f));
+
+ for (int i=0; i < n; ++i)
+ {
+ Vec4 p = planes[i];
+ p.w -= bias;
+
+ DrawPlane(p, false);
+ }
+
+ glVerify(glUniform1i(uGrid, 0));
+ glVerify(glUniform1f(uBias, gShadowBias));
+}
+
+void DrawMesh(const Mesh* m, Vec3 color)
+{
+ if (m)
+ {
+ glVerify(glColor3fv(color));
+ glVerify(glSecondaryColor3fv(color));
+
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+
+ glVerify(glEnableClientState(GL_NORMAL_ARRAY));
+ glVerify(glEnableClientState(GL_VERTEX_ARRAY));
+
+ glVerify(glNormalPointer(GL_FLOAT, sizeof(float) * 3, &m->m_normals[0]));
+ glVerify(glVertexPointer(3, GL_FLOAT, sizeof(float) * 3, &m->m_positions[0]));
+
+ if (m->m_colours.size())
+ {
+ glVerify(glEnableClientState(GL_COLOR_ARRAY));
+ glVerify(glColorPointer(4, GL_FLOAT, 0, &m->m_colours[0]));
+ }
+
+ glVerify(glDrawElements(GL_TRIANGLES, m->GetNumFaces() * 3, GL_UNSIGNED_INT, &m->m_indices[0]));
+
+ glVerify(glDisableClientState(GL_VERTEX_ARRAY));
+ glVerify(glDisableClientState(GL_NORMAL_ARRAY));
+
+ if (m->m_colours.size())
+ glVerify(glDisableClientState(GL_COLOR_ARRAY));
+ }
+}
+
+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)
+{
+ if (!numTris)
+ return;
+
+ if (twosided)
+ glDisable(GL_CULL_FACE);
+
+#if 1
+ GLint program;
+ glGetIntegerv(GL_CURRENT_PROGRAM, &program);
+
+ if (program == GLint(s_diffuseProgram))
+ {
+ GLint uBias = glGetUniformLocation(s_diffuseProgram, "bias");
+ glUniform1f(uBias, 0.0f);
+
+ GLint uExpand = glGetUniformLocation(s_diffuseProgram, "expand");
+ glUniform1f(uExpand, expand);
+ }
+#endif
+
+ glColor3fv(gColors[colorIndex+1]*1.5f);
+ glSecondaryColor3fv(gColors[colorIndex]*1.5f);
+
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+
+ glVerify(glEnableClientState(GL_VERTEX_ARRAY));
+ glVerify(glEnableClientState(GL_NORMAL_ARRAY));
+
+ glVerify(glVertexPointer(3, GL_FLOAT, sizeof(float)*4, positions));
+ glVerify(glNormalPointer(GL_FLOAT, sizeof(float)*4, normals));
+
+ glVerify(glDrawElements(GL_TRIANGLES, numTris*3, GL_UNSIGNED_INT, indices));
+
+ glVerify(glDisableClientState(GL_VERTEX_ARRAY));
+ glVerify(glDisableClientState(GL_NORMAL_ARRAY));
+
+ if (twosided)
+ glEnable(GL_CULL_FACE);
+
+#if 1
+ if (program == GLint(s_diffuseProgram))
+ {
+ GLint uBias = glGetUniformLocation(s_diffuseProgram, "bias");
+ glUniform1f(uBias, gShadowBias);
+
+ GLint uExpand = glGetUniformLocation(s_diffuseProgram, "expand");
+ glUniform1f(uExpand, 0.0f);
+ }
+#endif
+}
+
+void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int color)
+{
+ if (numIndices < 2)
+ return;
+
+ std::vector<Vec3> vertices;
+ std::vector<Vec3> normals;
+ std::vector<int> triangles;
+
+ // flatten curve
+ std::vector<Vec3> curve(numIndices);
+ for (int i=0; i < numIndices; ++i)
+ curve[i] = Vec3(positions[indices[i]]);
+
+ const int resolution = 8;
+ const int smoothing = 3;
+
+ vertices.reserve(resolution*numIndices*smoothing);
+ normals.reserve(resolution*numIndices*smoothing);
+ triangles.reserve(numIndices*resolution*6*smoothing);
+
+ Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing);
+
+ glVerify(glDisable(GL_CULL_FACE));
+ glVerify(glColor3fv(gColors[color%8]*1.5f));
+ glVerify(glSecondaryColor3fv(gColors[color%8]*1.5f));
+
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+
+ glVerify(glEnableClientState(GL_VERTEX_ARRAY));
+ glVerify(glEnableClientState(GL_NORMAL_ARRAY));
+
+ glVerify(glVertexPointer(3, GL_FLOAT, sizeof(float)*3, &vertices[0]));
+ glVerify(glNormalPointer(GL_FLOAT, sizeof(float)*3, &normals[0]));
+
+ glVerify(glDrawElements(GL_TRIANGLES, GLsizei(triangles.size()), GL_UNSIGNED_INT, &triangles[0]));
+
+ glVerify(glDisableClientState(GL_VERTEX_ARRAY));
+ glVerify(glDisableClientState(GL_NORMAL_ARRAY));
+ glVerify(glEnable(GL_CULL_FACE));
+
+}
+
+
+struct ReflectMap
+{
+ GLuint texture;
+
+ int width;
+ int height;
+};
+
+ReflectMap* ReflectCreate(int width, int height)
+{
+ GLuint texture;
+
+ // copy frame buffer to texture
+ glVerify(glActiveTexture(GL_TEXTURE0));
+ glVerify(glEnable(GL_TEXTURE_2D));
+
+ glVerify(glGenTextures(1, &texture));
+ glVerify(glBindTexture(GL_TEXTURE_2D, texture));
+
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
+
+ ReflectMap* map = new ReflectMap();
+ map->texture = texture;
+ map->width = width;
+ map->height = height;
+
+ return map;
+}
+
+void ReflectDestroy(ReflectMap* map)
+{
+ glVerify(glDeleteTextures(1, &map->texture));
+
+ delete map;
+}
+
+void ReflectBegin(ReflectMap* map, Vec4 plane, int width, int height)
+{
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glViewport(0, 0, width, height);
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ Matrix44 scale = Matrix44::kIdentity;
+ scale.columns[0][0] *= -2.0f;
+ scale.columns[1][1] *= -2.0f;
+ scale.columns[2][2] *= -2.0f;
+ scale.columns[3][3] *= -2.0f;
+
+ Matrix44 reflect = (scale*Outer(Vec4(plane.x, plane.y, plane.z, 0.0f), plane));
+ reflect.columns[0][0] += 1.0f;
+ reflect.columns[1][1] += 1.0f;
+ reflect.columns[2][2] += 1.0f;
+ reflect.columns[3][3] += 1.0f;
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glMultMatrixf(reflect);
+
+ glVerify(glFrontFace(GL_CW));
+ glVerify(glEnable(GL_CLIP_PLANE0));
+
+ glVerify(glUniform4fv( glGetUniformLocation(s_diffuseProgram, "clipPlane"), 1, plane));
+}
+
+void ReflectEnd(ReflectMap* map, int width, int height)
+{
+ // copy frame buffer to texture
+ glVerify(glActiveTexture(GL_TEXTURE0));
+ glVerify(glEnable(GL_TEXTURE_2D));
+ glVerify(glBindTexture(GL_TEXTURE_2D, map->texture));
+
+ glVerify(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height));
+
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+
+ glVerify(glDisable(GL_CLIP_PLANE0));
+ glVerify(glFrontFace(GL_CCW));
+
+ glBindFramebuffer(GL_FRAMEBUFFER, g_msaaFbo);
+
+ glViewport(0, 0, g_screenWidth, g_screenHeight);
+}
+
+
+//-----------------------------------------------------------------------------------------------------
+// vertex shader
+
+const char *vertexPointDepthShader = STRINGIFY(
+
+uniform float pointRadius; // point size in world space
+uniform float pointScale; // scale to calculate size in pixels
+
+void main()
+{
+ // calculate window-space point size
+ gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
+ gl_PointSize = pointScale * (pointRadius / gl_Position.w);
+
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[1] = gl_ModelViewMatrix * vec4(gl_Vertex.xyz, 1.0);
+}
+);
+
+// pixel shader for rendering points as shaded spheres
+const char *fragmentPointDepthShader = STRINGIFY(
+
+uniform float pointRadius; // point size in world space
+
+void main()
+{
+ // calculate normal from texture coordinates
+ vec3 normal;
+ normal.xy = gl_TexCoord[0].xy*vec2(2.0, -2.0) + vec2(-1.0, 1.0);
+ float mag = dot(normal.xy, normal.xy);
+ if (mag > 1.0) discard; // kill pixels outside circle
+ normal.z = sqrt(1.0-mag);
+
+ vec3 eyePos = gl_TexCoord[1].xyz + normal*pointRadius*2.0;
+ vec4 ndcPos = gl_ProjectionMatrix * vec4(eyePos, 1.0);
+ ndcPos.z /= ndcPos.w;
+
+ gl_FragColor = vec4(eyePos.z, 1.0, 1.0, 1.0);
+ gl_FragDepth = ndcPos.z*0.5 + 0.5;
+}
+);
+
+
+// pixel shader for rendering points density
+const char *fragmentPointThicknessShader = STRINGIFY(
+
+void main()
+{
+ // calculate normal from texture coordinates
+ vec3 normal;
+ normal.xy = gl_TexCoord[0].xy*vec2(2.0, -2.0) + vec2(-1.0, 1.0);
+ float mag = dot(normal.xy, normal.xy);
+ if (mag > 1.0) discard; // kill pixels outside circle
+ normal.z = sqrt(1.0-mag);
+
+ gl_FragColor = vec4(normal.z*0.005);
+}
+);
+
+//--------------------------------------------------------
+// Ellipsoid shaders
+//
+const char *vertexEllipsoidDepthShader = "#version 120\n" STRINGIFY(
+
+// rotation matrix in xyz, scale in w
+attribute vec4 q1;
+attribute vec4 q2;
+attribute vec4 q3;
+
+// returns 1.0 for x==0.0 (unlike glsl)
+float Sign(float x) { return x < 0.0 ? -1.0: 1.0; }
+
+bool solveQuadratic(float a, float b, float c, out float minT, out float maxT)
+{
+ if (a == 0.0 && b == 0.0)
+ {
+ minT = maxT = 0.0;
+ return false;
+ }
+
+ float discriminant = b*b - 4.0*a*c;
+
+ if (discriminant < 0.0)
+ {
+ return false;
+ }
+
+ float t = -0.5*(b + Sign(b)*sqrt(discriminant));
+ minT = t / a;
+ maxT = c / t;
+
+ if (minT > maxT)
+ {
+ float tmp = minT;
+ minT = maxT;
+ maxT = tmp;
+ }
+
+ return true;
+}
+
+float DotInvW(vec4 a, vec4 b) { return a.x*b.x + a.y*b.y + a.z*b.z - a.w*b.w; }
+
+void main()
+{
+ vec3 worldPos = gl_Vertex.xyz;// - vec3(0.0, 0.1*0.25, 0.0); // hack move towards ground to account for anisotropy
+
+ // construct quadric matrix
+ mat4 q;
+ q[0] = vec4(q1.xyz*q1.w, 0.0);
+ q[1] = vec4(q2.xyz*q2.w, 0.0);
+ q[2] = vec4(q3.xyz*q3.w, 0.0);
+ q[3] = vec4(worldPos, 1.0);
+
+ // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T)
+ mat4 invClip = transpose(gl_ModelViewProjectionMatrix*q);
+
+ // solve for the right hand bounds in homogenous clip space
+ float a1 = DotInvW(invClip[3], invClip[3]);
+ float b1 = -2.0f*DotInvW(invClip[0], invClip[3]);
+ float c1 = DotInvW(invClip[0], invClip[0]);
+
+ float xmin;
+ float xmax;
+ solveQuadratic(a1, b1, c1, xmin, xmax);
+
+ // solve for the right hand bounds in homogenous clip space
+ float a2 = DotInvW(invClip[3], invClip[3]);
+ float b2 = -2.0f*DotInvW(invClip[1], invClip[3]);
+ float c2 = DotInvW(invClip[1], invClip[1]);
+
+ float ymin;
+ float ymax;
+ solveQuadratic(a2, b2, c2, ymin, ymax);
+
+ gl_Position = vec4(worldPos.xyz, 1.0);
+ gl_TexCoord[0] = vec4(xmin, xmax, ymin, ymax);
+
+ // construct inverse quadric matrix (used for ray-casting in parameter space)
+ mat4 invq;
+ invq[0] = vec4(q1.xyz/q1.w, 0.0);
+ invq[1] = vec4(q2.xyz/q2.w, 0.0);
+ invq[2] = vec4(q3.xyz/q3.w, 0.0);
+ invq[3] = vec4(0.0, 0.0, 0.0, 1.0);
+
+ invq = transpose(invq);
+ invq[3] = -(invq*gl_Position);
+
+ // transform a point from view space to parameter space
+ invq = invq*gl_ModelViewMatrixInverse;
+
+ // pass down
+ gl_TexCoord[1] = invq[0];
+ gl_TexCoord[2] = invq[1];
+ gl_TexCoord[3] = invq[2];
+ gl_TexCoord[4] = invq[3];
+
+ // compute ndc pos for frustrum culling in GS
+ vec4 ndcPos = gl_ModelViewProjectionMatrix * vec4(worldPos.xyz, 1.0);
+ gl_TexCoord[5] = ndcPos / ndcPos.w;
+}
+);
+
+const char* geometryEllipsoidDepthShader =
+"#version 120\n"
+"#extension GL_EXT_geometry_shader4 : enable\n"
+STRINGIFY(
+void main()
+{
+ vec3 pos = gl_PositionIn[0].xyz;
+ vec4 bounds = gl_TexCoordIn[0][0];
+ vec4 ndcPos = gl_TexCoordIn[0][5];
+
+ // frustrum culling
+ const float ndcBound = 1.0;
+ if (ndcPos.x < -ndcBound) return;
+ if (ndcPos.x > ndcBound) return;
+ if (ndcPos.y < -ndcBound) return;
+ if (ndcPos.y > ndcBound) return;
+
+ float xmin = bounds.x;
+ float xmax = bounds.y;
+ float ymin = bounds.z;
+ float ymax = bounds.w;
+
+ // inv quadric transform
+ gl_TexCoord[0] = gl_TexCoordIn[0][1];
+ gl_TexCoord[1] = gl_TexCoordIn[0][2];
+ gl_TexCoord[2] = gl_TexCoordIn[0][3];
+ gl_TexCoord[3] = gl_TexCoordIn[0][4];
+
+ gl_Position = vec4(xmin, ymax, 0.0, 1.0);
+ EmitVertex();
+
+ gl_Position = vec4(xmin, ymin, 0.0, 1.0);
+ EmitVertex();
+
+ gl_Position = vec4(xmax, ymax, 0.0, 1.0);
+ EmitVertex();
+
+ gl_Position = vec4(xmax, ymin, 0.0, 1.0);
+ EmitVertex();
+}
+);
+
+// pixel shader for rendering points as shaded spheres
+const char *fragmentEllipsoidDepthShader = "#version 120\n" STRINGIFY(
+
+uniform vec3 invViewport;
+uniform vec3 invProjection;
+
+float Sign(float x) { return x < 0.0 ? -1.0: 1.0; }
+
+bool solveQuadratic(float a, float b, float c, out float minT, out float maxT)
+{
+ if (a == 0.0 && b == 0.0)
+ {
+ minT = maxT = 0.0;
+ return true;
+ }
+
+ float discriminant = b*b - 4.0*a*c;
+
+ if (discriminant < 0.0)
+ {
+ return false;
+ }
+
+ float t = -0.5*(b + Sign(b)*sqrt(discriminant));
+ minT = t / a;
+ maxT = c / t;
+
+ if (minT > maxT)
+ {
+ float tmp = minT;
+ minT = maxT;
+ maxT = tmp;
+ }
+
+ return true;
+}
+
+float sqr(float x) { return x*x; }
+
+void main()
+{
+ // transform from view space to parameter space
+ mat4 invQuadric;
+ invQuadric[0] = gl_TexCoord[0];
+ invQuadric[1] = gl_TexCoord[1];
+ invQuadric[2] = gl_TexCoord[2];
+ invQuadric[3] = gl_TexCoord[3];
+
+ vec4 ndcPos = vec4(gl_FragCoord.xy*invViewport.xy*vec2(2.0, 2.0) - vec2(1.0, 1.0), -1.0, 1.0);
+ vec4 viewDir = gl_ProjectionMatrixInverse*ndcPos;
+
+ // ray to parameter space
+ vec4 dir = invQuadric*vec4(viewDir.xyz, 0.0);
+ vec4 origin = invQuadric[3];
+
+ // set up quadratric equation
+ float a = sqr(dir.x) + sqr(dir.y) + sqr(dir.z);// - sqr(dir.w);
+ float b = dir.x*origin.x + dir.y*origin.y + dir.z*origin.z - dir.w*origin.w;
+ float c = sqr(origin.x) + sqr(origin.y) + sqr(origin.z) - sqr(origin.w);
+
+ float minT;
+ float maxT;
+
+ if (solveQuadratic(a, 2.0*b, c, minT, maxT))
+ {
+ vec3 eyePos = viewDir.xyz*minT;
+ vec4 ndcPos = gl_ProjectionMatrix * vec4(eyePos, 1.0);
+ ndcPos.z /= ndcPos.w;
+
+ gl_FragColor = vec4(eyePos.z, 1.0, 1.0, 1.0);
+ gl_FragDepth = ndcPos.z*0.5 + 0.5;
+
+ return;
+ }
+ else
+ discard;
+
+ gl_FragColor = vec4(0.5, 0.0, 0.0, 1.0);
+}
+);
+
+//--------------------------------------------------------------------------------
+// Composite shaders
+
+const char* vertexPassThroughShader = STRINGIFY(
+
+void main()
+{
+ gl_Position = vec4(gl_Vertex.xyz, 1.0);
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+}
+);
+
+const char* fragmentBlurDepthShader =
+"#extension GL_ARB_texture_rectangle : enable\n"
+STRINGIFY(
+
+uniform sampler2DRect depthTex;
+uniform sampler2D thicknessTex;
+uniform float blurRadiusWorld;
+uniform float blurScale;
+uniform float blurFalloff;
+uniform vec2 invTexScale;
+
+uniform bool debug;
+
+float sqr(float x) { return x*x; }
+
+void main()
+{
+ // eye-space depth of center sample
+ float depth = texture2DRect(depthTex, gl_FragCoord.xy).x;
+ float thickness = texture2D(thicknessTex, gl_TexCoord[0].xy).x;
+
+ // hack: ENABLE_SIMPLE_FLUID
+ //thickness = 0.0f;
+
+ if (debug)
+ {
+ // do not blur
+ gl_FragColor.x = depth;
+ return;
+ }
+
+ // threshold on thickness to create nice smooth silhouettes
+ if (depth == 0.0)//|| thickness < 0.02f)
+ {
+ gl_FragColor.x = 0.0;
+ return;
+ }
+
+ /*
+ float dzdx = dFdx(depth);
+ float dzdy = dFdy(depth);
+
+ // handle edge case
+ if (max(abs(dzdx), abs(dzdy)) > 0.05)
+ {
+ dzdx = 0.0;
+ dzdy = 0.0;
+
+ gl_FragColor.x = depth;
+ return;
+ }
+ */
+
+ float blurDepthFalloff = 5.5;//blurFalloff*mix(4.0, 1.0, thickness)/blurRadiusWorld*0.0375; // these constants are just a re-scaling from some known good values
+
+ float maxBlurRadius = 5.0;
+ //float taps = min(maxBlurRadius, blurScale * (blurRadiusWorld / -depth));
+ //vec2 blurRadius = min(mix(0.25, 2.0/blurFalloff, thickness) * blurScale * (blurRadiusWorld / -depth) / taps, 0.15)*invTexScale;
+
+ //discontinuities between different tap counts are visible. to avoid this we
+ //use fractional contributions between #taps = ceil(radius) and floor(radius)
+ float radius = min(maxBlurRadius, blurScale * (blurRadiusWorld / -depth));
+ float radiusInv = 1.0/radius;
+ float taps = ceil(radius);
+ float frac = taps - radius;
+
+ float sum = 0.0;
+ float wsum = 0.0;
+ float count = 0.0;
+
+ for(float y=-taps; y <= taps; y += 1.0)
+ {
+ for(float x=-taps; x <= taps; x += 1.0)
+ {
+ vec2 offset = vec2(x, y);
+
+ float sample = texture2DRect(depthTex, gl_FragCoord.xy + offset).x;
+
+ if (sample < -10000.0*0.5)
+ continue;
+
+ // spatial domain
+ float r1 = length(vec2(x, y))*radiusInv;
+ float w = exp(-(r1*r1));
+
+ //float expectedDepth = depth + dot(vec2(dzdx, dzdy), offset);
+
+ // range domain (based on depth difference)
+ float r2 = (sample - depth) * blurDepthFalloff;
+ float g = exp(-(r2*r2));
+
+ //fractional radius contributions
+ float wBoundary = step(radius, max(abs(x), abs(y)));
+ float wFrac = 1.0 - wBoundary*frac;
+
+ sum += sample * w * g * wFrac;
+ wsum += w * g * wFrac;
+ count += g * wFrac;
+ }
+ }
+
+ if (wsum > 0.0) {
+ sum /= wsum;
+ }
+
+ float blend = count/sqr(2.0*radius+1.0);
+ gl_FragColor.x = mix(depth, sum, blend);
+}
+);
+
+const char* fragmentCompositeShader = STRINGIFY(
+
+uniform sampler2D tex;
+uniform vec2 invTexScale;
+uniform vec3 lightPos;
+uniform vec3 lightDir;
+uniform float spotMin;
+uniform float spotMax;
+uniform vec4 color;
+uniform float ior;
+
+uniform vec2 clipPosToEye;
+
+uniform sampler2D reflectTex;
+uniform sampler2DShadow shadowTex;
+uniform vec2 shadowTaps[12];
+uniform mat4 lightTransform;
+
+uniform sampler2D thicknessTex;
+uniform sampler2D sceneTex;
+
+uniform bool debug;
+
+// sample shadow map
+float shadowSample(vec3 worldPos, out float attenuation)
+{
+ // hack: ENABLE_SIMPLE_FLUID
+ //attenuation = 0.0f;
+ //return 0.5;
+
+ vec4 pos = lightTransform*vec4(worldPos+lightDir*0.15, 1.0);
+ pos /= pos.w;
+ vec3 uvw = (pos.xyz*0.5)+vec3(0.5);
+
+ attenuation = max(smoothstep(spotMax, spotMin, dot(pos.xy, pos.xy)), 0.05);
+
+ // user clip
+ if (uvw.x < 0.0 || uvw.x > 1.0)
+ return 1.0;
+ if (uvw.y < 0.0 || uvw.y > 1.0)
+ return 1.0;
+
+ float s = 0.0;
+ float radius = 0.002;
+
+ for (int i=0; i < 8; i++)
+ {
+ s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i]*radius, uvw.z)).r;
+ }
+
+ s /= 8.0;
+ return s;
+}
+
+vec3 viewportToEyeSpace(vec2 coord, float eyeZ)
+{
+ // find position at z=1 plane
+ vec2 uv = (coord*2.0 - vec2(1.0))*clipPosToEye;
+
+ return vec3(-uv*eyeZ, eyeZ);
+}
+
+vec3 srgbToLinear(vec3 c) { return pow(c, vec3(2.2)); }
+vec3 linearToSrgb(vec3 c) { return pow(c, vec3(1.0/2.2)); }
+
+float sqr(float x) { return x*x; }
+float cube(float x) { return x*x*x; }
+
+void main()
+{
+ float eyeZ = texture2D(tex, gl_TexCoord[0].xy).x;
+
+ if (eyeZ == 0.0)
+ discard;
+
+ // reconstruct eye space pos from depth
+ vec3 eyePos = viewportToEyeSpace(gl_TexCoord[0].xy, eyeZ);
+
+ // finite difference approx for normals, can't take dFdx because
+ // the one-sided difference is incorrect at shape boundaries
+ vec3 zl = eyePos - viewportToEyeSpace(gl_TexCoord[0].xy - vec2(invTexScale.x, 0.0), texture2D(tex, gl_TexCoord[0].xy - vec2(invTexScale.x, 0.0)).x);
+ vec3 zr = viewportToEyeSpace(gl_TexCoord[0].xy + vec2(invTexScale.x, 0.0), texture2D(tex, gl_TexCoord[0].xy + vec2(invTexScale.x, 0.0)).x) - eyePos;
+ vec3 zt = viewportToEyeSpace(gl_TexCoord[0].xy + vec2(0.0, invTexScale.y), texture2D(tex, gl_TexCoord[0].xy + vec2(0.0, invTexScale.y)).x) - eyePos;
+ vec3 zb = eyePos - viewportToEyeSpace(gl_TexCoord[0].xy - vec2(0.0, invTexScale.y), texture2D(tex, gl_TexCoord[0].xy - vec2(0.0, invTexScale.y)).x);
+
+ vec3 dx = zl;
+ vec3 dy = zt;
+
+ if (abs(zr.z) < abs(zl.z))
+ dx = zr;
+
+ if (abs(zb.z) < abs(zt.z))
+ dy = zb;
+
+ //vec3 dx = dFdx(eyePos.xyz);
+ //vec3 dy = dFdy(eyePos.xyz);
+
+ vec4 worldPos = gl_ModelViewMatrixInverse*vec4(eyePos, 1.0);
+
+ float attenuation;
+ float shadow = shadowSample(worldPos.xyz, attenuation);
+
+ vec3 l = (gl_ModelViewMatrix*vec4(lightDir, 0.0)).xyz;
+ vec3 v = -normalize(eyePos);
+
+ vec3 n = normalize(cross(dx, dy));
+ vec3 h = normalize(v + l);
+
+ vec3 skyColor = vec3(0.1, 0.2, 0.4)*1.2;
+ vec3 groundColor = vec3(0.1, 0.1, 0.2);
+
+ float fresnel = 0.1 + (1.0 - 0.1)*cube(1.0-max(dot(n, v), 0.0));
+
+ vec3 lVec = normalize(worldPos.xyz-lightPos);
+
+ float ln = dot(l, n)*attenuation;
+
+ vec3 rEye = reflect(-v, n).xyz;
+ vec3 rWorld = (gl_ModelViewMatrixInverse*vec4(rEye, 0.0)).xyz;
+
+ vec2 texScale = vec2(0.75, 1.0); // to account for backbuffer aspect ratio (todo: pass in)
+
+ float refractScale = ior*0.025;
+ float reflectScale = ior*0.1;
+
+ // attenuate refraction near ground (hack)
+ refractScale *= smoothstep(0.1, 0.4, worldPos.y);
+
+ vec2 refractCoord = gl_TexCoord[0].xy + n.xy*refractScale*texScale;
+ //vec2 refractCoord = gl_TexCoord[0].xy + refract(-v, n, 1.0/1.33)*refractScale*texScale;
+
+ // read thickness from refracted coordinate otherwise we get halos around objectsw
+ float thickness = max(texture2D(thicknessTex, refractCoord).x, 0.3);
+
+ //vec3 transmission = exp(-(vec3(1.0)-color.xyz)*thickness);
+ vec3 transmission = (1.0-(1.0-color.xyz)*thickness*0.8)*color.w;
+ vec3 refract = texture2D(sceneTex, refractCoord).xyz*transmission;
+
+ vec2 sceneReflectCoord = gl_TexCoord[0].xy - rEye.xy*texScale*reflectScale/eyePos.z;
+ vec3 sceneReflect = (texture2D(sceneTex, sceneReflectCoord).xyz)*shadow;
+
+ vec3 planarReflect = texture2D(reflectTex, gl_TexCoord[0].xy).xyz;
+ planarReflect = vec3(0.0);
+
+ // fade out planar reflections above the ground
+ vec3 reflect = mix(planarReflect, sceneReflect, smoothstep(0.05, 0.3, worldPos.y)) + mix(groundColor, skyColor, smoothstep(0.15, 0.25, rWorld.y)*shadow);
+
+ // lighting
+ vec3 diffuse = color.xyz*mix(vec3(0.29, 0.379, 0.59), vec3(1.0), (ln*0.5 + 0.5)*max(shadow, 0.4))*(1.0-color.w);
+ vec3 specular = vec3(1.2*pow(max(dot(h, n), 0.0), 400.0));
+
+ gl_FragColor.xyz = diffuse + (mix(refract, reflect, fresnel) + specular)*color.w;
+ gl_FragColor.w = 1.0;
+
+ if (debug)
+ gl_FragColor = vec4(n*0.5 + vec3(0.5), 1.0);
+
+ // write valid z
+ vec4 clipPos = gl_ProjectionMatrix*vec4(0.0, 0.0, eyeZ, 1.0);
+ clipPos.z /= clipPos.w;
+
+ gl_FragDepth = clipPos.z*0.5 + 0.5;
+}
+);
+
+
+struct FluidRenderer
+{
+ GLuint mDepthFbo;
+ GLuint mDepthTex;
+ GLuint mDepthSmoothTex;
+ GLuint mSceneFbo;
+ GLuint mSceneTex;
+ GLuint mReflectTex;
+
+ GLuint mThicknessFbo;
+ GLuint mThicknessTex;
+
+ GLuint mPointThicknessProgram;
+ //GLuint mPointDepthProgram;
+
+ GLuint mEllipsoidThicknessProgram;
+ GLuint mEllipsoidDepthProgram;
+
+ GLuint mCompositeProgram;
+ GLuint mDepthBlurProgram;
+
+ int mSceneWidth;
+ int mSceneHeight;
+};
+
+FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height)
+{
+ FluidRenderer* renderer = new FluidRenderer();
+
+ renderer->mSceneWidth = width;
+ renderer->mSceneHeight = height;
+
+ // scene depth texture
+ glVerify(glGenTextures(1, &renderer->mDepthTex));
+ glVerify(glBindTexture(GL_TEXTURE_RECTANGLE_ARB, renderer->mDepthTex));
+
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+ glVerify(glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_LUMINANCE32F_ARB, width, height, 0, GL_LUMINANCE, GL_FLOAT, NULL));
+
+ // smoothed depth texture
+ glVerify(glGenTextures(1, &renderer->mDepthSmoothTex));
+ glVerify(glBindTexture(GL_TEXTURE_2D, renderer->mDepthSmoothTex));
+
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE32F_ARB, width, height, 0, GL_LUMINANCE, GL_FLOAT, NULL));
+
+ // scene copy
+ glVerify(glGenTextures(1, &renderer->mSceneTex));
+ glVerify(glBindTexture(GL_TEXTURE_2D, renderer->mSceneTex));
+
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
+
+ glVerify(glGenFramebuffers(1, &renderer->mSceneFbo));
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, renderer->mSceneFbo));
+ glVerify(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, renderer->mSceneTex, 0));
+
+ // frame buffer
+ glVerify(glGenFramebuffers(1, &renderer->mDepthFbo));
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, renderer->mDepthFbo));
+ glVerify(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, renderer->mDepthTex, 0));
+
+ GLuint zbuffer;
+ glVerify(glGenRenderbuffers(1, &zbuffer));
+ glVerify(glBindRenderbuffer(GL_RENDERBUFFER, zbuffer));
+ glVerify(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height));
+ glVerify(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, zbuffer));
+
+ glVerify(glDrawBuffer(GL_COLOR_ATTACHMENT0));
+ glVerify(glReadBuffer(GL_COLOR_ATTACHMENT0));
+
+ glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ glBindFramebuffer(GL_FRAMEBUFFER, g_msaaFbo);
+
+ // reflect texture
+ glVerify(glGenTextures(1, &renderer->mReflectTex));
+ glVerify(glBindTexture(GL_TEXTURE_2D, renderer->mReflectTex));
+
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
+
+ // thickness texture
+ const int thicknessWidth = width;
+ const int thicknessHeight = height;
+
+ glVerify(glGenTextures(1, &renderer->mThicknessTex));
+ glVerify(glBindTexture(GL_TEXTURE_2D, renderer->mThicknessTex));
+
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+
+#if USE_HDR_DIFFUSE_BLEND
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, thicknessWidth, thicknessHeight, 0, GL_RGBA, GL_FLOAT, NULL));
+#else
+ glVerify(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, thicknessWidth, thicknessHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
+#endif
+
+ // thickness buffer
+ glVerify(glGenFramebuffers(1, &renderer->mThicknessFbo));
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, renderer->mThicknessFbo));
+ glVerify(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, renderer->mThicknessTex, 0));
+
+ GLuint thickz;
+ glVerify(glGenRenderbuffers(1, &thickz));
+ glVerify(glBindRenderbuffer(GL_RENDERBUFFER, thickz));
+ glVerify(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, thicknessWidth, thicknessHeight));
+ glVerify(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, thickz));
+
+ glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ glBindFramebuffer(GL_FRAMEBUFFER, g_msaaFbo);
+
+ // compile shaders
+ //renderer->mPointDepthProgram = CompileProgram(vertexPointDepthShader, fragmentPointDepthShader);
+ renderer->mPointThicknessProgram = CompileProgram(vertexPointDepthShader, fragmentPointThicknessShader);
+
+ //renderer->mEllipsoidThicknessProgram = CompileProgram(vertexEllipsoidDepthShader, fragmentEllipsoidThicknessShader);
+ renderer->mEllipsoidDepthProgram = CompileProgram(vertexEllipsoidDepthShader, fragmentEllipsoidDepthShader, geometryEllipsoidDepthShader);
+
+ renderer->mCompositeProgram = CompileProgram(vertexPassThroughShader, fragmentCompositeShader);
+ renderer->mDepthBlurProgram = CompileProgram(vertexPassThroughShader, fragmentBlurDepthShader);
+
+ return renderer;
+}
+
+void DestroyFluidRenderer(FluidRenderer* renderer)
+{
+ glVerify(glDeleteFramebuffers(1, &renderer->mSceneFbo));
+ glVerify(glDeleteFramebuffers(1, &renderer->mDepthFbo));
+ glVerify(glDeleteTextures(1, &renderer->mDepthTex));
+ glVerify(glDeleteTextures(1, &renderer->mDepthSmoothTex));
+ glVerify(glDeleteTextures(1, &renderer->mSceneTex));
+
+ glVerify(glDeleteFramebuffers(1, &renderer->mThicknessFbo));
+ glVerify(glDeleteTextures(1, &renderer->mThicknessTex));
+}
+
+FluidRenderBuffers CreateFluidRenderBuffers(int numFluidParticles, bool enableInterop)
+{
+ FluidRenderBuffers buffers = {};
+ buffers.mNumFluidParticles = numFluidParticles;
+
+ // vbos
+ glVerify(glGenBuffers(1, &buffers.mPositionVBO));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO));
+ glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numFluidParticles, 0, GL_DYNAMIC_DRAW));
+
+ // density
+ glVerify(glGenBuffers(1, &buffers.mDensityVBO));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDensityVBO));
+ glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(int)*numFluidParticles, 0, GL_DYNAMIC_DRAW));
+
+ for (int i = 0; i < 3; ++i)
+ {
+ glVerify(glGenBuffers(1, &buffers.mAnisotropyVBO[i]));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[i]));
+ glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numFluidParticles, 0, GL_DYNAMIC_DRAW));
+ }
+
+ glVerify(glGenBuffers(1, &buffers.mIndices));
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mIndices));
+ glVerify(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int)*numFluidParticles, 0, GL_DYNAMIC_DRAW));
+
+ if (enableInterop)
+ {
+ extern NvFlexLibrary* g_flexLib;
+
+ buffers.mPositionBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mPositionVBO, numFluidParticles, sizeof(Vec4));
+ buffers.mDensitiesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDensityVBO, numFluidParticles, sizeof(float));
+ buffers.mIndicesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mIndices, numFluidParticles, sizeof(int));
+
+ buffers.mAnisotropyBuf[0] = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mAnisotropyVBO[0], numFluidParticles, sizeof(Vec4));
+ buffers.mAnisotropyBuf[1] = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mAnisotropyVBO[1], numFluidParticles, sizeof(Vec4));
+ buffers.mAnisotropyBuf[2] = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mAnisotropyVBO[2], numFluidParticles, sizeof(Vec4));
+ }
+
+ return buffers;
+}
+
+void DestroyFluidRenderBuffers(FluidRenderBuffers buffers)
+{
+ glDeleteBuffers(1, &buffers.mPositionVBO);
+ glDeleteBuffers(3, buffers.mAnisotropyVBO);
+ glDeleteBuffers(1, &buffers.mDensityVBO);
+ glDeleteBuffers(1, &buffers.mIndices);
+
+ NvFlexUnregisterOGLBuffer(buffers.mPositionBuf);
+ NvFlexUnregisterOGLBuffer(buffers.mDensitiesBuf);
+ NvFlexUnregisterOGLBuffer(buffers.mIndicesBuf);
+
+ NvFlexUnregisterOGLBuffer(buffers.mAnisotropyBuf[0]);
+ NvFlexUnregisterOGLBuffer(buffers.mAnisotropyBuf[1]);
+ NvFlexUnregisterOGLBuffer(buffers.mAnisotropyBuf[2]);
+}
+
+void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, NvFlexSolver* solver, bool anisotropy, bool density)
+{
+ // use VBO buffer wrappers to allow Flex to write directly to the OpenGL buffers
+ // Flex will take care of any CUDA interop mapping/unmapping during the get() operations
+ if (!anisotropy)
+ {
+ // regular particles
+ NvFlexGetParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles);
+ }
+ else
+ {
+ // fluid buffers
+ NvFlexGetSmoothParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles);
+ NvFlexGetAnisotropy(solver, buffers.mAnisotropyBuf[0], buffers.mAnisotropyBuf[1], buffers.mAnisotropyBuf[2]);
+ }
+
+ if (density)
+ {
+ NvFlexGetDensities(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles);
+ }
+ else
+ {
+ NvFlexGetPhases(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles);
+ }
+
+ NvFlexGetActive(solver, buffers.mIndicesBuf);
+}
+
+void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices)
+{
+ // regular particles
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO));
+ glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), particles));
+
+ if (anisotropy1)
+ {
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[0]));
+ glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), anisotropy1));
+ }
+
+ if (anisotropy2)
+ {
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[1]));
+ glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), anisotropy2));
+ }
+
+ if (anisotropy3)
+ {
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[2]));
+ glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(Vec4), anisotropy3));
+ }
+
+ // density /phase buffer
+ if (densities)
+ {
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDensityVBO));
+ glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumFluidParticles*sizeof(float), densities));
+ }
+
+ if (indices)
+ {
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mIndices));
+ glVerify(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, numIndices*sizeof(int), indices));
+ }
+
+ // reset
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+
+}
+
+DiffuseRenderBuffers CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop)
+{
+ DiffuseRenderBuffers buffers = {};
+ buffers.mNumDiffuseParticles = numDiffuseParticles;
+
+ if (numDiffuseParticles > 0)
+ {
+ glVerify(glGenBuffers(1, &buffers.mDiffusePositionVBO));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffusePositionVBO));
+ glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numDiffuseParticles, 0, GL_DYNAMIC_DRAW));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+
+ glVerify(glGenBuffers(1, &buffers.mDiffuseVelocityVBO));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffuseVelocityVBO));
+ glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * numDiffuseParticles, 0, GL_DYNAMIC_DRAW));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+
+ glVerify(glGenBuffers(1, &buffers.mDiffuseIndicesIBO));
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mDiffuseIndicesIBO));
+ glVerify(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int)*numDiffuseParticles, 0, GL_DYNAMIC_DRAW));
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+
+ if (enableInterop)
+ {
+ extern NvFlexLibrary* g_flexLib;
+
+ buffers.mDiffuseIndicesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDiffuseIndicesIBO, numDiffuseParticles, sizeof(int));
+ buffers.mDiffusePositionsBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDiffusePositionVBO, numDiffuseParticles, sizeof(Vec4));
+ buffers.mDiffuseVelocitiesBuf = NvFlexRegisterOGLBuffer(g_flexLib, buffers.mDiffuseVelocityVBO, numDiffuseParticles, sizeof(Vec4));
+ }
+ }
+
+ return buffers;
+}
+
+void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers buffers)
+{
+ if (buffers.mNumDiffuseParticles > 0)
+ {
+ glDeleteBuffers(1, &buffers.mDiffusePositionVBO);
+ glDeleteBuffers(1, &buffers.mDiffuseVelocityVBO);
+ glDeleteBuffers(1, &buffers.mDiffuseIndicesIBO);
+
+ NvFlexUnregisterOGLBuffer(buffers.mDiffuseIndicesBuf);
+ NvFlexUnregisterOGLBuffer(buffers.mDiffusePositionsBuf);
+ NvFlexUnregisterOGLBuffer(buffers.mDiffuseVelocitiesBuf);
+ }
+}
+
+void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, NvFlexSolver* solver)
+{
+ // diffuse particles
+ if (buffers.mNumDiffuseParticles)
+ {
+ NvFlexGetDiffuseParticles(solver, buffers.mDiffusePositionsBuf, buffers.mDiffuseVelocitiesBuf, buffers.mDiffuseIndicesBuf);
+ }
+}
+
+void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int* diffuseIndices, int numDiffuseParticles)
+{
+ // diffuse particles
+ if (buffers.mNumDiffuseParticles)
+ {
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mDiffuseIndicesIBO));
+ glVerify(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, buffers.mNumDiffuseParticles*sizeof(int), diffuseIndices));
+
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffusePositionVBO));
+ glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumDiffuseParticles*sizeof(Vec4), diffusePositions));
+
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffuseVelocityVBO));
+ glVerify(glBufferSubData(GL_ARRAY_BUFFER, 0, buffers.mNumDiffuseParticles*sizeof(Vec4), diffuseVelocities));
+ }
+}
+
+void RenderFullscreenQuad()
+{
+ glColor3f(1.0f, 1.0f, 1.0f);
+ glBegin(GL_QUADS);
+
+ glTexCoord2f(0.0f, 0.0f);
+ glVertex2f(-1.0f, -1.0f);
+
+ glTexCoord2f(1.0f, 0.0f);
+ glVertex2f(1.0f, -1.0f);
+
+ glTexCoord2f(1.0f, 1.0f);
+ glVertex2f(1.0f, 1.0f);
+
+ glTexCoord2f(0.0f, 1.0f);
+ glVertex2f(-1.0f, 1.0f);
+
+ glEnd();
+}
+
+extern Mesh* g_mesh;
+void DrawShapes();
+
+void RenderEllipsoids(FluidRenderer* render, 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)
+{
+#if !ENABLE_SIMPLE_FLUID
+ // resolve msaa back buffer to texture
+ glVerify(glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, g_msaaFbo));
+ glVerify(glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, render->mSceneFbo));
+ glVerify(glBlitFramebuffer(0, 0, GLsizei(screenWidth), GLsizei(screenWidth/screenAspect), 0, 0, GLsizei(screenWidth), GLsizei(screenWidth/screenAspect), GL_COLOR_BUFFER_BIT, GL_LINEAR));
+
+ //thickness texture
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, render->mThicknessFbo));
+ glVerify(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, render->mThicknessTex, 0));
+ glVerify(glDrawBuffer(GL_COLOR_ATTACHMENT0));
+
+ glViewport(0, 0, GLsizei(screenWidth), GLsizei(screenWidth/screenAspect));
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ glDepthMask(GL_TRUE);
+ glDisable(GL_CULL_FACE);
+
+ if (g_mesh)
+ DrawMesh(g_mesh, Vec3(1.0f));
+
+ DrawShapes();
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
+ glEnable(GL_POINT_SPRITE);
+ glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE);
+ glDepthMask(GL_FALSE);
+
+ // make sprites larger to get smoother thickness texture
+ const float thicknessScale = 4.0f;
+
+ glUseProgram(render->mPointThicknessProgram);
+ glUniform1f( glGetUniformLocation(render->mPointThicknessProgram, "pointRadius"), thicknessScale*radius);
+ glUniform1f( glGetUniformLocation(render->mPointThicknessProgram, "pointScale"), screenWidth/screenAspect * (1.0f / (tanf(fov*0.5f))));
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO);
+ glVertexPointer(3, GL_FLOAT, sizeof(float)*4, (void*)(offset*sizeof(float)*4));
+
+ glDrawArrays(GL_POINTS, 0, n);
+
+ glUseProgram(0);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisable(GL_POINT_SPRITE);
+ glDisable(GL_BLEND);
+#endif
+
+ // depth texture
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, render->mDepthFbo));
+ glVerify(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, render->mDepthTex, 0));
+ glVerify(glDrawBuffer(GL_COLOR_ATTACHMENT0));
+
+ // draw points
+ //glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
+ glDisable(GL_POINT_SPRITE);
+ glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(GL_TRUE);
+
+ glViewport(0, 0, int(screenWidth), int(screenWidth/screenAspect));
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ const float viewHeight = tanf(fov/2.0f);
+
+ glUseProgram(render->mEllipsoidDepthProgram);
+ glUniform3fv( glGetUniformLocation(render->mEllipsoidDepthProgram, "invViewport"), 1, Vec3(1.0f/screenWidth, screenAspect/screenWidth, 1.0f));
+ glUniform3fv( glGetUniformLocation(render->mEllipsoidDepthProgram, "invProjection"), 1, Vec3(screenAspect*viewHeight, viewHeight, 1.0f));
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glBindBuffer(GL_ARRAY_BUFFER, buffers.mPositionVBO);
+ glVertexPointer(3, GL_FLOAT, sizeof(float)*4, 0);//(void*)(offset*sizeof(float)*4));
+
+ // ellipsoid eigenvectors
+ int s1 = glGetAttribLocation(render->mEllipsoidDepthProgram, "q1");
+ glEnableVertexAttribArray(s1);
+ glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[0]);
+ glVertexAttribPointer(s1, 4, GL_FLOAT, GL_FALSE, 0, 0);// (void*)(offset*sizeof(float)*4));
+
+ int s2 = glGetAttribLocation(render->mEllipsoidDepthProgram, "q2");
+ glEnableVertexAttribArray(s2);
+ glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[1]);
+ glVertexAttribPointer(s2, 4, GL_FLOAT, GL_FALSE, 0, 0);//(void*)(offset*sizeof(float)*4));
+
+ int s3 = glGetAttribLocation(render->mEllipsoidDepthProgram, "q3");
+ glEnableVertexAttribArray(s3);
+ glBindBuffer(GL_ARRAY_BUFFER, buffers.mAnisotropyVBO[2]);
+ glVertexAttribPointer(s3, 4, GL_FLOAT, GL_FALSE, 0, 0);// (void*)(offset*sizeof(float)*4));
+
+ glVerify(glDrawArrays(GL_POINTS, offset, n));
+
+ glUseProgram(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableVertexAttribArray(s1);
+ glDisableVertexAttribArray(s2);
+ glDisableVertexAttribArray(s3);
+
+ glDisable(GL_POINT_SPRITE);
+
+ //---------------------------------------------------------------
+ // blur
+
+ glDisable(GL_DEPTH_TEST);
+ glDepthMask(GL_FALSE);
+
+ glVerify(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, render->mDepthSmoothTex, 0));
+ glUseProgram(render->mDepthBlurProgram);
+
+ glActiveTexture(GL_TEXTURE0);
+ glEnable(GL_TEXTURE_RECTANGLE_ARB);
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, render->mDepthTex);
+
+ glActiveTexture(GL_TEXTURE1);
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, render->mThicknessTex);
+
+ glVerify(glUniform1f( glGetUniformLocation(render->mDepthBlurProgram, "blurRadiusWorld"), radius*0.5f)); // blur half the radius by default
+ glVerify(glUniform1f( glGetUniformLocation(render->mDepthBlurProgram, "blurScale"), screenWidth/screenAspect * (1.0f / (tanf(fov*0.5f)))));
+ glVerify(glUniform2fv( glGetUniformLocation(render->mDepthBlurProgram, "invTexScale"), 1, Vec2(1.0f/screenAspect, 1.0f)));
+ glVerify(glUniform1f( glGetUniformLocation(render->mDepthBlurProgram, "blurFalloff"), blur));
+ glVerify(glUniform1i( glGetUniformLocation(render->mDepthBlurProgram, "depthTex"), 0));
+ glVerify(glUniform1i( glGetUniformLocation(render->mDepthBlurProgram, "thicknessTex"), 1));
+ glVerify(glUniform1i(glGetUniformLocation(render->mDepthBlurProgram, "debug"), debug));
+
+ glVerify(RenderFullscreenQuad());
+
+ glActiveTexture(GL_TEXTURE0);
+ glDisable(GL_TEXTURE_RECTANGLE_ARB);
+
+ //---------------------------------------------------------------
+ // composite with scene
+
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, g_msaaFbo));
+ glVerify(glEnable(GL_DEPTH_TEST));
+ glVerify(glDepthMask(GL_TRUE));
+ glVerify(glDisable(GL_BLEND));
+ glVerify(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
+
+ glVerify(glUseProgram(render->mCompositeProgram));
+
+ glVerify(glUniform2fv(glGetUniformLocation(render->mCompositeProgram, "invTexScale"), 1, Vec2(1.0f/screenWidth, screenAspect/screenWidth)));
+ glVerify(glUniform2fv(glGetUniformLocation(render->mCompositeProgram, "clipPosToEye"), 1, Vec2(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f))));
+ glVerify(glUniform4fv(glGetUniformLocation(render->mCompositeProgram, "color"), 1, color));
+ glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "ior"), ior));
+ glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "spotMin"), gSpotMin));
+ glVerify(glUniform1f(glGetUniformLocation(render->mCompositeProgram, "spotMax"), gSpotMax));
+ glVerify(glUniform1i(glGetUniformLocation(render->mCompositeProgram, "debug"), debug));
+
+ glVerify(glUniform3fv(glGetUniformLocation(render->mCompositeProgram, "lightPos"), 1, lightPos));
+ glVerify(glUniform3fv(glGetUniformLocation(render->mCompositeProgram, "lightDir"), 1, -Normalize(lightTarget-lightPos)));
+ glVerify(glUniformMatrix4fv(glGetUniformLocation(render->mCompositeProgram, "lightTransform"), 1, false, lightTransform));
+
+ const Vec2 taps[] =
+ {
+ Vec2(-0.326212f,-0.40581f),Vec2(-0.840144f,-0.07358f),
+ Vec2(-0.695914f,0.457137f),Vec2(-0.203345f,0.620716f),
+ Vec2(0.96234f,-0.194983f),Vec2(0.473434f,-0.480026f),
+ Vec2(0.519456f,0.767022f),Vec2(0.185461f,-0.893124f),
+ Vec2(0.507431f,0.064425f),Vec2(0.89642f,0.412458f),
+ Vec2(-0.32194f,-0.932615f),Vec2(-0.791559f,-0.59771f)
+ };
+
+ glVerify(glUniform2fv(glGetUniformLocation(render->mCompositeProgram, "shadowTaps"), 12, &taps[0].x));
+
+ // smoothed depth tex
+ glVerify(glActiveTexture(GL_TEXTURE0));
+ glVerify(glEnable(GL_TEXTURE_2D));
+ glVerify(glBindTexture(GL_TEXTURE_2D, render->mDepthSmoothTex));
+
+ // shadow tex
+ glVerify(glActiveTexture(GL_TEXTURE1));
+ glVerify(glEnable(GL_TEXTURE_2D));
+ glVerify(glBindTexture(GL_TEXTURE_2D, shadowMap->texture));
+
+ // thickness tex
+ glVerify(glActiveTexture(GL_TEXTURE2));
+ glVerify(glEnable(GL_TEXTURE_2D));
+ glVerify(glBindTexture(GL_TEXTURE_2D, render->mThicknessTex));
+
+ // scene tex
+ glVerify(glActiveTexture(GL_TEXTURE3));
+ glVerify(glEnable(GL_TEXTURE_2D));
+ glVerify(glBindTexture(GL_TEXTURE_2D, render->mSceneTex));
+
+ /*
+ // reflection tex
+ glVerify(glActiveTexture(GL_TEXTURE5));
+ glVerify(glEnable(GL_TEXTURE_2D));
+ glVerify(glBindTexture(GL_TEXTURE_2D, reflectMap->texture));
+ */
+
+ glVerify(glUniform1i(glGetUniformLocation(render->mCompositeProgram, "tex"), 0));
+ glVerify(glUniform1i(glGetUniformLocation(render->mCompositeProgram, "shadowTex"), 1));
+ glVerify(glUniform1i(glGetUniformLocation(render->mCompositeProgram, "thicknessTex"), 2));
+ glVerify(glUniform1i(glGetUniformLocation(render->mCompositeProgram, "sceneTex"), 3));
+ glVerify(glUniform1i(glGetUniformLocation(render->mCompositeProgram, "reflectTex"), 5));
+
+ // -- end shadowing
+
+ // ignores projection matrices
+ glVerify(RenderFullscreenQuad());
+
+ // reset state
+ glActiveTexture(GL_TEXTURE5);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE3);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE2);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE1);
+ glDisable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0);
+ glDisable(GL_TEXTURE_2D);
+
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(GL_TRUE);
+ glDisable(GL_BLEND);
+}
+
+//------------------------------------------------------------------------------
+// Diffuse Shading
+
+const char *vertexDiffuseShader = STRINGIFY(
+
+uniform float pointRadius; // point size in world space
+uniform float pointScale; // scale to calculate size in pixels
+uniform vec3 lightPos;
+uniform vec3 lightDir;
+uniform mat4 lightTransform;
+uniform float spotMin;
+uniform float spotMax;
+uniform vec4 color;
+
+
+void main()
+{
+ vec3 worldPos = gl_Vertex.xyz;// - vec3(0.0, 0.1*0.25, 0.0); // hack move towards ground to account for anisotropy;
+ vec4 eyePos = gl_ModelViewMatrix * vec4(worldPos, 1.0);
+
+ gl_Position = gl_ProjectionMatrix * eyePos;
+ //gl_Position.z -= 0.0025; // bias above fluid surface
+
+ // calculate window-space point size
+ gl_PointSize = pointRadius * (pointScale / gl_Position.w);
+
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[1] = vec4(worldPos, gl_Vertex.w);
+ gl_TexCoord[2] = eyePos;
+
+ gl_TexCoord[3].xyz = gl_ModelViewMatrix*vec4(gl_MultiTexCoord1.xyz, 0.0);
+ gl_TexCoord[4].xyzw = color;
+
+ // hack to color different emitters
+ if (gl_MultiTexCoord1.w == 2.0)
+ gl_TexCoord[4].xyzw = vec4(0.85, 0.65, 0.65, color.w);
+ else if (gl_MultiTexCoord1.w == 1.0)
+ gl_TexCoord[4].xyzw = vec4(0.65, 0.85, 0.65, color.w);
+
+ // compute ndc pos for frustrum culling in GS
+ vec4 ndcPos = gl_ModelViewProjectionMatrix * vec4(worldPos.xyz, 1.0);
+ gl_TexCoord[5] = ndcPos / ndcPos.w;
+}
+);
+
+
+
+
+const char *geometryDiffuseShader =
+"#version 120\n"
+"#extension GL_EXT_geometry_shader4 : enable\n"
+STRINGIFY(
+
+uniform float pointScale; // point size in world space
+uniform float motionBlurScale;
+uniform float diffusion;
+uniform vec3 lightDir;
+
+void main()
+{
+ vec4 ndcPos = gl_TexCoordIn[0][5];
+
+ // frustrum culling
+ const float ndcBound = 1.0;
+ if (ndcPos.x < -ndcBound) return;
+ if (ndcPos.x > ndcBound) return;
+ if (ndcPos.y < -ndcBound) return;
+ if (ndcPos.y > ndcBound) return;
+
+ float velocityScale = 1.0;
+
+ vec3 v = gl_TexCoordIn[0][3].xyz*velocityScale;
+ vec3 p = gl_TexCoordIn[0][2].xyz;
+
+ // billboard in eye space
+ vec3 u = vec3(0.0, pointScale, 0.0);
+ vec3 l = vec3(pointScale, 0.0, 0.0);
+
+ // increase size based on life
+ float lifeFade = mix(1.0f+diffusion, 1.0, min(1.0, gl_TexCoordIn[0][1].w*0.25f));
+ u *= lifeFade;
+ l *= lifeFade;
+
+ //lifeFade = 1.0;
+
+ float fade = 1.0/(lifeFade*lifeFade);
+ float vlen = length(v)*motionBlurScale;
+
+ if (vlen > 0.5)
+ {
+ float len = max(pointScale, vlen*0.016);
+ fade = min(1.0, 2.0/(len/pointScale));
+
+ u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz
+ l = normalize(cross(u, vec3(0.0, 0.0, -1.0)))*pointScale;
+ }
+
+ {
+
+ gl_TexCoord[1] = gl_TexCoordIn[0][1]; // vertex world pos (life in w)
+ gl_TexCoord[2] = gl_TexCoordIn[0][2]; // vertex eye pos
+ gl_TexCoord[3] = gl_TexCoordIn[0][3]; // vertex velocity in view space
+ gl_TexCoord[3].w = fade;
+ gl_TexCoord[4] = gl_ModelViewMatrix*vec4(lightDir, 0.0);
+ gl_TexCoord[4].w = gl_TexCoordIn[0][3].w; // attenuation
+ gl_TexCoord[5].xyzw = gl_TexCoordIn[0][4].xyzw; // color
+
+ float zbias = 0.0f;//0.00125*2.0;
+
+ gl_TexCoord[0] = vec4(0.0, 1.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p + u - l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(0.0, 0.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p - u - l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1.0, 1.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p + u + l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+
+ gl_TexCoord[0] = vec4(1.0, 0.0, 0.0, 0.0);
+ gl_Position = gl_ProjectionMatrix * vec4(p - u + l, 1.0);
+ gl_Position.z -= zbias;
+ EmitVertex();
+ }
+}
+);
+
+const char *fragmentDiffuseShader = STRINGIFY(
+
+float sqr(float x) { return x*x; }
+float cube(float x) { return x*x*x; }
+
+uniform sampler2D depthTex;
+uniform sampler2D noiseTex;
+uniform vec2 invViewport;
+uniform vec4 color;
+uniform bool front;
+uniform bool shadow;
+
+//uniform sampler2DShadow shadowTex;
+uniform sampler2D shadowTex;
+uniform vec2 shadowTaps[12];
+uniform mat4 lightTransform;
+uniform vec3 lightDir;
+uniform float inscatterCoefficient;
+uniform float outscatterCoefficient;
+
+void main()
+{
+ float attenuation = gl_TexCoord[4].w;
+ float lifeFade = min(1.0, gl_TexCoord[1].w*0.125);
+
+ // calculate normal from texture coordinates
+ vec3 normal;
+ normal.xy = gl_TexCoord[0].xy*vec2(2.0, 2.0) + vec2(-1.0, -1.0);
+ float mag = dot(normal.xy, normal.xy);
+ if (mag > 1.0) discard; // kill pixels outside circle
+ normal.z = 1.0-mag;
+
+ float velocityFade = gl_TexCoord[3].w;
+ float alpha = lifeFade*velocityFade*sqr(normal.z);
+
+ gl_FragColor = alpha;
+}
+);
+
+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 shadow, bool front)
+{
+ static int sprogram = -1;
+ if (sprogram == -1)
+ sprogram = CompileProgram(vertexDiffuseShader, fragmentDiffuseShader, geometryDiffuseShader);
+
+ int thicknessScale = 1;
+
+ if (sprogram)
+ {
+#if USE_HDR_DIFFUSE_BLEND
+
+ {
+ glVerify(glBindFramebuffer(GL_READ_FRAMEBUFFER, g_msaaFbo));
+ glVerify(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, render->mThicknessFbo));
+ glVerify(glBlitFramebuffer(0, 0, render->mSceneWidth, render->mSceneHeight, 0, 0, render->mSceneWidth/thicknessScale, render->mSceneHeight/thicknessScale, GL_DEPTH_BUFFER_BIT, GL_NEAREST));
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+#endif
+
+ glEnable(GL_POINT_SPRITE);
+ glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
+ glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+ glDepthMask(GL_FALSE);
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+ glDisable(GL_CULL_FACE);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+
+ glUseProgram(sprogram);
+ glUniform1f( glGetUniformLocation(sprogram, "motionBlurScale"), motionBlur);
+ glUniform1f( glGetUniformLocation(sprogram, "diffusion"), 1.0f);
+ glUniform1f( glGetUniformLocation(sprogram, "pointScale"), radius*1.0f);
+ glUniform1f( glGetUniformLocation(sprogram, "pointRadius"), screenWidth / float(thicknessScale) / (2.0f*screenAspect*tanf(fov*0.5f)));
+ glUniform2fv( glGetUniformLocation(sprogram, "invViewport"), 1, Vec2(1.0f/screenWidth, screenAspect/screenWidth));
+ glUniform4fv( glGetUniformLocation(sprogram, "color"), 1, color);
+ glUniform1i( glGetUniformLocation(sprogram, "tex"), 0);
+ glUniform1f( glGetUniformLocation(sprogram, "inscatterCoefficient"), inscatter);
+ glUniform1f( glGetUniformLocation(sprogram, "outscatterCoefficient"), outscatter);
+
+ GLint uLightTransform = glGetUniformLocation(sprogram, "lightTransform");
+ glUniformMatrix4fv(uLightTransform, 1, false, lightTransform);
+
+ GLint uLightPos = glGetUniformLocation(sprogram, "lightPos");
+ glUniform3fv(uLightPos, 1, lightPos);
+
+ GLint uLightDir = glGetUniformLocation(sprogram, "lightDir");
+ glUniform3fv(uLightDir, 1, Normalize(lightTarget-lightPos));
+
+ glUniform1f( glGetUniformLocation(sprogram, "spotMin"), gSpotMin);
+ glUniform1f( glGetUniformLocation(sprogram, "spotMax"), gSpotMax);
+
+ const Vec2 taps[] =
+ {
+ Vec2(-0.326212f,-0.40581f),Vec2(-0.840144f,-0.07358f),
+ Vec2(-0.695914f,0.457137f),Vec2(-0.203345f,0.620716f),
+ Vec2(0.96234f,-0.194983f),Vec2(0.473434f,-0.480026f),
+ Vec2(0.519456f,0.767022f),Vec2(0.185461f,-0.893124f),
+ Vec2(0.507431f,0.064425f),Vec2(0.89642f,0.412458f),
+ Vec2(-0.32194f,-0.932615f),Vec2(-0.791559f,-0.59771f)
+ };
+
+ glVerify(glUniform2fv(glGetUniformLocation(sprogram, "shadowTaps"), 12, &taps[0].x));
+ glVerify(glUniform1i(glGetUniformLocation(sprogram, "noiseTex"), 2));
+ glVerify(glUniform1i(glGetUniformLocation(sprogram, "shadowTex"), 1));
+ glVerify(glUniform1i(glGetUniformLocation(sprogram, "depthTex"), 0));
+ glVerify(glUniform1i(glGetUniformLocation(sprogram, "front"), front));
+ glVerify(glUniform1i(glGetUniformLocation(sprogram, "shadow"), shadow));
+
+ // noise tex
+ //glActiveTexture(GL_TEXTURE2);
+ //glEnable(GL_TEXTURE_2D);
+ //glBindTexture(GL_TEXTURE_2D, noiseTex);
+
+ // shadow tex
+ glActiveTexture(GL_TEXTURE1);
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, shadowMap->texture);
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE));
+ //glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL));
+
+
+ glActiveTexture(GL_TEXTURE0);
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, render->mDepthSmoothTex);
+
+ glClientActiveTexture(GL_TEXTURE1);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffuseVelocityVBO));
+ glTexCoordPointer(4, GL_FLOAT, sizeof(float)*4, 0);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glBindBuffer(GL_ARRAY_BUFFER, buffers.mDiffusePositionVBO);
+ glVertexPointer(4, GL_FLOAT, sizeof(float)*4, 0);
+
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers.mDiffuseIndicesIBO);
+
+ glDrawElements(GL_POINTS, n, GL_UNSIGNED_INT, 0);
+
+ glUseProgram(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisable(GL_POINT_SPRITE);
+ glDisable(GL_BLEND);
+ glDepthMask(GL_TRUE);
+
+ glVerify(glActiveTexture(GL_TEXTURE2));
+ glVerify(glDisable(GL_TEXTURE_2D));
+ glVerify(glActiveTexture(GL_TEXTURE1));
+ glVerify(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE));
+ glVerify(glDisable(GL_TEXTURE_2D));
+ glVerify(glActiveTexture(GL_TEXTURE0));
+ glVerify(glDisable(GL_TEXTURE_2D));
+
+#if USE_HDR_DIFFUSE_BLEND
+
+ {
+ glVerify(glBindFramebuffer(GL_FRAMEBUFFER, g_msaaFbo));
+ glVerify(glViewport(0, 0, int(screenWidth), int(screenWidth/screenAspect)));
+
+ //glClear(GL_COLOR_BUFFER_BIT);
+ glUseProgram(0);
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ glDepthMask(GL_FALSE);
+ glDisable(GL_CULL_FACE);
+
+ glVerify(glActiveTexture(GL_TEXTURE0));
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, render->mThicknessTex);
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ gluOrtho2D(-1.0f, 1.0f, -1.0f, 1.0);
+
+ RenderFullscreenQuad();
+
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+
+ glDepthMask(GL_TRUE);
+ }
+#endif
+
+ }
+}
+
+
+struct GpuMesh
+{
+ GLuint mPositionsVBO;
+ GLuint mNormalsVBO;
+ GLuint mIndicesIBO;
+
+ int mNumVertices;
+ int mNumFaces;
+};
+
+GpuMesh* CreateGpuMesh(const Mesh* m)
+{
+ GpuMesh* mesh = new GpuMesh();
+
+ mesh->mNumVertices = m->GetNumVertices();
+ mesh->mNumFaces = m->GetNumFaces();
+
+ // vbos
+ glVerify(glGenBuffers(1, &mesh->mPositionsVBO));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, mesh->mPositionsVBO));
+ glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*m->m_positions.size(), &m->m_positions[0], GL_STATIC_DRAW));
+
+ glVerify(glGenBuffers(1, &mesh->mNormalsVBO));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, mesh->mNormalsVBO));
+ glVerify(glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*m->m_normals.size(), &m->m_normals[0], GL_STATIC_DRAW));
+
+ glVerify(glGenBuffers(1, &mesh->mIndicesIBO));
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->mIndicesIBO));
+ glVerify(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int)*m->m_indices.size(), &m->m_indices[0], GL_STATIC_DRAW));
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+
+ return mesh;
+}
+
+void DestroyGpuMesh(GpuMesh* m)
+{
+ glVerify(glDeleteBuffers(1, &m->mPositionsVBO));
+ glVerify(glDeleteBuffers(1, &m->mNormalsVBO));
+ glVerify(glDeleteBuffers(1, &m->mIndicesIBO));
+}
+
+void DrawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color)
+{
+ if (m)
+ {
+ GLint program;
+ glGetIntegerv(GL_CURRENT_PROGRAM, &program);
+
+ if (program)
+ glUniformMatrix4fv( glGetUniformLocation(program, "objectTransform"), 1, false, xform);
+
+ glVerify(glColor3fv(color));
+ glVerify(glSecondaryColor3fv(color));
+
+ glVerify(glEnableClientState(GL_VERTEX_ARRAY));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, m->mPositionsVBO));
+ glVerify(glVertexPointer(3, GL_FLOAT, sizeof(float)*3, 0));
+
+ glVerify(glEnableClientState(GL_NORMAL_ARRAY));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, m->mNormalsVBO));
+ glVerify(glNormalPointer(GL_FLOAT, sizeof(float)*3, 0));
+
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m->mIndicesIBO));
+
+ glVerify(glDrawElements(GL_TRIANGLES, m->mNumFaces*3, GL_UNSIGNED_INT, 0));
+
+ glVerify(glDisableClientState(GL_VERTEX_ARRAY));
+ glVerify(glDisableClientState(GL_NORMAL_ARRAY));
+
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, 0));
+
+ if (program)
+ glUniformMatrix4fv(glGetUniformLocation(program, "objectTransform"), 1, false, Matrix44::kIdentity);
+ }
+}
+
+void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color)
+{
+ if (m)
+ {
+ GLint program;
+ glGetIntegerv(GL_CURRENT_PROGRAM, &program);
+
+ GLint param = glGetUniformLocation(program, "objectTransform");
+
+ glVerify(glColor3fv(color));
+ glVerify(glSecondaryColor3fv(color));
+
+ glVerify(glEnableClientState(GL_VERTEX_ARRAY));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, m->mPositionsVBO));
+ glVerify(glVertexPointer(3, GL_FLOAT, sizeof(float)*3, 0));
+
+ glVerify(glEnableClientState(GL_NORMAL_ARRAY));
+ glVerify(glBindBuffer(GL_ARRAY_BUFFER, m->mNormalsVBO));
+ glVerify(glNormalPointer(GL_FLOAT, sizeof(float)*3, 0));
+
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m->mIndicesIBO));
+
+ for (int i=0; i < n; ++i)
+ {
+ if (program)
+ glUniformMatrix4fv( param, 1, false, xforms[i]);
+
+ glVerify(glDrawElements(GL_TRIANGLES, m->mNumFaces*3, GL_UNSIGNED_INT, 0));
+ }
+
+ glVerify(glDisableClientState(GL_VERTEX_ARRAY));
+ glVerify(glDisableClientState(GL_NORMAL_ARRAY));
+
+ glVerify(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
+ }
+}
+
+void BeginLines()
+{
+ glUseProgram(0);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_BLEND);
+
+ glLineWidth(1.0f);
+
+ for (int i = 0; i < 8; ++i)
+ {
+ glActiveTexture(GL_TEXTURE0 + i);
+ glDisable(GL_TEXTURE_2D);
+ }
+
+ glBegin(GL_LINES);
+}
+
+void DrawLine(const Vec3& p, const Vec3& q, const Vec4& color)
+{
+ glColor4fv(color);
+ glVertex3fv(p);
+ glVertex3fv(q);
+}
+
+void EndLines()
+{
+ glEnd();
+}
+
+void BeginPoints(float size)
+{
+ glPointSize(size);
+
+ glUseProgram(0);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_BLEND);
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_POINT_SPRITE);
+ glEnable(GL_POINT_SMOOTH);
+ glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
+
+ for (int i = 0; i < 8; ++i)
+ {
+ glActiveTexture(GL_TEXTURE0 + i);
+ glDisable(GL_TEXTURE_2D);
+ }
+
+ glBegin(GL_POINTS);
+}
+
+void DrawPoint(const Vec3& p, const Vec4& color)
+{
+ glColor3fv(color);
+ glVertex3fv(p);
+}
+
+void EndPoints()
+{
+ glEnd();
+}
+
diff --git a/demo/scenes.h b/demo/scenes.h
new file mode 100644
index 0000000..94e6913
--- /dev/null
+++ b/demo/scenes.h
@@ -0,0 +1,115 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2013-2017 NVIDIA Corporation. All rights reserved.
+
+#pragma once
+
+// disable some warnings
+#if _WIN32
+#pragma warning(disable: 4267) // conversion from 'size_t' to 'int', possible loss of data
+#endif
+
+class Scene
+{
+public:
+
+ Scene(const char* name) : mName(name) {}
+
+ virtual void Initialize() = 0;
+ virtual void PostInitialize() {}
+
+ // update any buffers (all guaranteed to be mapped here)
+ virtual void Update() {}
+
+ // send any changes to flex (all buffers guaranteed to be unmapped here)
+ virtual void Sync() {}
+
+ virtual void Draw(int pass) {}
+ virtual void KeyDown(int key) {}
+ virtual void DoGui() {}
+ virtual void CenterCamera() {}
+
+ virtual Matrix44 GetBasis() { return Matrix44::kIdentity; }
+
+ virtual const char* GetName() { return mName; }
+
+ const char* mName;
+};
+
+
+#include "scenes/adhesion.h"
+#include "scenes/armadilloshower.h"
+#include "scenes/bananas.h"
+#include "scenes/bouyancy.h"
+#include "scenes/bunnybath.h"
+#include "scenes/ccdfluid.h"
+#include "scenes/clothlayers.h"
+#include "scenes/dambreak.h"
+#include "scenes/darts.h"
+#include "scenes/debris.h"
+#include "scenes/deformables.h"
+#include "scenes/envcloth.h"
+#include "scenes/flag.h"
+#include "scenes/fluidblock.h"
+#include "scenes/fluidclothcoupling.h"
+#include "scenes/forcefield.h"
+#include "scenes/frictionmoving.h"
+#include "scenes/frictionramp.h"
+#include "scenes/gamemesh.h"
+#include "scenes/googun.h"
+#include "scenes/granularpile.h"
+#include "scenes/granularshape.h"
+#include "scenes/inflatable.h"
+#include "scenes/initialoverlap.h"
+#include "scenes/lighthouse.h"
+#include "scenes/localspacecloth.h"
+#include "scenes/localspacefluid.h"
+#include "scenes/lowdimensionalshapes.h"
+#include "scenes/melting.h"
+#include "scenes/mixedpile.h"
+#include "scenes/nonconvex.h"
+#include "scenes/parachutingbunnies.h"
+#include "scenes/pasta.h"
+#include "scenes/plasticstack.h"
+#include "scenes/player.h"
+#include "scenes/potpourri.h"
+#include "scenes/rayleightaylor.h"
+#include "scenes/restitution.h"
+#include "scenes/rigidfluidcoupling.h"
+#include "scenes/rigidpile.h"
+#include "scenes/rigidrotation.h"
+#include "scenes/rockpool.h"
+#include "scenes/sdfcollision.h"
+#include "scenes/shapecollision.h"
+#include "scenes/softbody.h"
+#include "scenes/spherecloth.h"
+#include "scenes/surfacetension.h"
+#include "scenes/tearing.h"
+#include "scenes/thinbox.h"
+#include "scenes/trianglecollision.h"
+#include "scenes/triggervolume.h"
+#include "scenes/viscosity.h"
+#include "scenes/waterballoon.h"
diff --git a/demo/scenes/adhesion.h b/demo/scenes/adhesion.h
new file mode 100644
index 0000000..efbdec2
--- /dev/null
+++ b/demo/scenes/adhesion.h
@@ -0,0 +1,50 @@
+
+class Adhesion : public Scene
+{
+public:
+
+ Adhesion(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float radius = 0.1f;
+
+ g_params.radius = radius;
+
+ g_params.fluid = true;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.fluidRestDistance = g_params.radius*0.55f;
+ g_params.anisotropyScale = 3.0f / radius;
+ g_params.smoothing = 0.5f;
+ g_params.relaxationFactor = 1.f;
+ g_params.restitution = 0.0f;
+ g_params.collisionDistance = 0.01f;
+
+ g_fluidColor = Vec4(0.0f, 0.8f, 0.2f, 1.0f);
+ //g_fluidColor = Vec4(0.7f, 0.6f, 0.6f, 0.2f);
+
+ g_params.dynamicFriction = 0.5f;
+ g_params.viscosity = 50.0f;
+ g_params.adhesion = 0.5f;
+ g_params.cohesion = 0.08f;
+ g_params.surfaceTension = 0.0f;
+
+ g_numExtraParticles = 64 * 1024;
+
+ AddBox(Vec3(1.0f, 1.5f, 0.1f), Vec3(0.0f, 1.5f, 0.0f));
+ AddBox(Vec3(1.0f, 0.1f, 6.0f), Vec3(-1.0f, 3.0f, 0.0f));
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.fluidRestDistance*2.f / g_dt);
+
+ g_params.numPlanes = 3;
+
+ // draw options
+ g_drawEllipsoids = true;
+
+ g_pause = false;
+ }
+
+ bool mViscous;
+};
diff --git a/demo/scenes/armadilloshower.h b/demo/scenes/armadilloshower.h
new file mode 100644
index 0000000..fdbf194
--- /dev/null
+++ b/demo/scenes/armadilloshower.h
@@ -0,0 +1,75 @@
+
+
+class ArmadilloShower : public Scene
+{
+public:
+
+ ArmadilloShower(const char* name, bool viscous) : Scene(name), mViscous(viscous) {}
+
+ virtual void Initialize()
+ {
+ float minSize = 0.5f;
+ float maxSize = 1.0f;
+
+ float radius = 0.1f;
+
+ for (int i=0; i < 5; i++)
+ AddRandomConvex(10, Vec3(i*2.0f, 0.0f, Randf(0.0f, 2.0f)), minSize, maxSize, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi*10.0f));
+
+ g_params.radius = radius;
+
+ g_params.fluid = true;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.fluidRestDistance = g_params.radius*0.5f;
+ g_params.anisotropyScale = 20.0f;
+
+ if (mViscous)
+ {
+ g_fluidColor = Vec4(0.0f, 0.8f, 0.2f, 1.0f);
+
+ g_params.dynamicFriction = 0.5f;
+ g_params.viscosity = 10.85f;
+ g_params.cohesion = 0.25f;
+ }
+ else
+ {
+ g_params.dynamicFriction = 0.025f;
+ g_params.viscosity = 0.05f;
+ }
+
+ g_numExtraParticles = 64*1024;
+
+ g_diffuseScale = 1.0f;
+
+ NvFlexDistanceFieldId sdf = CreateSDF(GetFilePathByPlatform("../../data/armadillo.ply").c_str(), 128);
+ AddSDF(sdf, Vec3(2.0f, 0.0f, -1.0f), Quat(), 2.0f);
+
+ Vec3 meshLower, meshUpper;
+ g_mesh->GetBounds(meshLower, meshUpper);
+
+ Emitter e1;
+ e1.mDir = Vec3(-1.0f, 0.0f, 0.0f);
+ e1.mRight = Vec3(0.0f, 0.0f, 1.0f);
+ e1.mPos = Vec3(-1.0f, 0.15f, 0.50f) + meshLower + Vec3(meshUpper.x, meshUpper.y*0.75f, meshUpper.z*0.5f);
+ e1.mSpeed = (g_params.radius*0.5f/g_dt)*2.0f; // 2 particle layers per-frame
+ e1.mEnabled = true;
+
+ Emitter e2;
+ e2.mDir = Vec3(1.0f, 0.0f, 0.0f);
+ e2.mRight = Vec3(0.0f, 0.0f, -1.0f);
+ e2.mPos = Vec3(-1.0f, 0.15f, 0.50f) + meshLower + Vec3(0.0f, meshUpper.y*0.75f, meshUpper.z*0.5f);
+ e2.mSpeed = (g_params.radius*0.5f/g_dt)*2.0f; // 2 particle layers per-frame
+ e2.mEnabled = true;
+
+ g_emitters.push_back(e1);
+ g_emitters.push_back(e2);
+
+ g_emit = true;
+
+ // draw options
+ g_drawEllipsoids = true;
+ }
+
+ bool mViscous;
+}; \ No newline at end of file
diff --git a/demo/scenes/bananas.h b/demo/scenes/bananas.h
new file mode 100644
index 0000000..b404a1e
--- /dev/null
+++ b/demo/scenes/bananas.h
@@ -0,0 +1,60 @@
+
+
+class BananaPile : public Scene
+{
+public:
+
+ BananaPile(const char* name) : Scene(name)
+ {
+ }
+
+ virtual void Initialize()
+ {
+ float s = 1.0f;
+
+ Vec3 lower(0.0f, 1.0f + g_params.radius*0.25f, 0.0f);
+
+ int dimx = 3;
+ int dimy = 40;
+ int dimz = 2;
+
+ float radius = g_params.radius;
+ int group = 0;
+
+ // create a basic grid
+ for (int x = 0; x < dimx; ++x)
+ {
+ for (int y = 0; y < dimy; ++y)
+ {
+ for (int z = 0; z < dimz; ++z)
+ {
+ CreateParticleShape(GetFilePathByPlatform("../../data/banana.obj").c_str(), lower + (s*1.1f)*Vec3(float(x), y*0.4f, float(z)), Vec3(s), 0.0f, radius*0.95f, Vec3(0.0f), 1.0f, true, 0.8f, NvFlexMakePhase(group++, 0), true, radius*0.1f, 0.0f, 0.0f, 1.25f*Vec4(0.875f, 0.782f, 0.051f, 1.0f));
+ }
+ }
+ }
+
+ AddPlinth();
+
+ g_numSubsteps = 3;
+ g_params.numIterations = 2;
+
+ g_params.radius *= 1.0f;
+ g_params.dynamicFriction = 0.25f;
+ g_params.dissipation = 0.03f;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.sleepThreshold = g_params.radius*0.2f;
+ g_params.shockPropagation = 2.5f;
+ g_params.restitution = 0.55f;
+ g_params.damping = 0.25f;
+
+ // draw options
+ g_drawPoints = false;
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.radius*2.0f / g_dt);
+ }
+
+ virtual void Update()
+ {
+ }
+};
diff --git a/demo/scenes/bouyancy.h b/demo/scenes/bouyancy.h
new file mode 100644
index 0000000..816146f
--- /dev/null
+++ b/demo/scenes/bouyancy.h
@@ -0,0 +1,76 @@
+
+
+
+class Buoyancy : public Scene
+{
+public:
+
+ Buoyancy(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float radius = 0.1f;
+ float restDistance = radius*0.5f;
+ int group = 0;
+
+ int n = 3;
+ float spacing = 64*restDistance*0.9f/(2.0f*n);
+ float sampling = restDistance*0.8f;
+ Vec3 size = sampling*12.0f;
+
+ const float mass[] = {1.0f, 0.25f, 0.005f };
+
+ for (int j=0; j < 1; ++j)
+ for (int i=0; i < n; ++i)
+ CreateParticleShape(GetFilePathByPlatform("../../data/sphere.ply").c_str(), Vec3(spacing - 0.5f*size.x + i*spacing * 2, 2.0f + j*size.y*1.2f, 0.6f), size, 0.0f, sampling, Vec3(0.0f, 0.0f, 0.0f), mass[i], true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0001f);
+
+ g_numSolidParticles = g_buffers->positions.size();
+
+ int x = 64;
+ int y = 20;
+ int z = 32;
+
+ CreateParticleGrid(Vec3(0.0f), x, y, z, restDistance*0.9f, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid));
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.1f;
+ g_params.fluid = true;
+ g_params.viscosity = 2.0f;
+ g_params.numIterations = 4;
+ g_params.vorticityConfinement = 180.f;
+ g_params.anisotropyScale = 20.0f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.numPlanes = 5;
+ g_params.cohesion = 0.001625f;
+ g_params.collisionDistance = restDistance;
+ g_params.solidPressure = 0.1f;
+ g_params.restitution = 0.0f;
+ g_params.relaxationFactor = 1.0f;
+ g_params.relaxationMode = eNvFlexRelaxationLocal;
+
+ g_numSubsteps = 2;
+
+ g_maxDiffuseParticles = 64*1024;
+ g_diffuseScale = 0.25f;
+ g_diffuseShadow = false;
+ g_diffuseColor = 1.5f;
+ g_diffuseMotionScale = 1.5f;
+ g_params.diffuseBallistic = 35;
+ g_params.diffuseThreshold *= 0.1f;
+
+ g_drawPlaneBias = g_params.collisionDistance*1.5f;
+
+ g_lightDistance *= 0.65f;
+
+ g_fluidColor = Vec4(0.2f, 0.6f, 0.9f, 1.0f);
+
+ // draw options
+ g_drawDensity = true;
+ g_drawDiffuse = true;
+ g_drawEllipsoids = true;
+ g_drawPoints = false;
+
+ g_warmup = true;
+ }
+
+};
diff --git a/demo/scenes/bunnybath.h b/demo/scenes/bunnybath.h
new file mode 100644
index 0000000..db9e6ac
--- /dev/null
+++ b/demo/scenes/bunnybath.h
@@ -0,0 +1,84 @@
+
+class BunnyBath : public Scene
+{
+public:
+
+ BunnyBath(const char* name, bool dam) : Scene(name), mDam(dam) {}
+
+ void Initialize()
+ {
+ float radius = 0.1f;
+
+ // deforming bunny
+ float s = radius*0.5f;
+ float m = 0.25f;
+ int group = 1;
+
+ CreateParticleShape(GetFilePathByPlatform("../../data/bunny.ply").c_str(), Vec3(4.0f, 0.0f, 0.0f), 0.5f, 0.0f, s, Vec3(0.0f, 0.0f, 0.0f), m, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+ CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), Vec3(4.0f, 0.0f, 1.0f), 0.45f, 0.0f, s, Vec3(0.0f, 0.0f, 0.0f), m, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+ CreateParticleShape(GetFilePathByPlatform("../../data/bunny.ply").c_str(), Vec3(3.0f, 0.0f, 0.0f), 0.5f, 0.0f, s, Vec3(0.0f, 0.0f, 0.0f), m, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+ CreateParticleShape(GetFilePathByPlatform("../../data/sphere.ply").c_str(), Vec3(3.0f, 0.0f, 1.0f), 0.45f, 0.0f, s, Vec3(0.0f, 0.0f, 0.0f), m, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+ CreateParticleShape(GetFilePathByPlatform("../../data/bunny.ply").c_str(), Vec3(2.0f, 0.0f, 1.0f), 0.5f, 0.0f, s, Vec3(0.0f, 0.0f, 0.0f), m, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+ CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), Vec3(2.0f, 0.0f, 0.0f), 0.45f, 0.0f, s, Vec3(0.0f, 0.0f, 0.0f), m, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+
+ g_numSolidParticles = g_buffers->positions.size();
+
+ float restDistance = radius*0.55f;
+
+ if (mDam)
+ {
+ CreateParticleGrid(Vec3(0.0f, 0.0f, 0.6f), 24, 48, 24, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), 0.005f);
+ g_lightDistance *= 0.5f;
+ }
+
+ g_sceneLower = Vec3(0.0f);
+
+ g_numSubsteps = 2;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.01f;
+ g_params.fluid = true;
+ g_params.viscosity = 2.0f;
+ g_params.numIterations = 4;
+ g_params.vorticityConfinement = 40.0f;
+ g_params.anisotropyScale = 30.0f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.solidPressure = 0.f;
+ g_params.relaxationFactor = 0.0f;
+ g_params.cohesion = 0.02f;
+ g_params.collisionDistance = 0.01f;
+
+ g_maxDiffuseParticles = 64*1024;
+ g_diffuseScale = 0.5f;
+
+ g_fluidColor = Vec4(0.113f, 0.425f, 0.55f, 1.f);
+
+ Emitter e1;
+ e1.mDir = Vec3(1.0f, 0.0f, 0.0f);
+ e1.mRight = Vec3(0.0f, 0.0f, -1.0f);
+ e1.mPos = Vec3(radius, 1.f, 0.65f);
+ e1.mSpeed = (restDistance/g_dt)*2.0f; // 2 particle layers per-frame
+ e1.mEnabled = true;
+
+ g_emitters.push_back(e1);
+
+ g_numExtraParticles = 48*1024;
+
+ g_lightDistance = 1.8f;
+
+ g_params.numPlanes = 5;
+
+ g_waveFloorTilt = 0.0f;
+ g_waveFrequency = 1.5f;
+ g_waveAmplitude = 2.0f;
+
+ g_warmup = true;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawEllipsoids = true;
+ g_drawDiffuse = true;
+ }
+
+ bool mDam;
+};
diff --git a/demo/scenes/ccdfluid.h b/demo/scenes/ccdfluid.h
new file mode 100644
index 0000000..356eec7
--- /dev/null
+++ b/demo/scenes/ccdfluid.h
@@ -0,0 +1,107 @@
+
+class CCDFluid : public Scene
+{
+public:
+
+ CCDFluid (const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ const float radius = 0.05f;
+ const float restDistance = radius*0.6f;
+
+ int dx = int(ceilf(1.f / restDistance));
+ int dy = int(ceilf(1.f / restDistance));
+ int dz = int(ceilf(1.f / restDistance));
+
+ CreateParticleGrid(Vec3(0.0f, 1.0f, 0.0f), dx, dy, dz, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), restDistance*0.01f);
+
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Vec3 center = (lower+upper)*0.5f;
+
+ //Mesh* shape = ImportMesh("../../data/box.ply");
+ //shape->Transform(ScaleMatrix(Vec3(2.0f)));
+
+ Mesh* shape = ImportMesh("../../data/torus.obj");
+ shape->Transform(ScaleMatrix(Vec3(0.7f)));
+
+ //Mesh* box = ImportMesh("../../data/sphere.ply");
+ //box->Transform(TranslationMatrix(Point3(0.0f, 0.1f, 0.0f))*ScaleMatrix(Vec3(1.5f)));
+
+ // invert box faces
+ for (int i=0; i < int(shape->GetNumFaces()); ++i)
+ swap(shape->m_indices[i*3+0], shape->m_indices[i*3+1]);
+
+ shape->CalculateNormals();
+
+ // shift into torus interior
+ for (int i=0; i < g_buffers->positions.size(); ++i)
+ (Vec3&)(g_buffers->positions[i]) -= Vec3(2.1f, 0.0f, 0.0f);
+
+ mesh = CreateTriangleMesh(shape);
+ AddTriangleMesh(mesh, Vec3(center), Quat(), 1.0f);
+
+ // initialize our moving frame to the center of the box
+ newOffset = g_buffers->shapePositions[0].x;
+ newRotation = 0.0f;
+ rotationSpeed = 0.0f;
+
+ g_numSubsteps = 2;
+
+ g_params.fluid = true;
+ g_params.radius = radius;
+ g_params.fluidRestDistance = restDistance;
+ g_params.dynamicFriction = 0.1f;
+ g_params.restitution = 0.0f;
+ g_params.shapeCollisionMargin = 0.05f;
+ //g_params.maxAcceleration = 50.0f;
+ g_params.maxSpeed = g_numSubsteps*restDistance/g_dt;
+ g_params.collisionDistance = restDistance;
+ //g_params.shapeCollisionMargin = 0.0001f;
+
+ g_params.numIterations = 3;
+ //g_params.relaxationFactor = 0.5f;
+
+ g_params.smoothing = 0.4f;
+ g_params.anisotropyScale = 3.0f / radius;
+
+ g_params.viscosity = 0.001f;
+ g_params.cohesion = 0.05f;
+ g_params.surfaceTension = 0.0f;
+
+ // draw options
+ g_drawPoints = true;
+ g_drawEllipsoids = false;
+ g_drawDiffuse = true;
+ }
+
+ virtual void DoGui()
+ {
+ imguiSlider("Linear", &newOffset, 0.0f, 2.0f, 0.0001f);
+ imguiSlider("Rotation", &rotationSpeed, 0.0f, 10.0f, 0.1f);
+ }
+
+ virtual void Update()
+ {
+ g_buffers->shapePrevPositions[0].x = g_buffers->shapePositions[0].x;
+ g_buffers->shapePositions[0].x = newOffset;
+
+ newRotation += rotationSpeed*g_dt;
+
+ g_buffers->shapePrevRotations[0] = g_buffers->shapeRotations[0];
+ g_buffers->shapeRotations[0] = QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), newRotation);
+
+ // update previous transform of the disc
+ UpdateShapes();
+ }
+
+ float newOffset;
+ float newRotation;
+
+ float rotationSpeed;
+
+ NvFlexTriangleMeshId mesh;
+};
+ \ No newline at end of file
diff --git a/demo/scenes/clothlayers.h b/demo/scenes/clothlayers.h
new file mode 100644
index 0000000..eb1a01f
--- /dev/null
+++ b/demo/scenes/clothlayers.h
@@ -0,0 +1,81 @@
+
+
+class ClothLayers : public Scene
+{
+public:
+
+ ClothLayers(const char* name) :
+ Scene(name) {}
+
+ virtual void Initialize()
+ {
+
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.8f;
+ float shearStiffness = 0.5f;
+
+ int dimx = 64;
+ int dimz = 64;
+ float radius = 0.05f;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide);
+
+#if 1
+ CreateSpringGrid(Vec3(-0.6f, 2.9f, -0.6f), dimx, dimz, 1, radius, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+ CreateSpringGrid(Vec3(-0.6f, 2.6f, -0.6f), dimx, dimz, 1, radius, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+ CreateSpringGrid(Vec3(-0.6f, 2.3f, -0.6f), dimx, dimz, 1, radius, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+ CreateSpringGrid(Vec3(-0.6f, 2.0f, -0.6f), dimx, dimz, 1, radius, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Mesh* sphere = ImportMesh(GetFilePathByPlatform("../../data/sphere.ply").c_str());
+ sphere->Normalize();
+
+ NvFlexTriangleMeshId mesh = CreateTriangleMesh(sphere);
+ AddTriangleMesh(mesh, Vec3(), Quat(), 2.0f);
+
+ delete sphere;
+#else
+ // This scene can cause the cloth to bounce
+ // Might need to run it a few times to repro
+ CreateSpringGrid(Vec3(-0.6f, 2.9f, -0.6f), dimx, dimz, 1, radius, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Mesh* disc = CreateDiscMesh(2.0f, 300);
+ disc->m_positions[0].y -= 0.25f;
+ disc->CalculateNormals();
+ NvFlexTriangleMeshId mesh = CreateTriangleMesh(disc);
+ AddTriangleMesh(mesh, Vec3(0.0f, 2.88f, 1.0f), Quat(), 1.0f);
+ delete disc;
+
+ Mesh* disc1 = CreateDiscMesh(2.0f, 250);
+ disc1->m_positions[0].y -= 0.25f;
+ disc1->CalculateNormals();
+ NvFlexTriangleMeshId mesh1 = CreateTriangleMesh(disc1);
+ AddTriangleMesh(mesh1, Vec3(1.0f, 1.5f, 0.0f), Quat(), 1.0f);
+ delete disc1;
+#endif
+
+ g_params.radius = radius*1.0f;
+ g_params.dynamicFriction = 0.1625f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 8;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.05f;
+ g_params.collisionDistance = radius;
+ g_params.shapeCollisionMargin = radius*0.1f;
+ g_params.relaxationFactor = 1.3f;
+
+ g_numSubsteps = 3;
+
+
+ g_windStrength = 0.0f;
+
+ // draw options
+ g_drawPoints = true;
+ g_drawSprings = false;
+ }
+};
+
diff --git a/demo/scenes/dambreak.h b/demo/scenes/dambreak.h
new file mode 100644
index 0000000..c2f9a40
--- /dev/null
+++ b/demo/scenes/dambreak.h
@@ -0,0 +1,62 @@
+
+
+class DamBreak : public Scene
+{
+public:
+
+ DamBreak(const char* name, float radius) : Scene(name), mRadius(radius) {}
+
+ virtual void Initialize()
+ {
+ const float radius = mRadius;
+ const float restDistance = mRadius*0.65f;
+
+ int dx = int(ceilf(1.0f / restDistance));
+ int dy = int(ceilf(2.0f / restDistance));
+ int dz = int(ceilf(1.0f / restDistance));
+
+ CreateParticleGrid(Vec3(0.0f, restDistance, 0.0f), dx, dy, dz, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), restDistance*0.01f);
+
+ g_sceneLower = Vec3(0.0f, 0.0f, -0.5f);
+ g_sceneUpper = Vec3(3.0f, 0.0f, -0.5f);
+
+ g_numSubsteps = 2;
+
+ g_params.fluid = true;
+ g_params.radius = radius;
+ g_params.fluidRestDistance = restDistance;
+ g_params.dynamicFriction = 0.f;
+ g_params.restitution = 0.001f;
+
+ g_params.numIterations = 3;
+ g_params.relaxationFactor = 1.0f;
+
+ g_params.smoothing = 0.4f;
+ g_params.anisotropyScale = 3.0f / radius;
+
+ g_params.viscosity = 0.001f;
+ g_params.cohesion = 0.1f;
+ g_params.vorticityConfinement = 80.0f;
+ g_params.surfaceTension = 0.0f;
+
+ g_params.numPlanes = 5;
+
+ // limit velocity to CFL condition
+ g_params.maxSpeed = 0.5f*radius*g_numSubsteps / g_dt;
+
+ g_maxDiffuseParticles = 0;
+
+ g_fluidColor = Vec4(0.113f, 0.425f, 0.55f, 1.0f);
+
+ g_waveFrequency = 1.0f;
+ g_waveAmplitude = 2.0f;
+ g_waveFloorTilt = 0.0f;
+
+ // draw options
+ g_drawPoints = true;
+ g_drawEllipsoids = false;
+ g_drawDiffuse = true;
+ }
+
+ float mRadius;
+};
diff --git a/demo/scenes/darts.h b/demo/scenes/darts.h
new file mode 100644
index 0000000..594a2ed
--- /dev/null
+++ b/demo/scenes/darts.h
@@ -0,0 +1,59 @@
+
+class Darts : public Scene
+{
+public:
+
+ Darts(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float radius = 0.1f;
+ int phase = NvFlexMakePhase(0, 0);
+
+ if (1)
+ {
+ Vec3 v = Vec3(10.0f, 0.0f, 0.0f);
+
+ float y = 8.0f;
+
+ g_buffers->positions.push_back(Vec4(0.0f, y, 0.0f, 1.0f));
+ g_buffers->velocities.push_back(v);
+ g_buffers->phases.push_back(phase);
+
+ g_buffers->positions.push_back(Vec4(-1.0f, y, -0.5f, 0.9f));
+ g_buffers->velocities.push_back(v);
+ g_buffers->phases.push_back(phase);
+
+ g_buffers->positions.push_back(Vec4(-1.0f, y, 0.5f, 0.9f));
+ g_buffers->velocities.push_back(v);
+ g_buffers->phases.push_back(phase);
+
+ g_buffers->triangles.push_back(0);
+ g_buffers->triangles.push_back(1);
+ g_buffers->triangles.push_back(2);
+ g_buffers->triangleNormals.push_back(0.0f);
+
+ CreateSpring(0, 1, 1.0f);
+ CreateSpring(1, 2, 1.0f);
+ CreateSpring(2, 0, 1.0f);
+
+ g_buffers->positions[0].y -= radius*2.5f;
+ //g_buffers->positions[0].x = 1.0f;
+ //g_buffers->positions[1].y += radius;
+ }
+
+ g_params.drag = 0.01f;
+ g_params.lift = 0.1f;
+ g_params.dynamicFriction = 0.25f;
+ //g_params.gravity[1] = 0.0f;
+
+ g_drawPoints = false;
+ }
+
+ void Update()
+ {
+ g_params.wind[0] = 0.0f;
+ g_params.wind[1] = 0.0f;
+ g_params.wind[2] = 0.0f;
+ }
+};
diff --git a/demo/scenes/debris.h b/demo/scenes/debris.h
new file mode 100644
index 0000000..39013ff
--- /dev/null
+++ b/demo/scenes/debris.h
@@ -0,0 +1,319 @@
+
+class RigidDebris : public Scene
+{
+public:
+
+ RigidDebris(const char* name) : Scene(name) {}
+
+ struct Instance
+ {
+ Vec3 mTranslation;
+ Quat mRotation;
+ float mLifetime;
+
+ int mGroup;
+ int mParticleOffset;
+
+ int mMeshIndex;
+ };
+
+ struct MeshBatch
+ {
+ GpuMesh* mMesh;
+ NvFlexExtAsset* mAsset;
+
+ std::vector<Matrix44> mInstanceTransforms;
+ };
+
+ struct MeshAsset
+ {
+ const char* file;
+ float scale;
+ };
+
+ void Initialize()
+ {
+ float radius = 0.1f;
+
+ const int numMeshes = 8;
+ MeshAsset meshes[numMeshes] =
+ {
+ { "../../data/rocka.ply", 0.2f },
+ { "../../data/box.ply", 0.1f },
+ { "../../data/torus.obj", 0.3f },
+ { "../../data/rockd.ply", 0.2f },
+ { "../../data/banana.obj", 0.3f },
+ { "../../data/rocka.ply", 0.2f },
+ { "../../data/box.ply", 0.1f },
+ { "../../data/rockd.ply", 0.2f },
+ //"../../data/rockf.ply"
+ };
+
+ for (int i = 0; i < numMeshes; ++i)
+ {
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform(meshes[i].file).c_str());
+ mesh->Normalize(meshes[i].scale);
+
+ const float spacing = radius*0.5f;
+
+ MeshBatch b;
+ b.mAsset = NvFlexExtCreateRigidFromMesh((float*)&mesh->m_positions[0], int(mesh->m_positions.size()), (int*)&mesh->m_indices[0], mesh->m_indices.size(), spacing, -spacing*0.5f);
+ b.mMesh = CreateGpuMesh(mesh);
+
+ mBatches.push_back(b);
+ }
+
+ Mesh* level = ImportMeshFromBin(GetFilePathByPlatform("../../data/testzone.bin").c_str());
+ level->Transform(TranslationMatrix(Point3(-10.0f, 0.0f, 10.0f)));
+
+ NvFlexTriangleMeshId mesh = CreateTriangleMesh(level);
+ AddTriangleMesh(mesh, Vec3(), Quat(), 1.0f);
+
+ delete level;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.6f;
+ g_params.staticFriction = 0.35f;
+ g_params.particleFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 4;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.0f;
+ g_params.lift = 0.0f;
+ g_params.numPlanes = 0;
+ g_params.collisionDistance = radius*0.5f;
+ g_params.particleCollisionMargin = radius*0.25f;
+
+ g_numExtraParticles = 32000;
+
+ g_drawPoints = false;
+
+ g_numSubsteps = 2;
+
+ g_lightDistance *= 3.0f;
+
+ mAttractForce = 0.0f;
+
+ mGroupCounter = 0;
+ mInstances.resize(0);
+ }
+
+ void Update()
+ {
+ // copy transforms out
+ for (int i = 0; i < int(mInstances.size()); ++i)
+ {
+ mInstances[i].mTranslation = g_buffers->rigidTranslations[i];
+ mInstances[i].mRotation = g_buffers->rigidRotations[i];
+ }
+
+ if (g_emit)
+ {
+ // emit new debris
+ int numToEmit = 1;//Rand()%8;
+
+ int particleOffset = NvFlexGetActiveCount(g_flex);
+
+ for (int i = 0; i < numToEmit; ++i)
+ {
+ // choose a random mesh to emit
+ const int meshIndex = Rand() % mBatches.size();
+
+ NvFlexExtAsset* asset = mBatches[meshIndex].mAsset;
+
+ // check we can fit in the container
+ if (int(g_buffers->positions.size()) - particleOffset < asset->numParticles)
+ break;
+
+ Instance inst;
+ inst.mLifetime = 1000.0f;// Randf(5.0f, 60.0f);
+ inst.mParticleOffset = particleOffset;
+ inst.mRotation = QuatFromAxisAngle(UniformSampleSphere(), Randf()*k2Pi);
+
+ float spread = 0.2f;
+ inst.mTranslation = g_emitters[0].mPos + Vec3(Randf(-spread, spread), Randf(-spread, spread), 0.0f);
+ inst.mMeshIndex = meshIndex;
+
+ Vec3 linearVelocity = g_emitters[0].mDir*15.0f;//*Randf(5.0f, 10.0f);//Vec3(Randf(0.0f, 10.0f), 0.0f, 0.0f);
+ Vec3 angularVelocity = Vec3(UniformSampleSphere()*Randf()*k2Pi);
+
+ inst.mGroup = mGroupCounter++;
+
+ const int phase = NvFlexMakePhase(inst.mGroup, 0);
+
+ // generate initial particle positions
+ for (int j = 0; j < asset->numParticles; ++j)
+ {
+ Vec3 localPos = Vec3(&asset->particles[j * 4]) - Vec3(&asset->shapeCenters[0]);
+
+ g_buffers->positions[inst.mParticleOffset + j] = Vec4(inst.mTranslation + inst.mRotation*localPos, 1.0f);
+ g_buffers->velocities[inst.mParticleOffset + j] = linearVelocity + Cross(angularVelocity, localPos);
+ g_buffers->phases[inst.mParticleOffset + j] = phase;
+ }
+
+ particleOffset += asset->numParticles;
+
+ mInstances.push_back(inst);
+ }
+ }
+
+ // destroy old debris pieces
+ for (int i = 0; i < int(mInstances.size());)
+ {
+ Instance& inst = mInstances[i];
+
+ inst.mLifetime -= g_dt;
+
+ if (inst.mLifetime <= 0.0f)
+ {
+ inst = mInstances.back();
+ mInstances.pop_back();
+ }
+ else
+ {
+ ++i;
+ }
+ }
+
+ // compact instances
+ static std::vector<Vec4> particles(g_buffers->positions.size());
+ static std::vector<Vec3> velocities(g_buffers->velocities.size());
+ static std::vector<int> phases(g_buffers->phases.size());
+
+ g_buffers->rigidTranslations.resize(0);
+ g_buffers->rigidRotations.resize(0);
+ g_buffers->rigidCoefficients.resize(0);
+ g_buffers->rigidIndices.resize(0);
+ g_buffers->rigidLocalPositions.resize(0);
+ g_buffers->rigidOffsets.resize(0);
+
+ // start index
+ g_buffers->rigidOffsets.push_back(0);
+
+ // clear mesh batches
+ for (int i = 0; i < int(mBatches.size()); ++i)
+ mBatches[i].mInstanceTransforms.resize(0);
+
+ numActive = 0;
+
+ for (int i = 0; i < int(mInstances.size()); ++i)
+ {
+ Instance& inst = mInstances[i];
+
+ NvFlexExtAsset* asset = mBatches[inst.mMeshIndex].mAsset;
+
+ for (int j = 0; j < asset->numParticles; ++j)
+ {
+ particles[numActive + j] = g_buffers->positions[inst.mParticleOffset + j];
+ velocities[numActive + j] = g_buffers->velocities[inst.mParticleOffset + j];
+ phases[numActive + j] = g_buffers->phases[inst.mParticleOffset + j];
+ }
+
+ g_buffers->rigidCoefficients.push_back(1.0f);
+ g_buffers->rigidTranslations.push_back(inst.mTranslation);
+ g_buffers->rigidRotations.push_back(inst.mRotation);
+
+ for (int j = 0; j < asset->numShapeIndices; ++j)
+ {
+ g_buffers->rigidLocalPositions.push_back(Vec3(&asset->particles[j * 4]) - Vec3(&asset->shapeCenters[0]));
+ g_buffers->rigidIndices.push_back(asset->shapeIndices[j] + numActive);
+ }
+
+ g_buffers->rigidOffsets.push_back(g_buffers->rigidIndices.size());
+
+ mInstances[i].mParticleOffset = numActive;
+
+ // Draw transform
+ Matrix44 xform = TranslationMatrix(Point3(inst.mTranslation - inst.mRotation*Vec3(asset->shapeCenters)))*RotationMatrix(inst.mRotation);
+ mBatches[inst.mMeshIndex].mInstanceTransforms.push_back(xform);
+
+ numActive += asset->numParticles;
+ }
+
+ // update particle buffers
+ g_buffers->positions.assign(&particles[0], particles.size());
+ g_buffers->velocities.assign(&velocities[0], velocities.size());
+ g_buffers->phases.assign(&phases[0], phases.size());
+
+ // rebuild active indices
+ g_buffers->activeIndices.resize(numActive);
+ for (int i = 0; i < numActive; ++i)
+ g_buffers->activeIndices[i] = i;
+
+ if (mAttractForce != 0.0f)
+ {
+ const Vec3 forward(-sinf(g_camAngle.x)*cosf(g_camAngle.y), sinf(g_camAngle.y), -cosf(g_camAngle.x)*cosf(g_camAngle.y));
+
+ Vec3 attractPos = g_camPos + forward*5.0f;
+ float invRadius = 1.0f / 5.0f;
+
+ for (int i = 0; i < int(g_buffers->velocities.size()); ++i)
+ {
+ Vec3 dir = Vec3(g_buffers->positions[i]) - attractPos;
+ float d = Length(dir);
+
+ g_buffers->velocities[i] += Normalize(dir)*Randf(0.0, 1.0f)*mAttractForce*Max(0.0f, 1.0f - d*invRadius);
+ }
+ }
+ }
+
+ virtual void PostInitialize()
+ {
+ g_sceneLower = Vec3(-5.0f, 0.0f, 0.0f);
+ g_sceneUpper = g_sceneLower + Vec3(10.0f, 10.0f, 5.0f);
+ }
+
+ virtual void Sync()
+ {
+ NvFlexSetRigids(g_flex, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size());
+ }
+
+ virtual void KeyDown(int key)
+ {
+ if (key == 'B')
+ {
+ float bombStrength = 10.0f;
+
+ Vec3 bombPos = g_emitters[0].mPos + g_emitters[0].mDir*5.0f;
+ bombPos.y -= 5.0f;
+
+ for (int i = 0; i < int(g_buffers->velocities.size()); ++i)
+ {
+ Vec3 dir = Vec3(g_buffers->positions[i]) - bombPos;
+
+ g_buffers->velocities[i] += Normalize(dir)*bombStrength*Randf(0.0, 1.0f);
+ }
+ }
+
+ if (key == 'V')
+ {
+ if (mAttractForce == 0.0f)
+ mAttractForce = -1.5f;
+ else
+ mAttractForce = 0.0f;
+ }
+ }
+
+ void Draw(int pass)
+ {
+ if (!g_drawMesh)
+ return;
+
+ for (int b = 0; b < int(mBatches.size()); ++b)
+ {
+ if (mBatches[b].mInstanceTransforms.size())
+ {
+ extern Colour gColors[];
+ DrawGpuMeshInstances(mBatches[b].mMesh, &mBatches[b].mInstanceTransforms[0], mBatches[b].mInstanceTransforms.size(), Vec3(gColors[b % 8]));
+ }
+ }
+ }
+
+ float mAttractForce;
+
+ std::vector<MeshBatch> mBatches;
+ int numActive;
+
+ int mGroupCounter;
+ std::vector<Instance> mInstances;
+};
diff --git a/demo/scenes/deformables.h b/demo/scenes/deformables.h
new file mode 100644
index 0000000..2de87d7
--- /dev/null
+++ b/demo/scenes/deformables.h
@@ -0,0 +1,42 @@
+
+
+class Deformables : public Scene
+{
+public:
+
+ Deformables(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ g_params.dynamicFriction = 0.25f;
+
+ for (int i=0; i < 5; i++)
+ AddRandomConvex(10, Vec3(i*2.0f, 0.0f, Randf(0.0f, 2.0f)), 0.5f, 1.0f, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi));
+
+ if (0)
+ {
+ int group = 0;
+
+ float minSize = 0.2f;
+ float maxSize = 0.4f;
+
+ for (int z=0; z < 1; ++z)
+ for (int y=0; y < 1; ++y)
+ for (int x=0; x < 5; ++x)
+ CreateRandomBody(12, Vec3(2.0f*x, 2.0f + y, 1.0f + 1.0f*z), minSize, maxSize, RandomUnitVector(), Randf(0.0f, k2Pi), 1.0f, NvFlexMakePhase(group++, 0), 0.25f);
+ }
+ else
+ {
+ CreateTetMesh(GetFilePathByPlatform("../../data/tets/duck.tet").c_str(), Vec3(2.0f, 1.0f, 2.0f), 2.00000105f, 1.0f, 0);
+ CreateTetMesh(GetFilePathByPlatform("../../data/tets/duck.tet").c_str(), Vec3(2.0f, 3.0f, 2.0f), 2.00000105f, 1.0f, 1);
+ }
+
+ g_params.numIterations = 5;
+ g_params.relaxationFactor = 1.0f;
+ g_params.radius = 0.025f;
+
+ // draw options
+ g_drawPoints = true;
+ g_drawSprings = false;
+ }
+};
diff --git a/demo/scenes/envcloth.h b/demo/scenes/envcloth.h
new file mode 100644
index 0000000..7405739
--- /dev/null
+++ b/demo/scenes/envcloth.h
@@ -0,0 +1,77 @@
+
+
+class EnvironmentalCloth: public Scene
+{
+public:
+
+ EnvironmentalCloth(const char* name, int dimx, int dimz, int gridx, int gridz) :
+ Scene(name),
+ mDimX(dimx),
+ mDimZ(dimz),
+ mGridX(gridx),
+ mGridZ(gridz) {}
+
+ virtual void Initialize()
+ {
+ float scale = 1.0f;
+
+ float minSize = 0.5f*scale;
+ float maxSize = 1.0f*scale;
+
+ for (int i=0; i < 5; i++)
+ AddRandomConvex(10, Vec3(i*2.0f, 0.0f, Randf(0.0f, 2.0f)), minSize, maxSize, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi));
+
+ float stretchStiffness = 0.9f;
+ float bendStiffness = 0.8f;
+ float shearStiffness = 0.5f;
+
+ int dimx = mDimX;
+ int dimz = mDimZ;
+ float radius = 0.05f*scale;
+ g_params.gravity[1] *= scale;
+
+ int gridx = mGridX;
+ int gridz = mGridZ;
+
+ int clothIndex = 0;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide);
+
+ for (int x=0; x < gridx; ++x)
+ {
+ for (int y=0; y < 1; ++y)
+ {
+ for (int z=0; z < gridz; ++z)
+ {
+ clothIndex++;
+
+ CreateSpringGrid(Vec3(x*dimx*radius, scale*(1.0f + z*0.5f), z*dimx*radius), dimx, dimz, 1, radius, phase, stretchStiffness, bendStiffness, shearStiffness, Vec3(Randf(-0.2f, 0.2f)), 1.0f);
+ }
+ }
+ }
+
+ g_params.radius = radius*1.05f;
+ g_params.dynamicFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 8;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.1f;
+ g_params.lift = 0.5f;
+ g_params.collisionDistance = 0.05f;
+
+ // cloth converges faster with a global relaxation factor
+ g_params.relaxationMode = eNvFlexRelaxationGlobal;
+ g_params.relaxationFactor = 0.25f;
+
+ g_windStrength = 0.0f;
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawSprings = false;
+ }
+
+ int mDimX;
+ int mDimZ;
+ int mGridX;
+ int mGridZ;
+};
diff --git a/demo/scenes/flag.h b/demo/scenes/flag.h
new file mode 100644
index 0000000..c8bf3ff
--- /dev/null
+++ b/demo/scenes/flag.h
@@ -0,0 +1,83 @@
+
+class FlagCloth: public Scene
+{
+public:
+
+ FlagCloth(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ int dimx = 64;
+ int dimz = 32;
+ float radius = 0.05f;
+
+ float stretchStiffness = 0.9f;
+ float bendStiffness = 1.0f;
+ float shearStiffness = 0.9f;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide);
+
+ CreateSpringGrid(Vec3(0.0f, 0.0f, -3.0f), dimx, dimz, 1, radius, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+
+ const int c1 = 0;
+ const int c2 = dimx*(dimz-1);
+
+ g_buffers->positions[c1].w = 0.0f;
+ g_buffers->positions[c2].w = 0.0f;
+
+ // add tethers
+ for (int i=0; i < int(g_buffers->positions.size()); ++i)
+ {
+ // hack to rotate cloth
+ swap(g_buffers->positions[i].y, g_buffers->positions[i].z);
+ g_buffers->positions[i].y *= -1.0f;
+
+ g_buffers->velocities[i] = RandomUnitVector()*0.1f;
+
+ float minSqrDist = FLT_MAX;
+
+ if (i != c1 && i != c2)
+ {
+ float stiffness = -0.8f;
+ float give = 0.1f;
+
+ float sqrDist = LengthSq(Vec3(g_buffers->positions[c1])-Vec3(g_buffers->positions[c2]));
+
+ if (sqrDist < minSqrDist)
+ {
+ CreateSpring(c1, i, stiffness, give);
+ CreateSpring(c2, i, stiffness, give);
+
+ minSqrDist = sqrDist;
+ }
+ }
+ }
+
+ g_params.radius = radius*1.0f;
+ g_params.dynamicFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 4;
+ g_params.drag = 0.06f;
+ g_params.relaxationFactor = 1.0f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawSprings = false;
+ g_windFrequency *= 2.0f;
+ g_windStrength = 10.0f;
+
+ }
+
+ void Update()
+ {
+ const Vec3 kWindDir = Vec3(3.0f, 15.0f, 0.0f);
+ const float kNoise = fabsf(Perlin1D(g_windTime*0.05f, 2, 0.25f));
+ Vec3 wind = g_windStrength*kWindDir*Vec3(kNoise, kNoise*0.1f, -kNoise*0.1f);
+
+ g_params.wind[0] = wind.x;
+ g_params.wind[1] = wind.y;
+ g_params.wind[2] = wind.z;
+ }
+};
+
diff --git a/demo/scenes/fluidblock.h b/demo/scenes/fluidblock.h
new file mode 100644
index 0000000..82de2cb
--- /dev/null
+++ b/demo/scenes/fluidblock.h
@@ -0,0 +1,72 @@
+
+
+class FluidBlock : public Scene
+{
+public:
+
+ FluidBlock(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float minSize = 0.5f;
+ float maxSize = 0.7f;
+
+ float radius = 0.1f;
+ float restDistance = radius*0.55f;
+ int group = 0;
+
+ AddRandomConvex(6, Vec3(5.0f, -0.1f, 0.6f), 1.0f, 1.0f, Vec3(1.0f, 1.0f, 0.0f), 0.0f);
+
+ float ly = 0.5f;
+
+ AddRandomConvex(10, Vec3(2.5f, ly*0.5f, 1.f), minSize*0.5f, maxSize*0.5f, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, 2.0f*kPi));
+
+ AddRandomConvex(12, Vec3(3.8f, ly-0.5f, 1.f), minSize, maxSize, Vec3(1.0f, 0.0f, 0.0f), Randf(0.0f, 2.0f*kPi));
+ AddRandomConvex(12, Vec3(3.8f, ly-0.5f, 2.6f), minSize, maxSize, Vec3(1.0f, 0.0f, 0.0f), 0.2f + Randf(0.0f, 2.0f*kPi));
+
+ AddRandomConvex(12, Vec3(4.6f, ly, 0.2f), minSize, maxSize, Vec3(1.0f, 0.0f, 1.0f), Randf(0.0f, 2.0f*kPi));
+ AddRandomConvex(12, Vec3(4.6f, ly, 2.0f), minSize, maxSize, Vec3(1.0f, 0.0f, 1.0f), 0.2f + Randf(0.0f, 2.0f*kPi));
+
+ float size = 0.3f;
+ for (int i=0; i < 32; ++i)
+ CreateParticleShape(GetFilePathByPlatform("../../data/torus.obj").c_str(), Vec3(4.5f, 2.0f + radius*2.0f*i, 1.0f), size, 0.0f, radius*0.5f, Vec3(0.0f, 0.0f, 0.0f), 0.125f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+
+ g_numSolidParticles = g_buffers->positions.size();
+
+ float sizex = 1.76f;
+ float sizey = 2.20f;
+ float sizez = 3.50f;
+
+ int x = int(sizex/restDistance);
+ int y = int(sizey/restDistance);
+ int z = int(sizez/restDistance);
+
+ CreateParticleGrid(Vec3(0.0f, restDistance*0.5f, 0.0f), x, y, z, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid));
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.0f;
+ g_params.fluid = true;
+ g_params.viscosity = 0.0f;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 40.f;
+ g_params.anisotropyScale = 20.0f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.numPlanes = 5;
+ //g_params.cohesion = 0.05f;
+
+ g_maxDiffuseParticles = 128*1024;
+ g_diffuseScale = 0.75f;
+
+ g_waveFloorTilt = -0.025f;
+
+ g_lightDistance *= 0.5f;
+
+ // draw options
+ g_drawDensity = true;
+ g_drawDiffuse = true;
+ g_drawEllipsoids = true;
+ g_drawPoints = false;
+
+ g_warmup = true;
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/fluidclothcoupling.h b/demo/scenes/fluidclothcoupling.h
new file mode 100644
index 0000000..403a775
--- /dev/null
+++ b/demo/scenes/fluidclothcoupling.h
@@ -0,0 +1,192 @@
+
+class FluidClothCoupling : public Scene
+{
+public:
+
+ FluidClothCoupling(const char* name, bool viscous) : Scene(name), mViscous(viscous) {}
+
+ void Initialize()
+ {
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.4f;
+ float shearStiffness = 0.4f;
+
+ int dimx = 32;
+ int dimy = 32;
+ float radius = 0.1f;
+ float invmass = 0.25f;
+ int group = 0;
+
+ {
+ int clothStart = 0;
+
+ CreateSpringGrid(Vec3(0.0f, 1.0f, 0.0f), dimx, dimy, 1, radius*0.25f, NvFlexMakePhase(group++, 0), stretchStiffness, bendStiffness, shearStiffness, Vec3(0.0f), invmass);
+
+ int corner0 = clothStart + 0;
+ int corner1 = clothStart + dimx-1;
+ int corner2 = clothStart + dimx*(dimy-1);
+ int corner3 = clothStart + dimx*dimy-1;
+
+ g_buffers->positions[corner0].w = 0.0f;
+ g_buffers->positions[corner1].w = 0.0f;
+ g_buffers->positions[corner2].w = 0.0f;
+ g_buffers->positions[corner3].w = 0.0f;
+
+ // add tethers
+ for (int i=clothStart; i < int(g_buffers->positions.size()); ++i)
+ {
+ float x = g_buffers->positions[i].x;
+ g_buffers->positions[i].y = 1.5f - sinf(DegToRad(25.0f))*x;
+ g_buffers->positions[i].x = cosf(DegToRad(25.0f))*x;
+
+ //g_buffers->positions[i].y += 0.5f-g_buffers->positions[i].x;
+
+ if (i != corner0 && i != corner1 && i != corner2 && i != corner3)
+ {
+ float stiffness = -0.5f;
+ float give = 0.05f;
+
+ CreateSpring(corner0, i, stiffness, give);
+ CreateSpring(corner1, i, stiffness, give);
+ CreateSpring(corner2, i, stiffness, give);
+ CreateSpring(corner3, i, stiffness, give);
+ }
+ }
+
+ g_buffers->positions[corner1] = g_buffers->positions[corner0] + (g_buffers->positions[corner1]-g_buffers->positions[corner0])*0.9f;
+ g_buffers->positions[corner2] = g_buffers->positions[corner0] + (g_buffers->positions[corner2]-g_buffers->positions[corner0])*0.9f;
+ g_buffers->positions[corner3] = g_buffers->positions[corner0] + (g_buffers->positions[corner3]-g_buffers->positions[corner0])*0.9f;
+ }
+
+ {
+ // net
+ int clothStart = g_buffers->positions.size();
+
+ CreateSpringGrid(Vec3(0.75f, 1.0f, 0.0f), dimx, dimy, 1, radius*0.25f, NvFlexMakePhase(group++, 0), stretchStiffness, bendStiffness, shearStiffness, Vec3(0.0f), invmass);
+
+ int corner0 = clothStart + 0;
+ int corner1 = clothStart + dimx-1;
+ int corner2 = clothStart + dimx*(dimy-1);
+ int corner3 = clothStart + dimx*dimy-1;
+
+ g_buffers->positions[corner0].w = 0.0f;
+ g_buffers->positions[corner1].w = 0.0f;
+ g_buffers->positions[corner2].w = 0.0f;
+ g_buffers->positions[corner3].w = 0.0f;
+
+ // add tethers
+ for (int i=clothStart; i < int(g_buffers->positions.size()); ++i)
+ {
+ if (i != corner0 && i != corner1 && i != corner2 && i != corner3)
+ {
+ float stiffness = -0.5f;
+ float give = 0.1f;
+
+ CreateSpring(corner0, i, stiffness, give);
+ CreateSpring(corner1, i, stiffness, give);
+ CreateSpring(corner2, i, stiffness, give);
+ CreateSpring(corner3, i, stiffness, give);
+ }
+ }
+
+ g_buffers->positions[corner1] = g_buffers->positions[corner0] + (g_buffers->positions[corner1]-g_buffers->positions[corner0])*0.8f;
+ g_buffers->positions[corner2] = g_buffers->positions[corner0] + (g_buffers->positions[corner2]-g_buffers->positions[corner0])*0.8f;
+ g_buffers->positions[corner3] = g_buffers->positions[corner0] + (g_buffers->positions[corner3]-g_buffers->positions[corner0])*0.8f;
+
+ }
+
+ {
+ // net
+ int clothStart = g_buffers->positions.size();
+
+ CreateSpringGrid(Vec3(1.5f, 0.5f, 0.0f), dimx, dimy, 1, radius*0.25f, NvFlexMakePhase(group++, 0), stretchStiffness, bendStiffness, shearStiffness, Vec3(0.0f), invmass);
+
+ int corner0 = clothStart + 0;
+ int corner1 = clothStart + dimx-1;
+ int corner2 = clothStart + dimx*(dimy-1);
+ int corner3 = clothStart + dimx*dimy-1;
+
+ g_buffers->positions[corner0].w = 0.0f;
+ g_buffers->positions[corner1].w = 0.0f;
+ g_buffers->positions[corner2].w = 0.0f;
+ g_buffers->positions[corner3].w = 0.0f;
+
+ // add tethers
+ for (int i=clothStart; i < int(g_buffers->positions.size()); ++i)
+ {
+ if (i != corner0 && i != corner1 && i != corner2 && i != corner3)
+ {
+ float stiffness = -0.5f;
+ float give = 0.1f;
+
+ CreateSpring(corner0, i, stiffness, give);
+ CreateSpring(corner1, i, stiffness, give);
+ CreateSpring(corner2, i, stiffness, give);
+ CreateSpring(corner3, i, stiffness, give);
+ }
+ }
+
+ g_buffers->positions[corner1] = g_buffers->positions[corner0] + (g_buffers->positions[corner1]-g_buffers->positions[corner0])*0.8f;
+ g_buffers->positions[corner2] = g_buffers->positions[corner0] + (g_buffers->positions[corner2]-g_buffers->positions[corner0])*0.8f;
+ g_buffers->positions[corner3] = g_buffers->positions[corner0] + (g_buffers->positions[corner3]-g_buffers->positions[corner0])*0.8f;
+
+ }
+
+ g_numSolidParticles = g_buffers->positions.size();
+ g_ior = 1.0f;
+
+ g_numExtraParticles = 64*1024;
+
+ g_params.radius = radius;
+ g_params.fluid = true;
+ g_params.numIterations = 5;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.anisotropyScale = 30.0f;
+ g_params.fluidRestDistance = g_params.radius*0.5f;
+ g_params.smoothing = 0.5f;
+ g_params.solidPressure = 0.25f;
+ g_numSubsteps = 3;
+ //g_params.numIterations = 6;
+
+ g_params.maxSpeed = 0.5f*g_numSubsteps*g_params.radius/g_dt;
+
+ g_maxDiffuseParticles = 32*1024;
+ g_diffuseScale = 0.5f;
+ g_lightDistance = 3.0f;
+
+ // for viscous goo
+ if (mViscous)
+ {
+ g_fluidColor = Vec4(0.0f, 0.8f, 0.2f, 1.0f);
+
+ g_params.dynamicFriction = 0.3f;
+ g_params.cohesion = 0.025f;
+ g_params.viscosity = 50.85f;
+ }
+ else
+ {
+ g_params.dynamicFriction = 0.125f;
+ g_params.viscosity = 0.1f;
+ g_params.cohesion = 0.0035f;
+ g_params.viscosity = 4.0f;
+ }
+
+ g_emitters[0].mEnabled = false;
+
+ Emitter e;
+ e.mDir = Normalize(Vec3(1.0f, 0.0f, 0.0f));
+ e.mEnabled = true;
+ e.mPos = Vec3(-0.25f, 1.75f, 0.5f);
+ e.mRight = Cross(e.mDir, Vec3(0.0f, 0.0f, 1.0f));
+ e.mSpeed = (g_params.fluidRestDistance/(g_dt*2.0f));
+
+ g_emitters.push_back(e);
+
+ // draw options
+ g_drawPoints = false;
+ g_drawSprings = false;
+ g_drawEllipsoids = true;
+ }
+
+ bool mViscous;
+}; \ No newline at end of file
diff --git a/demo/scenes/forcefield.h b/demo/scenes/forcefield.h
new file mode 100644
index 0000000..1ffcd12
--- /dev/null
+++ b/demo/scenes/forcefield.h
@@ -0,0 +1,92 @@
+
+
+class ForceField : public Scene
+{
+public:
+
+
+ ForceField(const char* name) : Scene(name)
+ {
+ }
+
+ virtual void Initialize()
+ {
+ const float radius = 0.01f;
+ const int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide);
+
+ CreateParticleGrid(Vec3(-1.0f, radius, 0.0f), 200, 6, 50, radius*0.5f, Vec3(0.0f), 1.0f, false, 0.0f, phase);
+
+ g_params.radius = radius*1.0f;
+ g_params.dynamicFriction = 0.4f;
+ g_params.staticFriction = 0.4f;
+ g_params.particleFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 2;
+ g_params.viscosity = 0.0f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = true;
+
+ callback = NULL;
+
+ }
+
+ virtual void PostInitialize()
+ {
+ // free previous callback, todo: destruction phase for tests
+ if (callback)
+ NvFlexExtDestroyForceFieldCallback(callback);
+
+ // create new callback
+ callback = NvFlexExtCreateForceFieldCallback(g_flex);
+
+ // expand scene bounds to include force field
+ g_sceneLower -= Vec3(1.0f);
+ g_sceneUpper += Vec3(1.0f);
+ }
+
+ void DrawCircle(const Vec3& pos, const Vec3& u, const Vec3& v, float radius, int segments)
+ {
+ BeginLines();
+
+ Vec3 start = pos + radius*v;
+
+ for (int i=1; i <=segments; ++i)
+ {
+ float theta = k2Pi*(float(i)/segments);
+ Vec3 end = pos + radius*sinf(theta)*u + radius*cosf(theta)*v;
+
+ DrawLine(start, end, Vec4(1.0f));
+
+ start = end;
+ }
+
+ EndLines();
+ }
+
+ virtual void Draw(int phase)
+ {
+ DrawCircle(forcefield.mPosition, Vec3(1.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f), forcefield.mRadius, 20);
+ DrawCircle(forcefield.mPosition, Vec3(0.0f, 0.0f, 1.0f), Vec3(0.0f, 1.0f, 0.0f), forcefield.mRadius, 20);
+ }
+
+ virtual void Update()
+ {
+ float time = g_frame*g_dt;
+
+ (Vec3&)forcefield.mPosition = Vec3((sinf(time)), 0.5f, 0.0f);
+ forcefield.mRadius = (sinf(time*1.5f)*0.5f + 0.5f);
+ forcefield.mStrength = -30.0f;
+ forcefield.mMode = eNvFlexExtModeForce;
+ forcefield.mLinearFalloff = true;
+
+ NvFlexExtSetForceFields(callback, &forcefield, 1);
+ }
+
+ NvFlexExtForceField forcefield;
+
+ NvFlexExtForceFieldCallback* callback;
+
+}; \ No newline at end of file
diff --git a/demo/scenes/frictionmoving.h b/demo/scenes/frictionmoving.h
new file mode 100644
index 0000000..ae8ba8e
--- /dev/null
+++ b/demo/scenes/frictionmoving.h
@@ -0,0 +1,93 @@
+
+class FrictionMovingShape: public Scene
+{
+public:
+
+ FrictionMovingShape(const char* name, int type) :
+ Scene(name), mType(type) {}
+
+ virtual void Initialize()
+ {
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.5f;
+ float shearStiffness = 0.5f;
+
+ float radius = 0.05f;
+
+ int dimx = 40;
+ int dimz = 40;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter);
+
+ float spacing = radius*0.8f;
+
+ for (int i=0; i < 3; ++i)
+ CreateSpringGrid(Vec3(-dimx*spacing*0.5f, 1.5f + i*0.2f, -dimz*spacing*0.5f), dimx, dimz, 1, spacing, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+
+ g_params.radius = radius*1.0f;
+ g_params.dynamicFriction = 0.45f;
+ g_params.particleFriction = 0.45f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 8;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.05f;
+ g_params.collisionDistance = radius*0.5f;
+ g_params.relaxationMode = eNvFlexRelaxationGlobal;
+ g_params.relaxationFactor = 0.25f;
+ g_params.numPlanes = 1;
+
+ g_numSubsteps = 2;
+
+ g_windStrength = 0.0f;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawSprings = false;
+
+ g_lightDistance *= 1.5f;
+
+ mTime = 0.0f;
+ }
+
+ void Update()
+ {
+ ClearShapes();
+
+ mTime += g_dt;
+
+ // let cloth settle on object
+ float startTime = 1.0f;
+
+ float time = Max(0.0f, mTime-startTime);
+ float lastTime = Max(0.0f, time-g_dt);
+
+ const float rotationSpeed = 1.0f;
+ const float translationSpeed = 1.0f;
+
+ Vec3 pos = Vec3(translationSpeed*(1.0f-cosf(time)), 0.5f, 0.0f);
+ Vec3 prevPos = Vec3(translationSpeed*(1.0f-cosf(lastTime)), 0.5f, 0.0f);
+
+ Quat rot = QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), 1.0f-cosf(rotationSpeed*time));
+ Quat prevRot = QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), 1.0f-cosf(rotationSpeed*lastTime));
+
+ switch(mType)
+ {
+ case 0:
+ AddBox(Vec3(1.0f, 0.5f, 1.0f), pos, rot);
+ break;
+ case 1:
+ AddSphere(0.5f, pos, rot);
+ break;
+ case 2:
+ AddCapsule(0.1f, 1.5f, pos, rot);
+ break;
+ };
+
+ g_buffers->shapePrevPositions[0] = Vec4(prevPos, 0.0f);
+ g_buffers->shapePrevRotations[0] = prevRot;
+
+ UpdateShapes();
+ }
+
+ float mTime;
+ int mType;
+}; \ No newline at end of file
diff --git a/demo/scenes/frictionramp.h b/demo/scenes/frictionramp.h
new file mode 100644
index 0000000..f9f36cf
--- /dev/null
+++ b/demo/scenes/frictionramp.h
@@ -0,0 +1,40 @@
+
+
+class FrictionRamp : public Scene
+{
+public:
+
+ FrictionRamp(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float radius = 0.1f;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.35f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 8;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.0f;
+ g_params.lift = 0.0f;
+ g_params.collisionDistance = radius*0.5f;
+
+ g_windStrength = 0.0f;
+
+ g_numSubsteps = 1;
+
+ // draw options
+ g_drawPoints = false;
+ g_wireframe = false;
+ g_drawSprings = false;
+
+ for (int i = 0; i < 3; ++i)
+ {
+ // box
+ CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), Vec3(0.0f, 3.5f, -i*2.0f), 0.5f, 0.0f, radius, 0.0f, 1.0f, true, 1.0f, NvFlexMakePhase(i, 0), true, 0.0f);
+
+ // ramp
+ AddBox(Vec3(5.0f, 0.25f, 1.f), Vec3(3.0f, 1.0f, -i*2.0f), QuatFromAxisAngle(Vec3(0.0f, 0.0f, 1.0f), DegToRad(-11.25f*(i + 1))));
+ }
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/gamemesh.h b/demo/scenes/gamemesh.h
new file mode 100644
index 0000000..6de6bd0
--- /dev/null
+++ b/demo/scenes/gamemesh.h
@@ -0,0 +1,191 @@
+
+class GameMesh : public Scene
+{
+public:
+
+ GameMesh(const char* name, int scene) : Scene(name), mScene(scene) {}
+
+ void Initialize()
+ {
+ Mesh* level = ImportMeshFromBin(GetFilePathByPlatform("../../data/testzone.bin").c_str());
+ level->Normalize(100.0f);
+ level->Transform(TranslationMatrix(Point3(0.0f, -5.0f, 0.0f)));
+ level->CalculateNormals();
+
+ Vec3 lower, upper;
+ level->GetBounds(lower, upper);
+ Vec3 center = (lower+upper)*0.5f;
+
+ NvFlexTriangleMeshId mesh = CreateTriangleMesh(level);
+ AddTriangleMesh(mesh, Vec3(), Quat(), 1.0f);
+
+ delete level;
+
+ int group = 0;
+
+ // rigids
+ if (mScene == 0)
+ {
+ float radius = 0.05f;
+
+ for (int z=0; z < 80; ++z)
+ for (int x=0; x < 80; ++x)
+ CreateParticleGrid(
+ center - Vec3(-16.0f, 0.0f, 15.0f) + 2.0f*Vec3(x*radius*2 - 1.0f, 1.0f + radius, 1.f + z*2.0f*radius) + Vec3(Randf(radius), 0.0f, Randf(radius)),
+ 2, 2 + int(Randf(0.0f, 4.0f)), 2, radius*0.9f, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), 0.0f);
+
+ // separte solid particle count
+ g_numSolidParticles = g_buffers->positions.size();
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.3f;
+ g_params.dissipation = 0.0f;
+ g_params.fluid = false;
+ g_params.fluidRestDistance = g_params.radius*0.5f;
+ g_params.viscosity = 0.05f;
+ g_params.anisotropyScale = 20.0f;
+ g_params.numIterations = 2;
+ g_params.numPlanes = 1;
+ g_params.sleepThreshold = g_params.radius*0.3f;
+ g_params.maxSpeed = g_numSubsteps*g_params.radius/g_dt;
+ g_params.collisionDistance = radius*0.5f;
+ g_params.shapeCollisionMargin = g_params.collisionDistance*0.05f;
+
+ g_numSubsteps = 2;
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = 2.0f*(g_params.radius*0.5f)/g_dt;
+
+ // draw options
+ g_drawPoints = true;
+ g_drawMesh = false;
+ }
+
+ // basic particles
+ if (mScene == 1)
+ {
+ float radius = 0.1f;
+
+ CreateParticleGrid(center - Vec3(2.0f, 7.0f, 2.0f) , 32, 64, 32, radius*1.02f, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), 0.0f);
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.1f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 4;
+ g_params.numPlanes = 1;
+ g_params.fluid = false;
+ g_params.particleCollisionMargin = g_params.radius*0.1f;
+ g_params.restitution = 0.0f;
+
+ g_params.collisionDistance = g_params.radius*0.5f;
+ g_params.shapeCollisionMargin = g_params.collisionDistance*0.05f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = true;
+ }
+
+ // fluid particles
+ if (mScene == 2)
+ {
+ float radius = 0.1f;
+ float restDistance = radius*0.6f;
+
+ CreateParticleGrid(center - Vec3(0.0f, 7.0f, 2.0f) , 32, 64, 32, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), 0.0f);
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.1f;
+ g_params.dissipation = 0.0f;
+ g_params.numPlanes = 1;
+ g_params.fluidRestDistance = restDistance;
+ g_params.viscosity = 0.5f;
+ g_params.numIterations = 3;
+ g_params.anisotropyScale = 30.0f;
+ g_params.smoothing = 0.5f;
+ g_params.fluid = true;
+ g_params.relaxationFactor = 1.0f;
+ g_params.restitution = 0.0f;
+ g_params.smoothing = 0.5f;
+ g_params.collisionDistance = g_params.radius*0.5f;
+ g_params.shapeCollisionMargin = g_params.collisionDistance*0.05f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawEllipsoids = true;
+ g_drawDiffuse = true;
+
+ g_lightDistance = 5.0f;
+ }
+
+ // cloth
+ if (mScene == 3)
+ {
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.8f;
+ float shearStiffness = 0.8f;
+
+ int dimx = 32;
+ int dimz = 32;
+ float radius = 0.05f;
+
+ int gridx = 8;
+ int gridz = 3;
+
+ for (int x=0; x < gridx; ++x)
+ {
+ for (int y=0; y < 1; ++y)
+ {
+ for (int z=0; z < gridz; ++z)
+ {
+ CreateSpringGrid(center - Vec3(9.0f, 1.0f, 0.1f) + Vec3(x*dimx*radius, 0.0f, z*1.0f), dimx, dimz, 1, radius*0.95f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter), stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+ }
+ }
+ }
+
+ Vec3 l, u;
+ GetParticleBounds(l, u);
+
+ Vec3 center = (u+l)*0.5f;
+ printf("%f %f %f\n", center.x, center.y, center.z);
+
+ g_params.radius = radius*1.0f;
+ g_params.dynamicFriction = 0.4f;
+ g_params.staticFriction = 0.5f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 8;
+ g_params.drag = 0.06f;
+ g_params.sleepThreshold = g_params.radius*0.125f;
+ g_params.relaxationFactor = 2.0f;
+ g_params.collisionDistance = g_params.radius;
+ g_params.shapeCollisionMargin = g_params.collisionDistance*0.05f;
+
+ g_windStrength = 0.0f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = false;
+ }
+ }
+
+ virtual void PostInitialize()
+ {
+ // just focus on the particles, don't need to see the whole level
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ g_sceneUpper = upper;
+ g_sceneLower = lower;
+ }
+
+ virtual void CenterCamera(void)
+ {
+ g_camPos = Vec3((g_sceneLower.x+g_sceneUpper.x)*0.5f, min(g_sceneUpper.y*1.25f, 6.0f), g_sceneUpper.z + min(g_sceneUpper.y, 6.0f)*2.0f);
+ g_camAngle = Vec3(0.0f, -DegToRad(15.0f), 0.0f);
+ }
+
+ int mScene;
+};
diff --git a/demo/scenes/googun.h b/demo/scenes/googun.h
new file mode 100644
index 0000000..79ff396
--- /dev/null
+++ b/demo/scenes/googun.h
@@ -0,0 +1,72 @@
+
+class GooGun : public Scene
+{
+public:
+
+ GooGun(const char* name, bool viscous) : Scene(name), mViscous(viscous) {}
+
+ virtual void Initialize()
+ {
+ float minSize = 0.5f;
+ float maxSize = 1.0f;
+
+ float radius = 0.1f;
+
+ for (int i = 0; i < 5; i++)
+ AddRandomConvex(10, Vec3(i*2.0f, 0.0f, Randf(0.0f, 2.0f)), minSize, maxSize, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi*10.0f));
+
+ g_params.radius = radius;
+
+ g_params.fluid = true;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.fluidRestDistance = g_params.radius*0.55f;
+ g_params.anisotropyScale = 2.0f / radius;
+ g_params.smoothing = 0.5f;
+ g_params.relaxationFactor = 1.f;
+ g_params.restitution = 0.0f;
+ g_params.collisionDistance = 0.01f;
+ g_params.shapeCollisionMargin = g_params.collisionDistance*0.25f;
+
+ if (mViscous)
+ {
+ g_fluidColor = Vec4(0.0f, 0.8f, 0.2f, 1.0f);
+
+ g_params.dynamicFriction = 1.0f;
+ g_params.viscosity = 50.0f;
+ g_params.adhesion = 0.5f;
+ g_params.cohesion = 0.3f;
+ g_params.surfaceTension = 0.0f;
+ }
+ else
+ {
+ g_params.dynamicFriction = 0.25f;
+ g_params.viscosity = 0.5f;
+ g_params.cohesion = 0.05f;
+ g_params.adhesion = 0.0f;
+ }
+
+ g_numExtraParticles = 64 * 1024;
+
+#if 1
+ NvFlexDistanceFieldId sdf = CreateSDF(GetFilePathByPlatform("../../data/armadillo.ply").c_str(), 128);
+ AddSDF(sdf, Vec3(2.0f, 0.0f, -1.0f), Quat(), 2.0f);
+#else
+ // Test multiple SDFs
+ NvFlexDistanceFieldId sdf = CreateSDF(GetFilePathByPlatform("../../data/armadillo.ply").c_str(), 128);
+ AddSDF(sdf, Vec3(2.0f, 0.0f, 0.0f), Quat(), 2.0f);
+
+ NvFlexDistanceFieldId sdf2 = CreateSDF(GetFilePathByPlatform("../../data/bunny.ply").c_str(), 128);
+ AddSDF(sdf2, Vec3(4.0f, 0.0f, 0.0f), Quat(), 2.0f);
+#endif
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.fluidRestDistance*2.f / g_dt);
+
+ // draw options
+ g_drawEllipsoids = true;
+ g_pause = false;
+ }
+
+ bool mViscous;
+};
diff --git a/demo/scenes/granularpile.h b/demo/scenes/granularpile.h
new file mode 100644
index 0000000..56a85ea
--- /dev/null
+++ b/demo/scenes/granularpile.h
@@ -0,0 +1,57 @@
+
+
+class GranularPile : public Scene
+{
+public:
+
+ GranularPile(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ // granular pile
+ float radius = 0.075f;
+
+ Vec3 lower(8.0f, 4.0f, 2.0f);
+
+ CreateParticleShape(GetFilePathByPlatform("../../data/sphere.ply").c_str(), lower, 1.0f, 0.0f, radius, 0.0f, 0.f, true, 1.0f, NvFlexMakePhase(1, 0), true, 0.00f);
+ g_numSolidParticles = g_buffers->positions.size();
+
+ CreateParticleShape(GetFilePathByPlatform("../../data/sandcastle.obj").c_str(), Vec3(-2.0f, -radius*0.15f, 0.0f), 4.0f, 0.0f, radius*1.0001f, 0.0f, 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), false, 0.00f);
+
+ g_numSubsteps = 2;
+
+ g_params.radius = radius;
+ g_params.staticFriction = 1.0f;
+ g_params.dynamicFriction = 0.5f;
+ g_params.viscosity = 0.0f;
+ g_params.numIterations = 12;
+ g_params.particleCollisionMargin = g_params.radius*0.25f; // 5% collision margin
+ g_params.sleepThreshold = g_params.radius*0.25f;
+ g_params.shockPropagation = 6.f;
+ g_params.restitution = 0.2f;
+ g_params.relaxationFactor = 1.f;
+ g_params.damping = 0.14f;
+ g_params.numPlanes = 1;
+
+ // draw options
+ g_drawPoints = true;
+ g_warmup = false;
+
+ // hack, change the color of phase 0 particles to 'sand'
+ extern Colour gColors[];
+ gColors[0] = Colour(0.805f, 0.702f, 0.401f);
+ }
+
+ void Update()
+ {
+ // launch ball after 3 seconds
+ if (g_frame == 180)
+ {
+ for (int i=0; i < g_numSolidParticles; ++i)
+ {
+ g_buffers->positions[i].w = 0.9f;
+ g_buffers->velocities[i] = Vec3(-15.0f, 0.0f, 0.0f);
+ }
+ }
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/granularshape.h b/demo/scenes/granularshape.h
new file mode 100644
index 0000000..6d21738
--- /dev/null
+++ b/demo/scenes/granularshape.h
@@ -0,0 +1,36 @@
+
+
+
+class GranularShape : public Scene
+{
+public:
+
+ GranularShape(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ // granular dragon
+ CreateParticleShape(GetFilePathByPlatform("../../data/dragon.obj").c_str(),Vec3(0.0f, 2.5f, 0.0f), 16.0f, DegToRad(-20.0f), g_params.radius*1.05f, Vec3(0.0f, 0.0f, 0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), false, g_params.radius*0.05f);
+
+ AddBox(Vec3(8.0f, 8.0f, 5.0f));
+ g_buffers->shapePositions[0] += Vec4(0.0f, -1.5f, 0.0f, 0.0f);
+
+ g_params.staticFriction = 1.0f;
+ g_params.dynamicFriction = 0.65f;
+ g_params.dissipation = 0.01f;
+ g_params.numIterations = 6;
+ g_params.particleCollisionMargin = g_params.radius*0.5f; // 5% collision margin
+ g_params.sleepThreshold = g_params.radius*0.35f;
+ g_params.shockPropagation = 3.f;
+ g_params.restitution = 0.01f;
+ g_params.gravity[1] *= 1.f;
+
+ g_numSubsteps = 3;
+
+ extern Colour gColors[];
+ gColors[1] = Colour(0.805f, 0.702f, 0.401f);
+
+ // draw options
+ g_drawPoints = true;
+ }
+};
diff --git a/demo/scenes/inflatable.h b/demo/scenes/inflatable.h
new file mode 100644
index 0000000..58f5f08
--- /dev/null
+++ b/demo/scenes/inflatable.h
@@ -0,0 +1,159 @@
+
+
+class Inflatable : public Scene
+{
+public:
+
+ Inflatable(const char* name) : Scene(name) {}
+
+ virtual ~Inflatable()
+ {
+ for (size_t i = 0; i < mCloths.size(); ++i)
+ delete mCloths[i];
+ }
+
+ void AddInflatable(const Mesh* mesh, float overPressure, int phase)
+ {
+ const int startVertex = g_buffers->positions.size();
+
+ // add mesh to system
+ for (size_t i = 0; i < mesh->GetNumVertices(); ++i)
+ {
+ const Vec3 p = Vec3(mesh->m_positions[i]);
+
+ g_buffers->positions.push_back(Vec4(p.x, p.y, p.z, 1.0f));
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);
+ }
+
+ int triOffset = g_buffers->triangles.size();
+ int triCount = mesh->GetNumFaces();
+
+ g_buffers->inflatableTriOffsets.push_back(triOffset / 3);
+ g_buffers->inflatableTriCounts.push_back(mesh->GetNumFaces());
+ g_buffers->inflatablePressures.push_back(overPressure);
+
+ for (size_t i = 0; i < mesh->m_indices.size(); i += 3)
+ {
+ int a = mesh->m_indices[i + 0];
+ int b = mesh->m_indices[i + 1];
+ int c = mesh->m_indices[i + 2];
+
+ Vec3 n = -Normalize(Cross(mesh->m_positions[b] - mesh->m_positions[a], mesh->m_positions[c] - mesh->m_positions[a]));
+ g_buffers->triangleNormals.push_back(n);
+
+ g_buffers->triangles.push_back(a + startVertex);
+ g_buffers->triangles.push_back(b + startVertex);
+ g_buffers->triangles.push_back(c + startVertex);
+ }
+
+ // create a cloth mesh using the global positions / indices
+ ClothMesh* cloth = new ClothMesh(&g_buffers->positions[0], g_buffers->positions.size(), &g_buffers->triangles[triOffset], triCount * 3, 0.8f, 1.0f);
+
+ for (size_t i = 0; i < cloth->mConstraintIndices.size(); ++i)
+ g_buffers->springIndices.push_back(cloth->mConstraintIndices[i]);
+
+ for (size_t i = 0; i < cloth->mConstraintCoefficients.size(); ++i)
+ g_buffers->springStiffness.push_back(cloth->mConstraintCoefficients[i]);
+
+ for (size_t i = 0; i < cloth->mConstraintRestLengths.size(); ++i)
+ g_buffers->springLengths.push_back(cloth->mConstraintRestLengths[i]);
+
+ mCloths.push_back(cloth);
+
+ // add inflatable params
+ g_buffers->inflatableVolumes.push_back(cloth->mRestVolume);
+ g_buffers->inflatableCoefficients.push_back(cloth->mConstraintScale);
+ }
+
+ void Initialize()
+ {
+ mCloths.resize(0);
+
+ float minSize = 0.75f;
+ float maxSize = 1.0f;
+
+ // convex rocks
+ for (int i = 0; i < 5; i++)
+ AddRandomConvex(10, Vec3(i*2.0f, 0.0f, Randf(0.0f, 2.0f)), minSize, maxSize, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi));
+
+ float radius = 0.12f;
+ int group = 0;
+
+ const char* meshes[2] =
+ {
+ "../../data/box_high_weld.ply",
+ "../../data/sphere.ply"
+ };
+
+ mPressure = 1.0f;
+
+ for (int y = 0; y < 2; ++y)
+ {
+ for (int i = 0; i < 4; ++i)
+ {
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform(meshes[(i + y) & 1]).c_str());
+ mesh->Normalize();
+ mesh->Transform(TranslationMatrix(Point3(i*2.0f, 1.0f + y*2.0f, 1.5f)));
+
+ AddInflatable(mesh, mPressure, NvFlexMakePhase(group++, 0));
+
+ delete mesh;
+ }
+ }
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.4f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 10;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.drag = 0.0f;
+ g_params.collisionDistance = 0.01f;
+
+ // better convergence with global relaxation factor
+ g_params.relaxationMode = eNvFlexRelaxationGlobal;
+ g_params.relaxationFactor = 0.25f;
+
+ g_windStrength = 0.0f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawSprings = 0;
+ g_drawCloth = false;
+ }
+
+ virtual void DoGui()
+ {
+ if (imguiSlider("Over Pressure", &mPressure, 0.25f, 3.0f, 0.001f))
+ {
+ for (int i = 0; i < int(g_buffers->inflatablePressures.size()); ++i)
+ g_buffers->inflatablePressures[i] = mPressure;
+ }
+ }
+
+ virtual void Sync()
+ {
+ NvFlexSetInflatables(g_flex, g_buffers->inflatableTriOffsets.buffer, g_buffers->inflatableTriCounts.buffer, g_buffers->inflatableVolumes.buffer, g_buffers->inflatablePressures.buffer, g_buffers->inflatableCoefficients.buffer, mCloths.size());
+ }
+
+ virtual void Draw(int pass)
+ {
+ if (!g_drawMesh)
+ return;
+
+ int indexStart = 0;
+
+ for (size_t i = 0; i < mCloths.size(); ++i)
+ {
+ DrawCloth(&g_buffers->positions[0], &g_buffers->normals[0], NULL, &g_buffers->triangles[indexStart], mCloths[i]->mTris.size(), g_buffers->positions.size(), i % 6, g_params.radius*0.35f);
+
+ indexStart += mCloths[i]->mTris.size() * 3;
+ }
+ }
+
+ float mPressure;
+
+ std::vector<ClothMesh*> mCloths;
+};
diff --git a/demo/scenes/initialoverlap.h b/demo/scenes/initialoverlap.h
new file mode 100644
index 0000000..5c3abe4
--- /dev/null
+++ b/demo/scenes/initialoverlap.h
@@ -0,0 +1,30 @@
+
+
+// tests initial particle overlap, particle should be projected out of the box without high velocity
+class InitialOverlap : public Scene
+{
+public:
+
+ InitialOverlap(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ g_params.radius = 0.1f;
+ g_params.numIterations = 2;
+
+ // test max acceleration clamping is working, test at 5x gravity
+ g_params.maxAcceleration = 50.0f;
+
+ // plinth
+ AddBox(1.0f, Vec3(0.0f, 0.0f, 0.0f));
+
+ g_buffers->positions.push_back(Vec4(0.0f, 0.5f, 0.0f, 1.0f));
+ g_buffers->velocities.push_back(Vec3(0.0f));
+ g_buffers->phases.push_back(0);
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = true;
+ }
+};
diff --git a/demo/scenes/lighthouse.h b/demo/scenes/lighthouse.h
new file mode 100644
index 0000000..e4b410a
--- /dev/null
+++ b/demo/scenes/lighthouse.h
@@ -0,0 +1,59 @@
+
+
+class Lighthouse : public Scene
+{
+public:
+
+ Lighthouse(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float radius = 0.15f;
+ float restDistance = radius*0.6f;
+
+ NvFlexDistanceFieldId sdf = CreateSDF(GetFilePathByPlatform("../../data/lighthouse.ply").c_str(), 128);
+ AddSDF(sdf, Vec3(4.0f, 0.0f, 0.0f), Quat(), 10.f);
+
+ CreateParticleGrid(Vec3(0.0f, 0.3f, 0.0f), 48, 48, 128, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), 0.005f);
+
+ g_sceneLower = 0.0f;
+ g_sceneUpper = Vec3(12, 0.0f, 0.0f);
+
+ g_numSubsteps = 2;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.f;
+ g_params.fluid = true;
+ g_params.viscosity = 0.01f;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 50.0f;
+ g_params.anisotropyScale = 20.0f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.gravity[1] *= 0.5f;
+ g_params.cohesion *= 0.5f;
+
+ g_fluidColor = Vec4(0.413f, 0.725f, 0.85f, 0.7f);
+
+ g_maxDiffuseParticles = 1024 * 1024;
+ g_diffuseScale = 0.3f;
+ g_diffuseShadow = true;
+ g_diffuseColor = 1.0f;
+ g_diffuseMotionScale = 1.0f;
+ g_params.diffuseThreshold *= 10.f;
+ g_params.diffuseBallistic = 4;
+ g_params.diffuseBuoyancy = 2.0f;
+ g_params.diffuseDrag = 1.0f;
+
+ g_params.numPlanes = 5;
+
+ g_waveFrequency = 1.2f;
+ g_waveAmplitude = 2.2f;
+ g_waveFloorTilt = 0.1f;
+
+
+ // draw options
+ g_drawPoints = false;
+ g_drawEllipsoids = true;
+ g_drawDiffuse = true;
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/localspacecloth.h b/demo/scenes/localspacecloth.h
new file mode 100644
index 0000000..f28912e
--- /dev/null
+++ b/demo/scenes/localspacecloth.h
@@ -0,0 +1,134 @@
+
+
+
+class LocalSpaceCloth : public Scene
+{
+public:
+
+ LocalSpaceCloth (const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 1.0f;
+ float shearStiffness = 1.0f;
+
+ float radius = 0.1f;
+
+ CreateSpringGrid(Vec3(0.5f, 1.45f, -0.5f), 32, 20, 1, radius*0.5f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter), stretchStiffness, bendStiffness, shearStiffness, Vec3(0.0f), 1.0f);
+
+ int c1 = 1;
+ int c2 = 20;
+
+ // add tethers
+ for (int i=0; i < int(g_buffers->positions.size()); ++i)
+ {
+ float minSqrDist = FLT_MAX;
+
+ if (i != c1 && i != c2)
+ {
+ float stiffness = -0.8f;
+ float give = 0.01f;
+
+ float sqrDist = LengthSq(Vec3(g_buffers->positions[c1])-Vec3(g_buffers->positions[c2]));
+
+ if (sqrDist < minSqrDist)
+ {
+ CreateSpring(c1, i, stiffness, give);
+ CreateSpring(c2, i, stiffness, give);
+
+ minSqrDist = sqrDist;
+ }
+ }
+ }
+
+
+
+ for (int i=0; i < g_buffers->positions.size(); ++i)
+ {
+ if (g_buffers->positions[i].x == 0.5f)
+ g_buffers->positions[i].w = 0.0f;
+ }
+
+ translation = Vec3(0.0f, 1.0f, 0.0f);
+ size = Vec3(0.5f, 1.1f, 0.6f);
+ rotation = 0.0f;
+ rotationSpeed = 0.0f;
+
+ linearInertialScale = 0.25f;
+ angularInertialScale = 0.25f;
+
+ AddBox(size, translation);
+
+ // initialize our moving frame to the center of the box
+ NvFlexExtMovingFrameInit(&meshFrame, translation, Quat());
+
+ g_numSubsteps = 2;
+
+ g_params.fluid = false;
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.f;
+ g_params.restitution = 0.0f;
+ g_params.shapeCollisionMargin = 0.05f;
+
+ g_params.numIterations = 6;
+
+ // draw options
+ g_drawPoints = false;
+ }
+
+ virtual void DoGui()
+ {
+ imguiSlider("Rotation", &rotationSpeed, 0.0f, 20.0f, 0.1f);
+ imguiSlider("Translation", &translation.x, -2.0f, 2.0f, 0.001f);
+
+ imguiSlider("Linear Inertia", &linearInertialScale, 0.0f, 1.0f, 0.001f);
+ imguiSlider("Angular Inertia", &angularInertialScale, 0.0f, 1.0f, 0.001f);
+
+ }
+
+ virtual void Update()
+ {
+ rotation += rotationSpeed*g_dt;
+
+ // new position of the box center
+ Vec3 newPosition = translation;//meshFrame.GetPosition() + Vec3(float(g_lastdx), 0.0f, float(g_lastdy))*0.001f;
+ Quat newRotation = QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), rotation);
+
+ NvFlexExtMovingFrameUpdate(&meshFrame, newPosition, newRotation, g_dt);
+
+ // update all the particles in the sim with inertial forces
+ NvFlexExtMovingFrameApply(
+ &meshFrame,
+ &g_buffers->positions[0].x,
+ &g_buffers->velocities[0].x,
+ g_buffers->positions.size(),
+ linearInertialScale,
+ angularInertialScale,
+ g_dt);
+
+ // update collision shapes
+ g_buffers->shapePositions.resize(0);
+ g_buffers->shapeRotations.resize(0);
+ g_buffers->shapePrevPositions.resize(0);
+ g_buffers->shapePrevRotations.resize(0);
+ g_buffers->shapeGeometry.resize(0);
+ g_buffers->shapeFlags.resize(0);
+
+ AddBox(size, newPosition, newRotation);
+
+ UpdateShapes();
+ }
+
+ Vec3 size;
+ Vec3 translation;
+ float rotation;
+ float rotationSpeed;
+
+ float linearInertialScale;
+ float angularInertialScale;
+
+ NvFlexExtMovingFrame meshFrame;
+
+ NvFlexTriangleMeshId mesh;
+};
diff --git a/demo/scenes/localspacefluid.h b/demo/scenes/localspacefluid.h
new file mode 100644
index 0000000..494249a
--- /dev/null
+++ b/demo/scenes/localspacefluid.h
@@ -0,0 +1,127 @@
+
+
+class LocalSpaceFluid : public Scene
+{
+public:
+
+ LocalSpaceFluid (const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ const float radius = 0.05f;
+ const float restDistance = radius*0.6f;
+
+ int dx = int(ceilf(1.f / restDistance));
+ int dy = int(ceilf(1.f / restDistance));
+ int dz = int(ceilf(1.f / restDistance));
+
+ CreateParticleGrid(Vec3(0.0f, 1.0f, 0.0f), dx, dy, dz, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), restDistance*0.01f);
+
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Vec3 center = (lower+upper)*0.5f;
+
+ Mesh* shape = ImportMesh("../../data/torus.obj");
+ shape->Transform(ScaleMatrix(Vec3(0.7f)));
+
+ //Mesh* box = ImportMesh("../../data/sphere.ply");
+ //box->Transform(TranslationMatrix(Point3(0.0f, 0.1f, 0.0f))*ScaleMatrix(Vec3(1.5f)));
+
+ // invert box faces
+ for (int i=0; i < int(shape->GetNumFaces()); ++i)
+ swap(shape->m_indices[i*3+0], shape->m_indices[i*3+1]);
+
+ shape->CalculateNormals();
+
+ // shift into torus interior
+ for (int i=0; i < g_buffers->positions.size(); ++i)
+ (Vec3&)(g_buffers->positions[i]) -= Vec3(2.1f, 0.0f, 0.0f);
+
+ mesh = CreateTriangleMesh(shape);
+ AddTriangleMesh(mesh, Vec3(center), Quat(), 1.0f);
+
+ // initialize our moving frame to the center of the box
+ NvFlexExtMovingFrameInit(&meshFrame, center, Quat());
+
+ g_numSubsteps = 2;
+
+ g_params.fluid = true;
+ g_params.radius = radius;
+ g_params.fluidRestDistance = restDistance;
+ g_params.dynamicFriction = 0.f;
+ g_params.restitution = 0.0f;
+ g_params.collisionDistance = 0.05f;
+ g_params.shapeCollisionMargin = 0.00001f;
+ g_params.maxSpeed = g_numSubsteps*restDistance/g_dt;
+
+ g_params.numIterations = 4;
+
+ g_params.smoothing = 0.4f;
+ g_params.anisotropyScale = 3.0f / radius;
+ g_params.viscosity = 0.001f;
+ g_params.cohesion = 0.05f;
+ g_params.surfaceTension = 0.0f;
+
+ translation = center;
+ rotation = 0.0f;
+ rotationSpeed = 0.0f;
+
+ linearInertialScale = 0.25f;
+ angularInertialScale = 0.75f;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawEllipsoids = true;
+ g_drawDiffuse = true;
+ }
+
+ virtual void DoGui()
+ {
+ imguiSlider("Rotation", &rotationSpeed, 0.0f, 7.0f, 0.1f);
+ imguiSlider("Translation", &translation.x, -2.0f, 2.0f, 0.001f);
+ imguiSlider("Linear Inertia", &linearInertialScale, 0.0f, 1.0f, 0.001f);
+ imguiSlider("Angular Inertia", &angularInertialScale, 0.0f, 1.0f, 0.001f);
+ }
+
+ virtual void Update()
+ {
+ rotation += rotationSpeed*g_dt;
+
+ // new position of the box center
+ Vec3 newPosition = translation;//meshFrame.GetPosition() + Vec3(float(g_lastdx), 0.0f, float(g_lastdy))*0.001f;
+ Quat newRotation = QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), rotation);
+
+ NvFlexExtMovingFrameUpdate(&meshFrame, newPosition, newRotation, g_dt);
+
+ // update all the particles in the sim with inertial forces
+ NvFlexExtMovingFrameApply(
+ &meshFrame,
+ &g_buffers->positions[0].x,
+ &g_buffers->velocities[0].x,
+ g_buffers->positions.size(),
+ linearInertialScale,
+ angularInertialScale,
+ g_dt);
+
+ // update torus transform
+ g_buffers->shapePrevPositions[0] = g_buffers->shapePositions[0];
+ g_buffers->shapePrevRotations[0] = g_buffers->shapeRotations[0];
+
+ g_buffers->shapePositions[0] = Vec4(newPosition, 1.0f);
+ g_buffers->shapeRotations[0] = newRotation;
+
+ UpdateShapes();
+ }
+
+ Vec3 translation;
+ float rotation;
+ float rotationSpeed;
+
+ float linearInertialScale;
+ float angularInertialScale;
+
+ NvFlexExtMovingFrame meshFrame;
+
+ NvFlexTriangleMeshId mesh;
+}; \ No newline at end of file
diff --git a/demo/scenes/lowdimensionalshapes.h b/demo/scenes/lowdimensionalshapes.h
new file mode 100644
index 0000000..5d32ea5
--- /dev/null
+++ b/demo/scenes/lowdimensionalshapes.h
@@ -0,0 +1,54 @@
+
+class LowDimensionalShapes: public Scene
+{
+public:
+
+ LowDimensionalShapes(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float radius = 0.1f;
+ int group = 0;
+
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform("../../data/box.ply").c_str());
+
+ CreateParticleShape(mesh, Vec3(0.0f, 1.0f, 0.0f), Vec3(1.2f, 0.001f, 1.2f), 0.0f, radius, Vec3(0.0f, 0.0f, 0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+
+ for (int i=0; i < 64; ++i)
+ CreateParticleShape(mesh, Vec3(i / 8 * radius, 0.0f, i % 8 * radius), Vec3(0.1f, 0.8f, 0.1f), 0.0f, radius, Vec3(0.0f, 0.0f, 0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+
+ delete mesh;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 1.0f;
+ g_params.fluid = false;
+ g_params.fluidRestDistance = radius;
+ g_params.viscosity = 0.0f;
+ g_params.numIterations = 4;
+ g_params.vorticityConfinement = 0.f;
+ g_params.anisotropyScale = 20.0f;
+ g_params.numPlanes = 1;
+ g_params.collisionDistance = radius*0.5f;
+ g_params.shockPropagation = 5.0f;
+
+ g_numSubsteps = 2;
+
+ g_maxDiffuseParticles = 0;
+ g_diffuseScale = 0.75f;
+
+ g_lightDistance *= 1.5f;
+
+ g_fluidColor = Vec4(0.2f, 0.6f, 0.9f, 1.0f);
+
+ // draw options
+ g_drawDensity = false;
+ g_drawDiffuse = false;
+ g_drawEllipsoids = false;
+ g_drawPoints = true;
+ g_drawMesh = false;
+
+ g_warmup = false;
+
+ }
+
+};
diff --git a/demo/scenes/melting.h b/demo/scenes/melting.h
new file mode 100644
index 0000000..c7da792
--- /dev/null
+++ b/demo/scenes/melting.h
@@ -0,0 +1,70 @@
+
+class Melting : public Scene
+{
+public:
+
+ Melting(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ g_params.radius = 0.1f;
+
+ g_params.numIterations = 2;
+ g_params.dynamicFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.viscosity = 0.0f;
+ g_params.fluid = true;
+ g_params.cohesion = 0.0f;
+ g_params.fluidRestDistance = g_params.radius*0.6f;
+ g_params.anisotropyScale = 4.0f / g_params.radius;
+ g_params.smoothing = 0.5f;
+
+ const float spacing = g_params.radius*0.5f;
+
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform("../../data/bunny.ply").c_str());
+
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid);
+ float size = 1.2f;
+
+ for (int i = 0; i < 1; ++i)
+ for (int j = 0; j < 3; ++j)
+ CreateParticleShape(mesh, Vec3(-2.0f + j*size, 3.0f + j*size, i*size), size, 0.0f, spacing, Vec3(0.0f, 0.0f, 0.0f), 1.0f, true, 1.f, phase, false, 0.0f);
+
+ delete mesh;
+
+ // plinth
+ AddBox(2.0f, Vec3(0.0f, 1.0f, 0.0f));
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = true;
+ g_drawMesh = false;
+
+ mFrame = 0;
+ }
+
+ virtual void Update()
+ {
+ const int start = 130;
+
+ if (mFrame >= start)
+ {
+ float stiffness = max(0.0f, 1.0f - (mFrame - start) / 100.0f);
+
+ for (int i = 0; i < g_buffers->rigidCoefficients.size(); ++i)
+ g_buffers->rigidCoefficients[i] = stiffness;
+
+ g_params.cohesion = Lerp(0.05f, 0.0f, stiffness);
+ }
+
+ ++mFrame;
+ }
+
+ virtual void Sync()
+ {
+ NvFlexSetRigids(g_flex, g_buffers->rigidOffsets.buffer, g_buffers->rigidIndices.buffer, g_buffers->rigidLocalPositions.buffer, g_buffers->rigidLocalNormals.buffer, g_buffers->rigidCoefficients.buffer, g_buffers->rigidRotations.buffer, g_buffers->rigidTranslations.buffer, g_buffers->rigidOffsets.size() - 1, g_buffers->rigidIndices.size());
+ }
+
+ int mFrame;
+}; \ No newline at end of file
diff --git a/demo/scenes/mixedpile.h b/demo/scenes/mixedpile.h
new file mode 100644
index 0000000..61bc5a5
--- /dev/null
+++ b/demo/scenes/mixedpile.h
@@ -0,0 +1,221 @@
+
+/*
+class MixedPile : public Scene
+{
+public:
+
+ MixedPile(const char* name) : Scene(name)
+ {
+ }
+
+
+ std::vector<ClothMesh*> mCloths;
+ std::vector<float> mRestVolume;
+ std::vector<int> mTriOffset;
+ std::vector<int> mTriCount;
+ std::vector<float> mOverPressure;
+ std::vector<float> mConstraintScale;
+ std::vector<float> mSplitThreshold;
+
+ void AddInflatable(const Mesh* mesh, float overPressure, int phase, float invmass=1.0f)
+ {
+ const int startVertex = g_buffers->positions.size();
+
+ // add mesh to system
+ for (size_t i=0; i < mesh->GetNumVertices(); ++i)
+ {
+ const Vec3 p = Vec3(mesh->m_positions[i]);
+
+ g_buffers->positions.push_back(Vec4(p.x, p.y, p.z, invmass));
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);
+ }
+
+ int triOffset = g_buffers->triangles.size();
+ int triCount = mesh->GetNumFaces();
+
+ mTriOffset.push_back(triOffset/3);
+ mTriCount.push_back(mesh->GetNumFaces());
+ mOverPressure.push_back(overPressure);
+
+ for (size_t i=0; i < mesh->m_indices.size(); i+=3)
+ {
+ int a = mesh->m_indices[i+0];
+ int b = mesh->m_indices[i+1];
+ int c = mesh->m_indices[i+2];
+
+ Vec3 n = -Normalize(Cross(mesh->m_positions[b]-mesh->m_positions[a], mesh->m_positions[c]-mesh->m_positions[a]));
+ g_buffers->triangleNormals.push_back(n);
+
+ g_buffers->triangles.push_back(a + startVertex);
+ g_buffers->triangles.push_back(b + startVertex);
+ g_buffers->triangles.push_back(c + startVertex);
+ }
+
+ // create a cloth mesh using the global positions / indices
+ ClothMesh* cloth = new ClothMesh(&g_buffers->positions[0], g_buffers->positions.size(), &g_buffers->triangles[triOffset],triCount*3, 0.8f, 1.0f);
+
+ for (size_t i=0; i < cloth->mConstraintIndices.size(); ++i)
+ g_buffers->springIndices.push_back(cloth->mConstraintIndices[i]);
+
+ for (size_t i=0; i < cloth->mConstraintCoefficients.size(); ++i)
+ g_buffers->springStiffness.push_back(cloth->mConstraintCoefficients[i]);
+
+ for (size_t i=0; i < cloth->mConstraintRestLengths.size(); ++i)
+ g_buffers->springLengths.push_back(cloth->mConstraintRestLengths[i]);
+
+ mCloths.push_back(cloth);
+
+ // add inflatable params
+ mRestVolume.push_back(cloth->mRestVolume);
+ mConstraintScale.push_back(cloth->mConstraintScale);
+ }
+
+
+ virtual void Initialize()
+ {
+
+ Vec3 start(0.0f, 0.5f + g_params.radius*0.25f, 0.0f);
+
+ float radius = g_params.radius;
+
+ int group = 1;
+
+ if (1)
+ {
+ mCloths.resize(0);
+ mRestVolume.resize(0);
+ mTriOffset.resize(0);
+ mTriCount.resize(0);
+ mOverPressure.resize(0);
+ mConstraintScale.resize(0);
+ mSplitThreshold.resize(0);
+
+ Vec3 lower(0.0f), upper(0.0f);
+ float size = 1.0f + radius;
+
+ for (int i=0; i < 9; ++i)
+ {
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform("../../data/sphere.ply").c_str());
+ mesh->Normalize();
+ mesh->Transform(TranslationMatrix(Point3(lower.x + i%3*size, upper.y + 2.0f, (upper.z+lower.z)*0.5f + i/3*size)));
+
+ AddInflatable(mesh, 1.0f, NvFlexMakePhase(group++, 0), 2.0f);
+ delete mesh;
+ }
+ }
+
+
+ if (1)
+ {
+ const int minSize[3] = { 2, 1, 3 };
+ const int maxSize[3] = { 4, 3, 6 };
+
+ Vec4 color = Vec4(SrgbToLinear(Colour(Vec4(201.0f, 158.0f, 106.0f, 255.0f)/255.0f)));
+
+ Vec3 lower(0.0f), upper(5.0f);
+ GetParticleBounds(lower,upper);
+
+ int dimx = 3;
+ int dimy = 10;
+ int dimz = 3;
+
+ for (int y=0; y < dimy; ++y)
+ {
+ for (int z=0; z < dimz; ++z)
+ {
+ for (int x=0; x < dimx; ++x)
+ {
+ CreateParticleShape(
+ GetFilePathByPlatform("../../data/box.ply").c_str(),
+ Vec3(x + 0.5f,0,z+ 0.5f)*(1.0f+radius) + Vec3(0.0f, upper.y + (y+2.0f)*maxSize[1]*g_params.radius, 0.0f),
+ Vec3(float(Rand(minSize[0], maxSize[0])),
+ float(Rand(minSize[1], maxSize[1])),
+ float(Rand(minSize[2], maxSize[2])))*g_params.radius*0.9f, 0.0f, g_params.radius*0.9f, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true,0.0f,0.0f, 0.0f, color);
+ }
+ }
+ }
+ }
+
+
+ if (1)
+ {
+ Vec3 lower, upper;
+ GetParticleBounds(lower,upper);
+ Vec3 center = (upper+lower)*0.5f;
+ center.y = upper.y;
+
+ for (int i=0; i < 20; ++i)
+ {
+ Rope r;
+ Vec3 offset = Vec3(sinf(k2Pi*float(i)/20), 0.0f, cosf(k2Pi*float(i)/20));
+
+ CreateRope(r, center + offset, Normalize(offset + Vec3(0.0f, 4.0f, 0.0f)), 1.2f, 50, 50*radius, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide), 0.0f, 10.0f, 0.0f);
+ g_ropes.push_back(r);
+ }
+ }
+
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Vec3 center = (lower+upper)*0.5f;
+ center.y = 0.0f;
+
+ float width = (upper-lower).x;
+ float edge = 0.25f;
+ float height = 1.0f;
+ AddBox(Vec3(edge, height, width), center + Vec3(-width, height/2.0f, 0.0f));
+ AddBox(Vec3(edge, height, width), center + Vec3(width, height/2.0f, 0.0f));
+
+ AddBox(Vec3(width-edge, height, edge), center + Vec3(0.0f, height/2.0f, width-edge));
+ AddBox(Vec3(width-edge, height, edge), center + Vec3(0.0f, height/2.0f, -(width-edge)));
+
+ //g_numExtraParticles = 32*1024;
+ g_numSubsteps = 2;
+ g_params.numIterations = 7;
+
+ g_params.radius *= 1.0f;
+ g_params.solidRestDistance = g_params.radius;
+ g_params.fluidRestDistance = g_params.radius*0.55f;
+ g_params.dynamicFriction = 0.6f;
+ g_params.staticFriction = 0.75f;
+ g_params.particleFriction = 0.3f;
+ g_params.dissipation = 0.0f;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.sleepThreshold = g_params.radius*0.125f;
+ g_params.shockPropagation = 0.0f;
+ g_params.restitution = 0.0f;
+ g_params.collisionDistance = g_params.radius*0.5f;
+ g_params.fluid = false;
+ g_params.maxSpeed = 2.0f*g_params.radius*g_numSubsteps/g_dt;
+
+ // separte solid particle count
+ g_numSolidParticles = g_buffers->positions.size();
+ // number of fluid particles to allocate
+ g_numExtraParticles = 32*1024;
+
+ g_params.numPlanes = 1;
+ g_windStrength = 0.0f;
+
+ g_lightDistance *= 0.5f;
+
+ // draw options
+ g_drawPoints = true;
+ g_expandCloth = g_params.radius*0.5f;
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.radius*0.5f/g_dt);
+ g_emitters[0].mSpeed = (g_params.radius/g_dt);
+
+ extern Colour gColors[];
+ gColors[0] = Colour(0.805f, 0.702f, 0.401f);
+ }
+
+ virtual void Update()
+ {
+ NvFlexSetInflatables(g_flex, &mTriOffset[0], &mTriCount[0], &mRestVolume[0], &mOverPressure[0], &mConstraintScale[0], mCloths.size(), eFlexMemoryHost);
+ }
+
+ int mHeight;
+};
+*/
diff --git a/demo/scenes/nonconvex.h b/demo/scenes/nonconvex.h
new file mode 100644
index 0000000..37a5a6d
--- /dev/null
+++ b/demo/scenes/nonconvex.h
@@ -0,0 +1,47 @@
+
+
+class NonConvex : public Scene
+{
+public:
+
+ NonConvex(const char* name) : Scene(name)
+ {
+ }
+
+ virtual void Initialize()
+ {
+ float radius = 0.15f;
+ int group = 0;
+
+ for (int i = 0; i < 1; ++i)
+ CreateParticleShape(GetFilePathByPlatform("../../data/bowl.obj").c_str(), Vec3(0.0f, 1.0f + 0.5f*i + radius*0.5f, 0.0f), Vec3(1.5f), 0.0f, radius*0.8f, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f, Vec3(0.0f));
+
+ for (int i = 0; i < 50; ++i)
+ CreateParticleShape(GetFilePathByPlatform("../../data/banana.obj").c_str(), Vec3(0.4f, 2.5f + i*0.25f, 0.25f) + RandomUnitVector()*radius*0.25f, Vec3(1), 0.0f, radius, Vec3(0.0f), 1.0f, true, 0.5f, NvFlexMakePhase(group++, 0), true, radius*0.1f, 0.0f, 0.0f, 1.25f*Vec4(0.875f, 0.782f, 0.051f, 1.0f));
+
+ AddBox();
+
+ g_numSubsteps = 3;
+ g_params.numIterations = 3;
+
+ g_params.radius *= 1.0f;
+ g_params.dynamicFriction = 0.35f;
+ g_params.dissipation = 0.0f;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.sleepThreshold = g_params.radius*0.2f;
+ g_params.shockPropagation = 3.0f;
+ g_params.gravity[1] *= 1.0f;
+ g_params.restitution = 0.01f;
+ g_params.damping = 0.25f;
+
+ // draw options
+ g_drawPoints = false;
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.radius*2.0f / g_dt);
+ }
+
+ virtual void Update()
+ {
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/parachutingbunnies.h b/demo/scenes/parachutingbunnies.h
new file mode 100644
index 0000000..04f2052
--- /dev/null
+++ b/demo/scenes/parachutingbunnies.h
@@ -0,0 +1,167 @@
+
+class ParachutingBunnies : public Scene
+{
+public:
+
+ ParachutingBunnies(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.8f;
+ float shearStiffness = 0.8f;
+
+ int dimx = 32;
+ int dimy = 32;
+ float radius = 0.055f;
+
+ float height = 10.0f;
+ float spacing = 1.5f;
+ int numBunnies = 2;
+ int group = 0;
+
+ for (int i=0; i < numBunnies; ++i)
+ {
+ CreateSpringGrid(Vec3(i*dimx*radius, height + i*spacing, 0.0f), dimx, dimy, 1, radius, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide), stretchStiffness, bendStiffness, shearStiffness, Vec3(0.0f), 1.1f);
+
+ const int startIndex = i*dimx*dimy;
+
+ int corner0 = startIndex + 0;
+ int corner1 = startIndex + dimx-1;
+ int corner2 = startIndex + dimx*(dimy-1);
+ int corner3 = startIndex + dimx*dimy-1;
+
+ CreateSpring(corner0, corner1, 1.f,-0.1f);
+ CreateSpring(corner1, corner3, 1.f,-0.1f);
+ CreateSpring(corner3, corner2, 1.f,-0.1f);
+ CreateSpring(corner0, corner2, 1.f,-0.1f);
+ }
+
+ for (int i=0; i < numBunnies; ++i)
+ {
+ Vec3 velocity = RandomUnitVector()*1.0f;
+ float size = radius*8.5f;
+
+ CreateParticleShape(GetFilePathByPlatform("../../data/bunny.ply").c_str(), Vec3(i*dimx*radius + radius*0.5f*dimx - 0.5f*size, height + i*spacing-0.5f, radius*0.5f*dimy - 0.5f), size, 0.0f, radius, velocity, 0.15f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f);
+
+ const int startIndex = i*dimx*dimy;
+ const int attachIndex = g_buffers->positions.size()-1;
+ g_buffers->positions[attachIndex].w = 2.0f;
+
+ int corner0 = startIndex + 0;
+ int corner1 = startIndex + dimx-1;
+ int corner2 = startIndex + dimx*(dimy-1);
+ int corner3 = startIndex + dimx*dimy-1;
+
+ Vec3 attachPosition = (Vec3(g_buffers->positions[corner0]) + Vec3(g_buffers->positions[corner1]) + Vec3(g_buffers->positions[corner2]) + Vec3(g_buffers->positions[corner3]))*0.25f;
+ attachPosition.y = height + i*spacing-0.5f;
+
+ if (1)
+ {
+ int c[4] = {corner0, corner1, corner2, corner3};
+
+ for (int i=0; i < 4; ++i)
+ {
+ Rope r;
+
+ int start = g_buffers->positions.size();
+
+ r.mIndices.push_back(attachIndex);
+
+ Vec3 d0 = Vec3(g_buffers->positions[c[i]])-attachPosition;
+ CreateRope(r, attachPosition, Normalize(d0), 1.2f, int(Length(d0)/radius*1.1f), Length(d0), NvFlexMakePhase(group++, 0), 0.0f, 0.5f, 0.0f);
+
+ r.mIndices.push_back(c[i]);
+ g_ropes.push_back(r);
+
+ int end = g_buffers->positions.size()-1;
+
+
+ CreateSpring(attachIndex, start, 1.2f, -0.5f);
+ CreateSpring(c[i], end, 1.0f);
+ }
+ }
+ }
+
+ if (1)
+ {
+ // falling objects
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Vec3 center = (lower+upper)*0.5f;
+ center.y = 0.0f;
+
+ float width = (upper-lower).x*0.5f;
+ float edge = 0.125f;
+ float height = 0.5f;
+
+ // big blocks
+ for (int i=0; i < 3; ++i)
+ CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), center + Vec3(float(i)-1.0f, 5.0f, 0.0f), radius*9, 0.0f, radius*0.9f, Vec3(0.0f), 0.5f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f, 0.0f, -radius*1.5f);
+
+ // small blocks
+ for (int j=0; j < 2; ++j)
+ for (int i=0; i < 8; ++i)
+ CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), Vec3(lower.x + 0.5f, 0.0f, lower.z - 0.5f) + Vec3(float(i/3), 6.0f + float(j), float(i%3)) + RandomUnitVector()*0.5f, radius*4, 0.0f, radius*0.9f, Vec3(0.0f), 1.f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f, 0.0f, -radius*2.0f);
+
+ g_numSolidParticles = g_buffers->positions.size();
+
+ {
+ AddBox(Vec3(edge, height, width+edge*2.0f), center + Vec3(-width - edge, height/2.0f, 0.0f));
+ AddBox(Vec3(edge, height, width+edge*2.0f), center + Vec3(width + edge, height/2.0f, 0.0f));
+
+ AddBox(Vec3(width+2.0f*edge, height, edge), center + Vec3(0.0f, height/2.0f, -(width+edge)));
+ AddBox(Vec3(width+2.0f*edge, height, edge), center + Vec3(0.0f, height/2.0f, width+edge));
+
+ float fluidWidth = width;
+ float fluidHeight = height*1.25f;
+
+ int particleWidth = int(2.0f*fluidWidth/radius);
+ int particleHeight = int(fluidHeight/radius);
+
+ CreateParticleGrid(center - Vec3(fluidWidth, 0.0f, fluidWidth), particleWidth, particleHeight, particleWidth, radius, Vec3(0.0f), 2.0f, false, 0.0f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid));
+ }
+ }
+
+ g_params.fluid = true;
+ g_params.radius = 0.1f;
+ g_params.fluidRestDistance = radius;
+ g_params.numIterations = 4;
+ g_params.viscosity = 1.0f;
+ g_params.dynamicFriction = 0.05f;
+ g_params.staticFriction = 0.0f;
+ g_params.particleCollisionMargin = 0.0f;
+ g_params.collisionDistance = g_params.fluidRestDistance*0.5f;
+ g_params.vorticityConfinement = 120.0f;
+ g_params.cohesion = 0.0025f;
+ g_params.drag = 0.06f;
+ g_params.lift = 0.f;
+ g_params.solidPressure = 0.0f;
+ g_params.anisotropyScale = 22.0f;
+ g_params.smoothing = 1.0f;
+ g_params.relaxationFactor = 1.0f;
+
+ g_maxDiffuseParticles = 64*1024;
+ g_diffuseScale = 0.25f;
+ g_diffuseShadow = false;
+ g_diffuseColor = 2.5f;
+ g_diffuseMotionScale = 1.5f;
+ g_params.diffuseThreshold *= 0.01f;
+ g_params.diffuseBallistic = 35;
+
+ g_windStrength = 0.0f;
+ g_windFrequency = 0.0f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawEllipsoids = true;
+ g_drawPoints = false;
+ g_drawDiffuse = true;
+ g_drawSprings = 0;
+
+ g_ropeScale = 0.2f;
+ g_warmup = false;
+ }
+};
diff --git a/demo/scenes/pasta.h b/demo/scenes/pasta.h
new file mode 100644
index 0000000..3852029
--- /dev/null
+++ b/demo/scenes/pasta.h
@@ -0,0 +1,47 @@
+
+class Pasta : public Scene
+{
+public:
+
+ Pasta(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float radius = 0.1f;
+ float length = 15.0f;
+ int n = 20;
+
+ for (int i = 0; i < n; ++i)
+ {
+ float theta = k2Pi*float(i) / n;
+
+ Rope r;
+ CreateRope(r, 0.5f*Vec3(cosf(theta), 2.0f, sinf(theta)), Vec3(0.0f, 1.0f, 0.0f), 0.25f, int(length / radius), length, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide));
+ g_ropes.push_back(r);
+ }
+
+ g_numSubsteps = 3;
+
+ Mesh* bowl = ImportMesh(GetFilePathByPlatform("../../data/bowl.obj").c_str());
+ bowl->Normalize(2.0f);
+ bowl->CalculateNormals();
+ bowl->Transform(TranslationMatrix(Point3(-1.0f, 0.0f, -1.0f)));
+
+ NvFlexTriangleMeshId mesh = CreateTriangleMesh(bowl);
+ AddTriangleMesh(mesh, Vec3(), Quat(), 1.0f);
+
+ delete bowl;
+
+ g_params.numIterations = 6;
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.4f;
+ g_params.dissipation = 0.001f;
+ g_params.sleepThreshold = g_params.radius*0.2f;
+ g_params.relaxationFactor = 1.3f;
+ g_params.restitution = 0.0f;
+ g_params.shapeCollisionMargin = 0.01f;
+
+ g_lightDistance *= 0.5f;
+ g_drawPoints = false;
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/plasticbody.h b/demo/scenes/plasticbody.h
new file mode 100644
index 0000000..d5337d2
--- /dev/null
+++ b/demo/scenes/plasticbody.h
@@ -0,0 +1,271 @@
+
+
+class PlasticBody : public Scene
+{
+public:
+
+ PlasticBody(const char* name, const char* mesh) :
+ Scene(name),
+ mFile(mesh),
+ mScale(2.0f),
+ mOffset(0.0f, 1.0f, 0.0f),
+ mRadius(0.1f),
+ mClusterSpacing(1.0f),
+ mClusterRadius(0.0f),
+ mClusterStiffness(0.5f),
+ mLinkRadius(0.0f),
+ mLinkStiffness(1.0f),
+ mGlobalStiffness(1.0f),
+ mSurfaceSampling(0.0f),
+ mVolumeSampling(4.0f),
+ mSkinningFalloff(2.0f),
+ mSkinningMaxDistance(100.0f)
+ {
+ mStack[0] = 1;
+ mStack[1] = 1;
+ mStack[2] = 1;
+ }
+
+ virtual void Initialize()
+ {
+ float radius = mRadius;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.35f;
+ g_params.particleFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 4;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.0f;
+ g_params.lift = 0.0f;
+ g_params.collisionDistance = radius*0.75f;
+
+ g_params.plasticThreshold = 0.0015f;
+ g_params.plasticCreep = 0.125f;
+
+ g_params.relaxationFactor = 0.6f;
+
+ g_windStrength = 0.0f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = false;
+ g_wireframe = false;
+ g_drawSprings = false;
+ g_drawBases = false;
+
+ g_buffers->rigidOffsets.push_back(0);
+
+ mInstances.resize(0);
+
+
+ CreateBodies();
+
+ AddPlinth();
+
+ // fix any particles below the ground plane in place
+ for (int i = 0; i < int(g_buffers->positions.size()); ++i)
+ if (g_buffers->positions[i].y < 0.0f)
+ g_buffers->positions[i].w = 0.0f;
+
+ // expand radius for better self collision
+ g_params.radius *= 1.5f;
+
+ g_lightDistance *= 1.5f;
+ }
+
+ virtual void CreateBodies()
+ {
+ // build soft body
+ for (int x = 0; x < mStack[0]; ++x)
+ {
+ for (int y = 0; y < mStack[1]; ++y)
+ {
+ for (int z = 0; z < mStack[2]; ++z)
+ {
+ CreatePlasticBody(mRadius, mOffset + Vec3(x*(mScale.x + 1), y*(mScale.y + 1), z*(mScale.z + 1))*mRadius, mClusterStiffness, mInstances.size());
+ }
+ }
+ }
+ }
+
+ void CreatePlasticBody(float radius, Vec3 position, float clusterStiffness, int group = 0)
+ {
+ Instance instance;
+
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform(mFile).c_str());
+ mesh->Normalize();
+ mesh->Transform(TranslationMatrix(Point3(position))*ScaleMatrix(mScale*radius));
+
+ instance.mMesh = mesh;
+ instance.mColor = Vec3(0.5f, 0.5f, 1.0f);
+ instance.mOffset = g_buffers->rigidTranslations.size();
+
+ double createStart = GetSeconds();
+
+ // create soft body definition
+ NvFlexExtAsset* asset = NvFlexExtCreateSoftFromMesh(
+ (float*)&instance.mMesh->m_positions[0],
+ instance.mMesh->m_positions.size(),
+ (int*)&instance.mMesh->m_indices[0],
+ instance.mMesh->m_indices.size(),
+ radius,
+ mVolumeSampling,
+ mSurfaceSampling,
+ mClusterSpacing*radius,
+ mClusterRadius*radius,
+ clusterStiffness,
+ mLinkRadius*radius,
+ mLinkStiffness,
+ mGlobalStiffness);
+
+ double createEnd = GetSeconds();
+
+ // create skinning
+ const int maxWeights = 4;
+
+ instance.mSkinningIndices.resize(instance.mMesh->m_positions.size()*maxWeights);
+ instance.mSkinningWeights.resize(instance.mMesh->m_positions.size()*maxWeights);
+
+ for (int i = 0; i < asset->numShapes; ++i)
+ instance.mRigidRestPoses.push_back(Vec3(&asset->shapeCenters[i * 3]));
+
+ double skinStart = GetSeconds();
+
+ NvFlexExtCreateSoftMeshSkinning(
+ (float*)&instance.mMesh->m_positions[0],
+ instance.mMesh->m_positions.size(),
+ asset->shapeCenters,
+ asset->numShapes,
+ mSkinningFalloff,
+ mSkinningMaxDistance,
+ &instance.mSkinningWeights[0],
+ &instance.mSkinningIndices[0]);
+
+ double skinEnd = GetSeconds();
+
+ printf("Created soft in %f ms Skinned in %f\n", (createEnd - createStart)*1000.0f, (skinEnd - skinStart)*1000.0f);
+
+ const int particleOffset = g_buffers->positions.size();
+ const int indexOffset = g_buffers->rigidOffsets.back();
+
+ // add particle data to solver
+ for (int i = 0; i < asset->numParticles; ++i)
+ {
+ g_buffers->positions.push_back(&asset->particles[i * 4]);
+ g_buffers->velocities.push_back(0.0f);
+
+ const int phase = NvFlexMakePhase(group, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter);
+ g_buffers->phases.push_back(phase);
+ }
+
+ // add shape data to solver
+ for (int i = 0; i < asset->numShapeIndices; ++i)
+ g_buffers->rigidIndices.push_back(asset->shapeIndices[i] + particleOffset);
+
+ for (int i = 0; i < asset->numShapes; ++i)
+ {
+ g_buffers->rigidOffsets.push_back(asset->shapeOffsets[i] + indexOffset);
+ g_buffers->rigidTranslations.push_back(Vec3(&asset->shapeCenters[i * 3]));
+ g_buffers->rigidRotations.push_back(Quat());
+ g_buffers->rigidCoefficients.push_back(asset->shapeCoefficients[i]);
+ }
+
+ // add link data to the solver
+ for (int i = 0; i < asset->numSprings; ++i)
+ {
+ g_buffers->springIndices.push_back(asset->springIndices[i * 2 + 0]);
+ g_buffers->springIndices.push_back(asset->springIndices[i * 2 + 1]);
+
+ g_buffers->springStiffness.push_back(asset->springCoefficients[i]);
+ g_buffers->springLengths.push_back(asset->springRestLengths[i]);
+ }
+
+ NvFlexExtDestroyAsset(asset);
+
+ mInstances.push_back(instance);
+ }
+
+ virtual void Draw(int pass)
+ {
+ if (!g_drawMesh)
+ return;
+
+ for (int s = 0; s < int(mInstances.size()); ++s)
+ {
+ const Instance& instance = mInstances[s];
+
+ Mesh m;
+ m.m_positions.resize(instance.mMesh->m_positions.size());
+ m.m_normals.resize(instance.mMesh->m_normals.size());
+ m.m_indices = instance.mMesh->m_indices;
+
+ for (int i = 0; i < int(instance.mMesh->m_positions.size()); ++i)
+ {
+ Vec3 softPos;
+ Vec3 softNormal;
+
+ for (int w = 0; w < 4; ++w)
+ {
+ const int cluster = instance.mSkinningIndices[i * 4 + w];
+ const float weight = instance.mSkinningWeights[i * 4 + w];
+
+ if (cluster > -1)
+ {
+ // offset in the global constraint array
+ int rigidIndex = cluster + instance.mOffset;
+
+ Vec3 localPos = Vec3(instance.mMesh->m_positions[i]) - instance.mRigidRestPoses[cluster];
+
+ Vec3 skinnedPos = g_buffers->rigidTranslations[rigidIndex] + Rotate(g_buffers->rigidRotations[rigidIndex], localPos);
+ Vec3 skinnedNormal = Rotate(g_buffers->rigidRotations[rigidIndex], instance.mMesh->m_normals[i]);
+
+ softPos += skinnedPos*weight;
+ softNormal += skinnedNormal*weight;
+ }
+ }
+
+ m.m_positions[i] = Point3(softPos);
+ m.m_normals[i] = softNormal;
+ }
+
+ DrawMesh(&m, instance.mColor);
+ }
+ }
+
+ struct Instance
+ {
+ Mesh* mMesh;
+ std::vector<int> mSkinningIndices;
+ std::vector<float> mSkinningWeights;
+ vector<Vec3> mRigidRestPoses;
+ Vec3 mColor;
+ int mOffset;
+ };
+
+ std::vector<Instance> mInstances;
+
+ const char* mFile;
+ Vec3 mScale;
+ Vec3 mOffset;
+
+ float mRadius;
+
+ float mClusterSpacing;
+ float mClusterRadius;
+ float mClusterStiffness;
+
+ float mLinkRadius;
+ float mLinkStiffness;
+
+ float mGlobalStiffness;
+
+ float mSurfaceSampling;
+ float mVolumeSampling;
+
+ float mSkinningFalloff;
+ float mSkinningMaxDistance;
+
+ int mStack[3];
+}; \ No newline at end of file
diff --git a/demo/scenes/plasticstack.h b/demo/scenes/plasticstack.h
new file mode 100644
index 0000000..e1543ca
--- /dev/null
+++ b/demo/scenes/plasticstack.h
@@ -0,0 +1,50 @@
+
+class PlasticStack : public Scene
+{
+public:
+
+ PlasticStack(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ g_params.radius = 0.225f;
+
+ g_params.numIterations = 2;
+ g_params.dynamicFriction = 0.5f;
+ g_params.particleFriction = 0.15f;
+ g_params.dissipation = 0.0f;
+ g_params.viscosity = 0.0f;
+
+ AddPlinth();
+
+ const float rotation = -kPi*0.5f;
+ const float spacing = g_params.radius*0.5f;
+
+ // alternative box and sphere shapes
+ const char* mesh[] =
+ {
+ "../../data/box_high.ply",
+ "../../data/sphere.ply"
+ };
+
+ Vec3 lower = Vec3(4.0f, 1.0f, 0.0f);
+ float sizeInc = 0.0f;
+ float size = 1.0f;
+ int group = 0;
+
+ for (int i=0; i < 8; ++i)
+ {
+ CreateParticleShape(GetFilePathByPlatform(mesh[i%2]).c_str(), lower, size + i*sizeInc, rotation, spacing, Vec3(.0f, 0.0f, 0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.0f, 0.0f, g_params.radius*0.5f);
+
+ lower += Vec3(0.0f, size + i*sizeInc + 0.2f, 0.0f);
+ }
+
+ g_params.plasticThreshold = 0.00025f;
+ g_params.plasticCreep = 0.165f;
+
+ g_numSubsteps = 4;
+
+ // draw options
+ g_drawPoints = false;
+ }
+};
diff --git a/demo/scenes/player.h b/demo/scenes/player.h
new file mode 100644
index 0000000..83407ac
--- /dev/null
+++ b/demo/scenes/player.h
@@ -0,0 +1,290 @@
+
+
+/*
+class Player : public Scene
+{
+public:
+
+ Player(const char* filename) : Scene("Player"), mFilename(filename), mRecording(NULL)
+ {
+ }
+
+ virtual void Initialize()
+ {
+ if (!mRecording)
+ mRecording = fopen(mFilename, "rb");
+
+ if (mRecording)
+ fseek(mRecording, 0, SEEK_SET);
+
+ // read first frame
+ ReadFrame();
+
+ g_lightDistance = 100.0f;
+ g_fogDistance = 0.0f;
+
+ g_camSpeed *= 100.0f;
+ g_camNear *= 100.0f;
+ g_camFar *= 100.0f;
+ g_pause = true;
+
+ g_dt = 1.0f/30.0f;
+ g_numSubsteps = 2;
+
+ g_drawPoints = true;
+
+ mInitialActive = g_buffers->activeIndices;
+ }
+
+ virtual void PostInitialize()
+ {
+ g_buffers->activeIndices = mInitialActive;
+
+ NvFlexSetActive(g_flex, &mInitialActive[0], mInitialActive.size(), eFlexMemoryHost);
+ }
+
+ virtual Matrix44 GetBasis()
+ {
+ // Coordinate fip for Unreal captures
+
+ Matrix44 flip = Matrix44::kIdentity;
+ flip.SetCol(1, Vec4(0.0f, 0.0f, -1.0f, 0.0f));
+ flip.SetCol(2, Vec4(0.0f, 1.0f, 0.0f, 0.0f));
+
+ return flip;
+ }
+
+ template<typename Element>
+ void ReadArray(std::vector<Element>& dest, bool enable=true)
+ {
+ if (feof(mRecording))
+ return;
+
+ int length;
+ int r;
+ r = fread(&length, sizeof(int), 1, mRecording);
+
+ if (feof(mRecording))
+ return;
+
+ if (enable)
+ {
+ int numElements = length/sizeof(Element);
+
+ dest.resize(numElements);
+ r = fread(&dest[0], length, 1, mRecording);
+ }
+ else
+ r = fseek(mRecording, length, SEEK_CUR);
+
+ (void)r;
+ }
+
+ virtual void KeyDown(int key)
+ {
+ if (key == '[')
+ {
+ Vec3 lower(FLT_MAX), upper(-FLT_MAX);
+
+ // particle bounds
+ for (int i=0; i < int(g_buffers->activeIndices.size()); ++i)
+ {
+ int index = g_buffers->activeIndices[i];
+
+ lower = Min(Vec3(g_buffers->positions[index]), lower);
+ upper = Max(Vec3(g_buffers->positions[index]), upper);
+ }
+
+ // center camera
+ g_camPos = (lower+upper)*0.5f;
+ g_camPos = GetBasis()*g_camPos;
+ }
+ }
+
+ bool VerifyArray(float* ptr, int n)
+ {
+ for (int i=0; i < n; ++i)
+ if (!isfinite(ptr[i]))
+ return false;
+
+ return true;
+ }
+
+ template <typename Element>
+ void ReadValue(Element& e, bool enable=true)
+ {
+ if (feof(mRecording))
+ return;
+
+ int r;
+ if (enable)
+ r = fread(&e, sizeof(e), 1, mRecording);
+ else
+ r = fseek(mRecording, sizeof(e), SEEK_CUR);
+
+ (void)r;
+ }
+
+ void ReadFrame()
+ {
+ if (!mRecording)
+ return;
+
+ if (feof(mRecording))
+ return;
+
+ // params
+ ReadValue(g_params, true);
+
+ // particle data
+ //ReadArray(g_buffers->positions, true);
+
+ if (true)
+ {
+ for (int i=0; i < int(g_buffers->positions.size()); ++i)
+ {
+ if (!isfinite(g_buffers->positions[i].x) ||
+ !isfinite(g_buffers->positions[i].y) ||
+ !isfinite(g_buffers->positions[i].z))
+ printf("particles failed at frame %d\n", g_frame);
+ }
+ }
+
+ ReadArray(g_buffers->restPositions, true);
+ ReadArray(g_buffers->velocities, true);
+ ReadArray(g_buffers->phases, true);
+ ReadArray(g_buffers->activeIndices, true);
+
+ // spring data
+ ReadArray(g_buffers->springIndices, true);
+ ReadArray(g_buffers->springLengths, true);
+ ReadArray(g_buffers->springStiffness, true);
+
+ // shape data
+ ReadArray(g_buffers->rigidIndices, true);
+ ReadArray(g_buffers->rigidLocalPositions, true);
+ ReadArray(g_buffers->rigidLocalNormals, true);
+
+ ReadArray(g_buffers->rigidCoefficients, true);
+ ReadArray(g_buffers->rigidOffsets, true);
+ ReadArray(g_buffers->rigidRotations, true);
+ ReadArray(g_buffers->rigidTranslations, true);
+
+ if (true)
+ {
+
+ if (!VerifyArray((float*)&g_buffers->rigidLocalPositions[0], g_buffers->rigidLocalPositions.size()*3))
+ printf("rigid local pos failed\n");
+
+ if (!VerifyArray((float*)&g_buffers->rigidTranslations[0], g_buffers->rigidTranslations.size()*3))
+ printf("rigid translations failed\n");
+
+ if (!VerifyArray((float*)&g_buffers->rigidRotations[0], g_buffers->rigidRotations.size()*3))
+ printf("rigid rotations failed\n");
+ }
+
+ // triangle data
+ ReadArray(g_buffers->triangles, true);
+ ReadArray(g_buffers->triangleNormals, true);
+
+ // convex shapes
+ ReadArray(g_buffers->shapeGeometry, true);
+ ReadArray(g_buffers->shapeAabbMin, true);
+ ReadArray(g_buffers->shapeAabbMax, true);
+ ReadArray(g_buffers->shapeStarts, true);
+ ReadArray(g_buffers->shapePositions, true);
+ ReadArray(g_buffers->shapeRotations, true);
+ ReadArray(g_buffers->shapePrevPositions, true);
+ ReadArray(g_buffers->shapePrevRotations, true);
+ ReadArray(g_buffers->shapeFlags, true);
+
+ if (true)
+ {
+ if (!VerifyArray((float*)&g_buffers->shapePositions[0], g_buffers->shapePositions.size()*4))
+ printf("shapes translations invalid\n");
+
+ if (!VerifyArray((float*)&g_buffers->shapeRotations[0], g_buffers->shapeRotations.size()*4))
+ printf("shapes rotations invalid\n");
+ }
+
+ int numMeshes = 0;
+ ReadValue(numMeshes);
+
+ // map serialized mesh ptrs to current meshes
+ std::map<NvFlexTriangleMeshId, NvFlexTriangleMeshId> originalToNewMeshMap;
+
+ for (int i=0; i < numMeshes; ++i)
+ {
+ Mesh m;
+
+ NvFlexTriangleMeshId originalPtr;
+ ReadValue(originalPtr);
+
+ ReadArray(m.m_positions);
+ ReadArray(m.m_indices);
+
+ if (!VerifyArray((float*)&m.m_positions[0], m.m_positions.size()*3))
+ printf("mesh vertices invalid\n");
+
+ printf("Creating mesh: %d faces %d vertices\n", m.GetNumFaces(), m.GetNumVertices());
+
+ Vec3 lower, upper;
+ m.GetBounds(lower, upper);
+ m.CalculateNormals();
+
+ NvFlexTriangleMeshId collisionMesh = NvFlexCreateTriangleMesh();
+ NvFlexUpdateTriangleMesh(collisionMesh, (float*)&m.m_positions[0], (int*)&m.m_indices[0], int(m.m_positions.size()), int(m.m_indices.size())/3, lower, upper, eFlexMemoryHost);
+
+ // create a render mesh
+ g_meshes[collisionMesh] = CreateGpuMesh(&m);
+
+ // create map from captured triangle mesh pointer to our recreated version
+ originalToNewMeshMap[originalPtr] = collisionMesh;
+ }
+
+ int numTriMeshInstances = 0;
+
+ // remap shape ptrs
+ for (int i=0; i < int(g_buffers->shapeFlags.size()); ++i)
+ {
+ if ((g_buffers->shapeFlags[i]&eNvFlexShapeFlagTypeMask) == eNvFlexShapeTriangleMesh)
+ {
+ numTriMeshInstances++;
+
+ NvFlexCollisionGeometry geo = g_buffers->shapeGeometry[g_buffers->shapeStarts[i]];
+
+ if (originalToNewMeshMap.find(geo.triMesh.mesh) == originalToNewMeshMap.end())
+ {
+ printf("Missing mesh for geometry entry\n");
+ assert(0);
+ }
+ else
+ {
+ g_buffers->shapeGeometry[g_buffers->shapeStarts[i]].mTriMesh.mMesh = originalToNewMeshMap[geo.triMesh.mesh];
+ }
+ }
+ }
+
+ printf("Num Tri Meshes: %d Num Tri Mesh Instances: %d\n", int(g_meshes.size()), numTriMeshInstances);
+
+ }
+
+ virtual void Draw(int pass)
+ {
+ }
+
+ virtual void DoGui()
+ {
+ }
+
+ virtual void Update()
+ {
+
+ }
+
+ const char* mFilename;
+ FILE* mRecording;
+
+ std::vector<int> mInitialActive;
+};
+*/
diff --git a/demo/scenes/potpourri.h b/demo/scenes/potpourri.h
new file mode 100644
index 0000000..338a09a
--- /dev/null
+++ b/demo/scenes/potpourri.h
@@ -0,0 +1,117 @@
+
+class PotPourri : public Scene
+{
+public:
+
+ PotPourri(const char* name) : Scene(name)
+ {
+ }
+
+ virtual void Initialize()
+ {
+ int sx = 2;
+ int sy = 2;
+ int sz = 2;
+
+ Vec3 lower(0.0f, 4.2f + g_params.radius*0.25f, 0.0f);
+
+ int dimx = 5;
+ int dimy = 10;
+ int dimz = 5;
+
+ float radius = g_params.radius;
+ int group = 0;
+
+ if (1)
+ {
+ // create a basic grid
+ for (int y=0; y < dimy; ++y)
+ for (int z=0; z < dimz; ++z)
+ for (int x=0; x < dimx; ++x)
+ CreateParticleShape(
+ GetFilePathByPlatform("../../data/box.ply").c_str(),
+ (g_params.radius*0.905f)*Vec3(float(x*sx), float(y*sy), float(z*sz)) + (g_params.radius*0.1f)*Vec3(float(x),float(y),float(z)) + lower,
+ g_params.radius*0.9f*Vec3(float(sx), float(sy), float(sz)), 0.0f, g_params.radius*0.9f, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(group++, 0), true, 0.001f);
+
+ AddPlinth();
+ }
+
+ if (1)
+ {
+ int dimx = 60;
+ int dimy = 40;
+
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.5f;
+ float shearStiffness = 0.7f;
+
+ int clothStart = g_buffers->positions.size();
+
+ CreateSpringGrid(Vec3(0.0f, 0.0f, -1.0f), dimx, dimy, 1, radius*0.5f, NvFlexMakePhase(group++, 0), stretchStiffness, bendStiffness, shearStiffness, Vec3(0.0f), 1.0f);
+
+ int corner0 = clothStart + 0;
+ int corner1 = clothStart + dimx-1;
+ int corner2 = clothStart + dimx*(dimy-1);
+ int corner3 = clothStart + dimx*dimy-1;
+
+ g_buffers->positions[corner0].w = 0.0f;
+ g_buffers->positions[corner1].w = 0.0f;
+ g_buffers->positions[corner2].w = 0.0f;
+ g_buffers->positions[corner3].w = 0.0f;
+
+ // add tethers
+ for (int i=clothStart; i < int(g_buffers->positions.size()); ++i)
+ {
+ float x = g_buffers->positions[i].x;
+ g_buffers->positions[i].y = 4.0f - sinf(DegToRad(15.0f))*x;
+ g_buffers->positions[i].x = cosf(DegToRad(25.0f))*x;
+
+ if (i != corner0 && i != corner1 && i != corner2 && i != corner3)
+ {
+ float stiffness = -0.5f;
+ float give = 0.05f;
+
+ CreateSpring(corner0, i, stiffness, give);
+ CreateSpring(corner1, i, stiffness, give);
+ CreateSpring(corner2, i, stiffness, give);
+ CreateSpring(corner3, i, stiffness, give);
+ }
+ }
+
+ g_buffers->positions[corner1] = g_buffers->positions[corner0] + (g_buffers->positions[corner1]-g_buffers->positions[corner0])*0.9f;
+ g_buffers->positions[corner2] = g_buffers->positions[corner0] + (g_buffers->positions[corner2]-g_buffers->positions[corner0])*0.9f;
+ g_buffers->positions[corner3] = g_buffers->positions[corner0] + (g_buffers->positions[corner3]-g_buffers->positions[corner0])*0.9f;
+ }
+
+
+ for (int i=0; i < 50; ++i)
+ CreateParticleShape(GetFilePathByPlatform("../../data/banana.obj").c_str(), Vec3(0.4f, 8.5f + i*0.25f, 0.25f) + RandomUnitVector()*radius*0.25f, Vec3(1), 0.0f, radius, Vec3(0.0f), 1.0f, true, 0.5f, NvFlexMakePhase(group++, 0), true, radius*0.1f, 0.0f, 0.0f, 1.25f*Vec4(0.875f, 0.782f, 0.051f, 1.0f));
+
+
+ //g_numExtraParticles = 32*1024;
+ g_numSubsteps = 2;
+ g_params.numIterations = 4;
+
+ g_params.radius *= 1.0f;
+ g_params.staticFriction = 0.7f;
+ g_params.dynamicFriction = 0.75f;
+ g_params.dissipation = 0.01f;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.sleepThreshold = g_params.radius*0.25f;
+ g_params.damping = 0.25f;
+ g_params.maxAcceleration = 400.0f;
+
+ g_windStrength = 0.0f;
+
+ // draw options
+ g_drawPoints = false;
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.radius*2.0f/g_dt);
+ }
+
+ virtual void Update()
+ {
+
+ }
+};
diff --git a/demo/scenes/rayleightaylor.h b/demo/scenes/rayleightaylor.h
new file mode 100644
index 0000000..f07fb46
--- /dev/null
+++ b/demo/scenes/rayleightaylor.h
@@ -0,0 +1,143 @@
+
+class RayleighTaylor3D : public Scene
+{
+public:
+
+ RayleighTaylor3D(const char* name) : Scene(name) {}
+
+ int base;
+ int width;
+ int height;
+ int depth;
+
+ virtual void Initialize()
+ {
+ float radius = 0.05f;
+ float restDistance = radius*0.5f;
+
+ width = 128;
+ height = 24;
+ depth = 24;
+
+ base = 4;
+
+ float sep = restDistance*0.9f;
+ int group = 0;
+
+ CreateParticleGrid(Vec3(0.0f, 0.0f, 0.0f), width, base, depth, sep, Vec3(0.0f), 0.0f, false, 0.0f, NvFlexMakePhase(group++, 0), 0.0f);
+ CreateParticleGrid(Vec3(0.0f, base*sep, 0.0f), width, height, depth, sep, Vec3(0.0f), 0.24f, false, 0.0f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), restDistance*0.01f);
+ CreateParticleGrid(Vec3(0.0f, sep*height + base*sep, 0.0f), width, height, depth, sep, Vec3(0.0f), 0.25f, false, 0.0f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), restDistance*0.01f);
+
+ g_params.gravity[1] = -9.f;
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.00f;
+ g_params.fluid = true;
+ g_params.viscosity = 2.0f;
+ g_params.numIterations = 10;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.anisotropyScale = 50.0f;
+ g_params.smoothing = 1.f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.numPlanes = 5;
+ g_params.cohesion = 0.0002125f;
+ g_params.surfaceTension = 0.0f;
+ g_params.collisionDistance = 0.001f;//restDistance*0.5f;
+ //g_params.solidPressure = 0.2f;
+
+ g_params.relaxationFactor = 20.0f;
+ g_numSubsteps = 5;
+
+ g_fluidColor = Vec4(0.2f, 0.6f, 0.9f, 1.0f);
+
+ g_lightDistance *= 0.85f;
+
+ // draw options
+ g_drawDensity = true;
+ g_drawDiffuse = false;
+ g_drawEllipsoids = false;
+ g_drawPoints = true;
+
+ g_blur = 2.0f;
+
+ g_warmup = true;
+ }
+
+ virtual void Update()
+ {
+ if (g_params.numPlanes == 4)
+ g_params.dynamicFriction = 0.2f;
+
+ if (g_frame == 32)
+ {
+ int layer1start = width*depth*base;
+ int layer1end = layer1start + width*height*depth;
+ for (int i = layer1start; i < layer1end; ++i)
+ g_buffers->positions[i].w = 1.0f;
+ }
+ }
+};
+
+class RayleighTaylor2D : public Scene
+{
+public:
+
+ RayleighTaylor2D(const char* name) : Scene(name) {}
+
+ int base;
+ int width;
+ int height;
+ int depth;
+
+ virtual void Initialize()
+ {
+ float radius = 0.05f;
+ float restDistance = radius*0.5f;
+
+ width = 128;
+ height = 24;
+ depth = 1;
+
+ base = 4;
+
+ float sep = restDistance*0.7f;
+ int group = 0;
+
+ CreateParticleGrid(Vec3(0.0f, 0.0f, 0.0f), width, base, depth, sep, Vec3(0.0f), 0.0f, false, 0.0f, NvFlexMakePhase(group++, 0), 0.0f);
+ CreateParticleGrid(Vec3(0.0f, base*sep, 0.0f), width, height, depth, sep, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), restDistance*0.01f);
+ CreateParticleGrid(Vec3(0.0f, sep*height + base*sep, 0.0f), width, height, depth, sep, Vec3(0.0f), 0.25f, false, 0.0f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), restDistance*0.01f);
+
+ g_params.gravity[1] = -9.f;
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.00f;
+ g_params.fluid = true;
+ g_params.viscosity = 0.0f;
+ g_params.numIterations = 10;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.anisotropyScale = 50.0f;
+ g_params.smoothing = 1.f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.numPlanes = 5;
+ g_params.cohesion = 0.0025f;
+ g_params.surfaceTension = 0.0f;
+ g_params.collisionDistance = 0.001f;
+ g_params.restitution = 0.0f;
+
+ g_params.relaxationFactor = 1.0f;
+ g_numSubsteps = 10;
+
+ g_fluidColor = Vec4(0.2f, 0.6f, 0.9f, 1.0f);
+
+ g_lightDistance *= 0.85f;
+
+ // draw options
+ g_drawDensity = false;
+ g_drawDiffuse = false;
+ g_drawEllipsoids = false;
+ g_drawPoints = true;
+
+ g_pointScale = 0.9f;
+ g_blur = 2.0f;
+
+ g_warmup = true;
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/restitution.h b/demo/scenes/restitution.h
new file mode 100644
index 0000000..521f526
--- /dev/null
+++ b/demo/scenes/restitution.h
@@ -0,0 +1,27 @@
+
+
+
+class Restitution : public Scene
+{
+public:
+
+ Restitution(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float radius = 0.05f;
+ CreateParticleGrid(Vec3(0.0f, 1.0f, 0.0f), 1, 1, 1, radius, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), 0.0f);
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.025f;
+ g_params.dissipation = 0.0f;
+ g_params.restitution = 1.0;
+ g_params.numIterations = 4;
+
+ g_numSubsteps = 4;
+
+ // draw options
+ g_drawPoints = true;
+ }
+
+};
diff --git a/demo/scenes/ridigbody.h b/demo/scenes/ridigbody.h
new file mode 100644
index 0000000..a6fd7c0
--- /dev/null
+++ b/demo/scenes/ridigbody.h
@@ -0,0 +1,139 @@
+class RigidBody : public Scene
+{
+public:
+
+ RigidBody(const char* name, const char* mesh) :
+ Scene(name),
+ mFile(mesh),
+ mScale(2.0f),
+ mOffset(0.0f, 1.0f, 0.0f),
+ mRadius(0.1f)
+ {
+ mStack[0] = 1;
+ mStack[1] = 1;
+ mStack[2] = 1;
+ }
+
+ virtual void Initialize()
+ {
+ float radius = mRadius;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.35f;
+ g_params.particleFriction = 0.25f;
+ g_params.numIterations = 4;
+ g_params.collisionDistance = radius*0.75f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = true;
+ g_wireframe = false;
+ g_drawSprings = false;
+ g_drawBases = true;
+
+ g_buffers->rigidOffsets.push_back(0);
+
+ mInstances.resize(0);
+
+
+ CreateBodies();
+
+ // fix any particles below the ground plane in place
+ for (int i = 0; i < int(g_buffers->positions.size()); ++i)
+ if (g_buffers->positions[i].y < 0.0f)
+ g_buffers->positions[i].w = 0.0f;
+
+ // expand radius for better self collision
+ g_params.radius *= 1.5f;
+
+ g_lightDistance *= 1.5f;
+ }
+
+ virtual void CreateBodies()
+ {
+ // build hard body
+ for (int x = 0; x < mStack[0]; ++x)
+ {
+ for (int y = 0; y < mStack[1]; ++y)
+ {
+ for (int z = 0; z < mStack[2]; ++z)
+ {
+ CreateRigidBody(mRadius, mOffset + Vec3(x*(mScale.x + 1), y*(mScale.y + 1), z*(mScale.z + 1))*mRadius);
+ }
+ }
+ }
+ }
+
+ void CreateRigidBody(float radius, Vec3 position, int group = 0)
+ {
+ Instance instance;
+
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform(mFile).c_str());
+ mesh->Normalize();
+ mesh->Transform(TranslationMatrix(Point3(position))*ScaleMatrix(mScale*radius));
+
+ instance.mMesh = mesh;
+ instance.mColor = Vec3(0.5f, 0.5f, 1.0f);
+
+ double createStart = GetSeconds();
+
+ //const float spacing = radius;
+ const float spacing = radius*0.5f;
+
+ NvFlexExtAsset* asset = NvFlexExtCreateRigidFromMesh(
+ (float*)&mesh->m_positions[0],
+ int(mesh->m_positions.size()),
+ (int*)&mesh->m_indices[0],
+ mesh->m_indices.size(),
+ spacing,
+ -spacing*0.5f);
+
+ double createEnd = GetSeconds();
+
+ const int particleOffset = g_buffers->positions.size();
+ const int indexOffset = g_buffers->rigidOffsets.back();
+
+ // add particle data to solver
+ for (int i = 0; i < asset->numParticles; ++i)
+ {
+ g_buffers->positions.push_back(&asset->particles[i * 4]);
+ g_buffers->velocities.push_back(0.0f);
+
+ const int phase = NvFlexMakePhase(group, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter);
+ g_buffers->phases.push_back(phase);
+ }
+
+ // add shape data to solver
+ for (int i = 0; i < asset->numShapeIndices; ++i)
+ g_buffers->rigidIndices.push_back(asset->shapeIndices[i] + particleOffset);
+
+ for (int i = 0; i < asset->numShapes; ++i)
+ {
+ g_buffers->rigidOffsets.push_back(asset->shapeOffsets[i] + indexOffset);
+ g_buffers->rigidTranslations.push_back(Vec3(&asset->shapeCenters[i * 3]));
+ g_buffers->rigidRotations.push_back(Quat());
+ g_buffers->rigidCoefficients.push_back(asset->shapeCoefficients[i]);
+ }
+
+ NvFlexExtDestroyAsset(asset);
+
+ mInstances.push_back(instance);
+ }
+
+ struct Instance
+ {
+ Mesh* mMesh;
+ Vec3 mColor;
+ };
+
+ std::vector<Instance> mInstances;
+
+ const char* mFile;
+ Vec3 mScale;
+ Vec3 mOffset;
+
+ float mRadius;
+
+ int mStack[3];
+}; \ No newline at end of file
diff --git a/demo/scenes/rigidfluidcoupling.h b/demo/scenes/rigidfluidcoupling.h
new file mode 100644
index 0000000..b978eb8
--- /dev/null
+++ b/demo/scenes/rigidfluidcoupling.h
@@ -0,0 +1,61 @@
+
+class RigidFluidCoupling : public Scene
+{
+public:
+
+ RigidFluidCoupling(const char* name) : Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float minSize = 0.5f;
+ float maxSize = 1.0f;
+
+ float radius = 0.1f;
+ int group = 0;
+
+ Randf();
+
+ for (int i=0; i < 5; i++)
+ AddRandomConvex(10, Vec3(i*2.0f, 0.0f, Randf(0.0f, 2.0f)), minSize, maxSize, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi*10.0f));
+
+ for (int z=0; z < 10; ++z)
+ for (int x=0; x < 50; ++x)
+ CreateParticleShape(
+ GetFilePathByPlatform("../../data/box.ply").c_str(),
+ Vec3(x*radius*2 - 1.0f, 1.0f + radius, 1.f + z*2.0f*radius) + 0.5f*Vec3(Randf(radius), 0.0f, Randf(radius)),
+ Vec3(2.0f, 2.0f + Randf(0.0f, 4.0f), 2.0f)*radius*0.5f,
+ 0.0f,
+ radius*0.5f,
+ Vec3(0.0f),
+ 1.0f,
+ true,
+ 1.0f,
+ NvFlexMakePhase(group++, 0),
+ true,
+ 0.0f);
+
+
+ // separte solid particle count
+ g_numSolidParticles = g_buffers->positions.size();
+
+ // number of fluid particles to allocate
+ g_numExtraParticles = 64*1024;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.5f;
+ g_params.fluid = true;
+ g_params.viscosity = 0.1f;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.anisotropyScale = 25.0f;
+ g_params.fluidRestDistance = g_params.radius*0.55f;
+
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = 2.0f*(g_params.fluidRestDistance)/g_dt;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawEllipsoids = true;
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/rigidpile.h b/demo/scenes/rigidpile.h
new file mode 100644
index 0000000..dcd1282
--- /dev/null
+++ b/demo/scenes/rigidpile.h
@@ -0,0 +1,129 @@
+
+class RigidPile : public Scene
+{
+public:
+
+ RigidPile(const char* name, int brickHeight) : Scene(name), mHeight(brickHeight)
+ {
+ }
+
+ virtual void Initialize()
+ {
+ int sx = 2;
+ int sy = mHeight;
+ int sz = 2;
+
+ Vec3 lower(0.0f, 1.5f + g_params.radius*0.25f, 0.0f);
+
+ int dimx = 10;
+ int dimy = 10;
+ int dimz = 10;
+
+ float radius = g_params.radius;
+
+ if (1)
+ {
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform("../../data/box.ply").c_str());
+
+ // create a basic grid
+ for (int y=0; y < dimy; ++y)
+ for (int z=0; z < dimz; ++z)
+ for (int x=0; x < dimx; ++x)
+ CreateParticleShape(
+ mesh,
+ (g_params.radius*0.905f)*Vec3(float(x*sx), float(y*sy), float(z*sz)) + (g_params.radius*0.1f)*Vec3(float(x),float(y),float(z)) + lower,
+ g_params.radius*0.9f*Vec3(float(sx), float(sy), float(sz)), 0.0f, g_params.radius*0.9f, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(g_buffers->rigidOffsets.size()+1, 0), true, 0.002f);// 0.002f);
+
+
+ delete mesh;
+
+ AddPlinth();
+ }
+ else
+ {
+ // brick work
+ int wdimx = 10;
+ int wdimy = 10;
+
+ int bdimx = 4;
+ int bdimy = 2;
+ int bdimz = 2;
+
+ for (int y=0; y < wdimy; ++y)
+ {
+ for (int x=0; x < wdimx; ++x)
+ {
+ Vec3 lower = Vec3(x*bdimx*radius + 0.5f*radius, 0.93f*bdimy*y*radius, 0.0f);
+
+ if (y&1)
+ lower += Vec3(bdimx*0.25f*radius + 0.5f*radius, 0.0f, 0.0f);
+
+ //CreateParticleGrid(lower, bdimx, bdimy, bdimz, radius, Vec3(0.0f), 1.0f, true, g_buffers->rigidOffsets.size()+1, 0.0f);
+ CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), lower + RandomUnitVector()*Vec3(0.0f, 0.0f, 0.0f), Vec3(bdimx*radius, bdimy*radius, bdimz*radius), 0.0f, radius, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(g_buffers->rigidOffsets.size()+1, 0), true, 0.0f, Vec3(0.0f, 0.0f, y*0.0001f));
+ }
+ }
+
+ if (0)
+ {
+ // create a basic grid
+ for (int y=0; y < dimy; ++y)
+ for (int z=0; z < 1; ++z)
+ for (int x=0; x < 1; ++x)
+ CreateParticleShape(
+ GetFilePathByPlatform("../../data/box.ply").c_str(),
+ 0.99f*(g_params.radius)*Vec3(float(x*sx), float(y*sy), float(z*sz)),
+ g_params.radius*Vec3(float(sx), float(sy), float(sz)), 0.0f, g_params.radius, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(g_buffers->rigidOffsets.size()+1, 0), true, 0.0f);
+
+ // create a basic grid
+ for (int y=0; y < dimy; ++y)
+ for (int z=0; z < 1; ++z)
+ for (int x=0; x < 1; ++x)
+ CreateParticleShape(
+ GetFilePathByPlatform("../../data/box.ply").c_str(),
+ 0.99f*(g_params.radius)*Vec3(float(sx*2 + x*sx), float(y*sy), float(z*sz)),
+ g_params.radius*Vec3(float(sx), float(sy), float(sz)), 0.0f, g_params.radius, Vec3(0.0f), 1.0f, true, 1.0f, NvFlexMakePhase(g_buffers->rigidOffsets.size()+1, 0), true, 0.0f);
+ }
+
+ }
+
+
+ if (0)
+ {
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.5f;
+ float shearStiffness = 0.7f;
+
+ int dimx = 40;
+ int dimy = 40;
+
+ CreateSpringGrid(Vec3(-1.0f, 1.0f + g_params.radius*0.5f, -1.0f), dimx, dimy, 1, g_params.radius*0.9f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), stretchStiffness, bendStiffness, shearStiffness, Vec3(0.0f), 1.0f);
+ }
+
+
+ //g_numExtraParticles = 32*1024;
+ g_numSubsteps = 2;
+ g_params.numIterations = 8;
+
+ g_params.radius *= 1.0f;
+ g_params.dynamicFriction = 0.4f;
+ g_params.dissipation = 0.01f;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.sleepThreshold = g_params.radius*0.25f;
+ g_params.shockPropagation = 3.f;
+
+ g_windStrength = 0.0f;
+
+ // draw options
+ g_drawPoints = false;
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.radius*2.0f/g_dt);
+ }
+
+ virtual void Update()
+ {
+
+ }
+
+ int mHeight;
+};
diff --git a/demo/scenes/rigidrotation.h b/demo/scenes/rigidrotation.h
new file mode 100644
index 0000000..8abcb98
--- /dev/null
+++ b/demo/scenes/rigidrotation.h
@@ -0,0 +1,56 @@
+
+
+class RigidRotation : public Scene
+{
+public:
+
+ RigidRotation(const char* name) : Scene(name)
+ {
+ }
+
+ void Initialize()
+ {
+ float radius = 0.1f;
+
+ float dimx = 1.0f;
+ float dimy = 5.0f;
+ float dimz = 1.0f;
+
+ CreateParticleShape(GetFilePathByPlatform("../../data/box.ply").c_str(), Vec3(0.0f, 1.0f, 0.0f), Vec3(dimx, dimy, dimz)*radius, 0.0f, radius, Vec3(0.0f), 1.0f, true, 1.0f, 0, true, 0.0f, 0.0f, 0.0f);
+
+ g_params.radius = radius;
+ g_params.gravity[1] = 0;
+
+ g_params.numIterations = 1;
+ g_numSubsteps = 1;
+
+ g_pause = true;
+
+ g_drawBases = true;
+ }
+
+ void Update()
+ {
+ if (g_frame == 0)
+ {
+ // rotate particles by 90 degrees
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ Vec3 center = (lower + upper)*0.5f;
+
+ Matrix44 rotation = RotationMatrix(DegToRad(95.0f), Vec3(0.0f, 0.0f, 1.0f));
+
+ for (int i = 0; i < int(g_buffers->positions.size()); ++i)
+ {
+ Vec3 delta = Vec3(g_buffers->positions[i]) - center;
+
+ delta = Vec3(rotation*Vec4(delta, 1.0f));
+
+ g_buffers->positions[i].x = center.x + delta.x;
+ g_buffers->positions[i].y = center.y + delta.y;
+ g_buffers->positions[i].z = center.z + delta.z;
+ }
+ }
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/rockpool.h b/demo/scenes/rockpool.h
new file mode 100644
index 0000000..e7c0034
--- /dev/null
+++ b/demo/scenes/rockpool.h
@@ -0,0 +1,78 @@
+
+
+
+class RockPool: public Scene
+{
+public:
+
+ RockPool(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float radius = 0.1f;
+
+ // convex rocks
+ float minSize = 0.1f;
+ float maxSize = 0.5f;
+
+ for (int i=0; i < 4; i++)
+ for (int j=0; j < 2; j++)
+ AddRandomConvex(10, Vec3(48*radius*0.5f + i*maxSize*2.0f, 0.0f, j*maxSize*2.0f), minSize, maxSize, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi));
+
+ CreateParticleGrid(Vec3(0.0f, radius*0.5f, -1.0f), 32, 32, 32, radius*0.55f, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid), 0.005f);
+
+ g_numSubsteps = 2;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.00f;
+ g_params.fluid = true;
+ g_params.viscosity = 0.01f;
+ g_params.numIterations = 2;
+ g_params.vorticityConfinement = 75.0f;
+ g_params.anisotropyScale = 30.0f;
+ g_params.fluidRestDistance = radius*0.6f;
+ g_params.relaxationFactor = 1.0f;
+ g_params.smoothing = 0.5f;
+ g_params.diffuseThreshold *= 0.25f;
+ g_params.cohesion = 0.05f;
+
+ g_maxDiffuseParticles = 64*1024;
+ g_diffuseScale = 0.5f;
+ g_params.diffuseBallistic = 16;
+ g_params.diffuseBuoyancy = 1.0f;
+ g_params.diffuseDrag = 1.0f;
+
+ g_emitters[0].mEnabled = false;
+
+ g_params.numPlanes = 5;
+
+ g_waveFloorTilt = 0.0f;
+ g_waveFrequency = 1.5f;
+ g_waveAmplitude = 2.0f;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawEllipsoids = true;
+ g_drawDiffuse = true;
+ g_lightDistance = 1.8f;
+
+ g_numExtraParticles = 80*1024;
+
+ Emitter e1;
+ e1.mDir = Vec3(-1.0f, 0.0f, 0.0f);
+ e1.mRight = Vec3(0.0f, 0.0f, 1.0f);
+ e1.mPos = Vec3(3.8f, 1.f, 1.f) ;
+ e1.mSpeed = (g_params.fluidRestDistance/g_dt)*2.0f; // 2 particle layers per-frame
+ e1.mEnabled = true;
+
+ Emitter e2;
+ e2.mDir = Vec3(1.0f, 0.0f, 0.0f);
+ e2.mRight = Vec3(0.0f, 0.0f, -1.0f);
+ e2.mPos = Vec3(2.f, 1.f, -0.f);
+ e2.mSpeed = (g_params.fluidRestDistance/g_dt)*2.0f; // 2 particle layers per-frame
+ e2.mEnabled = true;
+
+ g_emitters.push_back(e1);
+ g_emitters.push_back(e2);
+ }
+};
diff --git a/demo/scenes/sdfcollision.h b/demo/scenes/sdfcollision.h
new file mode 100644
index 0000000..aab2182
--- /dev/null
+++ b/demo/scenes/sdfcollision.h
@@ -0,0 +1,54 @@
+
+class SDFCollision : public Scene
+{
+public:
+
+ SDFCollision(const char* name) : Scene(name)
+ {
+ }
+
+ virtual void Initialize()
+ {
+ const int dim = 128;
+
+ NvFlexDistanceFieldId sdf = CreateSDF(GetFilePathByPlatform("../../data/bunny.ply").c_str(), dim);
+
+ AddSDF(sdf, Vec3(-1.f, 0.0f, 0.0f), QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), DegToRad(-45.0f)), 0.5f);
+ AddSDF(sdf, Vec3(0.0f, 0.0f, 0.0f), QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), DegToRad(0.0f)), 1.0f);
+ AddSDF(sdf, Vec3(1.0f, 0.0f, 0.0f), QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), DegToRad(45.0f)), 2.0f);
+
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.8f;
+ float shearStiffness = 0.5f;
+
+ int dimx = 64;
+ int dimz = 64;
+ float radius = 0.05f;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter);
+
+ CreateSpringGrid(Vec3(-0.6f, 2.9f, -0.6f), dimx, dimz, 1, radius*0.75f, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+
+ Vec3 lower, upper;
+ GetParticleBounds(lower, upper);
+
+ g_params.radius = radius*1.0f;
+ g_params.dynamicFriction = 0.4f;
+ g_params.staticFriction = 0.4f;
+ g_params.particleFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 8;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.02f;
+ g_params.lift = 0.1f;
+ g_params.collisionDistance = radius*0.5f;
+ g_params.relaxationFactor = 1.3f;
+
+ g_numSubsteps = 3;
+
+ g_windStrength = 0.0f;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawSprings = false;
+ }
+};
diff --git a/demo/scenes/shapecollision.h b/demo/scenes/shapecollision.h
new file mode 100644
index 0000000..07409b5
--- /dev/null
+++ b/demo/scenes/shapecollision.h
@@ -0,0 +1,101 @@
+
+
+class ShapeCollision : public Scene
+{
+public:
+
+ ShapeCollision(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float maxShapeRadius = 0.25f;
+ float minShapeRadius = 0.1f;
+
+ int dimx = 4;
+ int dimy = 4;
+ int dimz = 4;
+
+ float radius = 0.05f;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide);
+
+ g_numSubsteps = 2;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.restitution = 0.0;
+ g_params.numIterations = 2;
+ g_params.particleCollisionMargin = g_params.radius*0.5f;
+ g_params.shapeCollisionMargin = g_params.radius*0.5f;
+ g_params.maxSpeed = 0.5f*radius*float(g_numSubsteps)/g_dt;
+
+ CreateParticleGrid(Vec3(0.0f, 1.0f + dimy*maxShapeRadius*2.0f, 0.0f), 30, 50, 30, radius, Vec3(0.0f), 1.0f, false, 0.0f, phase, 0.0f);
+
+ Mesh* box = ImportMesh(GetFilePathByPlatform("../../data/box.ply").c_str());
+ box->Normalize(1.0f);
+
+ NvFlexTriangleMeshId mesh = CreateTriangleMesh(box);
+ delete box;
+
+ NvFlexDistanceFieldId sdf = CreateSDF(GetFilePathByPlatform("../../data/bunny.ply").c_str(), 128);
+
+ for (int i=0; i < dimx; ++i)
+ {
+ for (int j=0; j < dimy; ++j)
+ {
+ for (int k=0; k < dimz; ++k)
+ {
+ int type = Rand()%6;
+
+ Vec3 shapeTranslation = Vec3(float(i),float(j) + 0.5f,float(k))*maxShapeRadius*2.0f;
+ Quat shapeRotation = QuatFromAxisAngle(UniformSampleSphere(), Randf()*k2Pi);
+
+ switch(type)
+ {
+ case 0:
+ {
+ AddSphere(Randf(minShapeRadius, maxShapeRadius), shapeTranslation, shapeRotation);
+ break;
+ }
+ case 1:
+ {
+ AddCapsule(Randf(minShapeRadius, maxShapeRadius)*0.5f, Randf()*maxShapeRadius, shapeTranslation, shapeRotation);
+ break;
+ }
+ case 2:
+ {
+ Vec3 extents = 0.75f*Vec3(Randf(minShapeRadius, maxShapeRadius),
+ Randf(minShapeRadius, maxShapeRadius),
+ Randf(minShapeRadius, maxShapeRadius));
+
+ AddBox(extents, shapeTranslation, shapeRotation);
+ break;
+ }
+ case 3:
+ {
+ AddRandomConvex(6 + Rand()%6, shapeTranslation, minShapeRadius, maxShapeRadius, UniformSampleSphere(), Randf()*k2Pi);
+ break;
+ }
+ case 4:
+ {
+ AddTriangleMesh(mesh, shapeTranslation, shapeRotation, Randf(0.5f, 1.0f)*maxShapeRadius);
+ break;
+ }
+ case 5:
+ {
+ AddSDF(sdf, shapeTranslation, shapeRotation, maxShapeRadius*2.0f);
+ break;
+ }
+ };
+ }
+ }
+ }
+ }
+
+ virtual void CenterCamera()
+ {
+ g_camPos.y = 2.0f;
+ g_camPos.z = 6.0f;
+ }
+
+}; \ No newline at end of file
diff --git a/demo/scenes/softbody.h b/demo/scenes/softbody.h
new file mode 100644
index 0000000..c12680c
--- /dev/null
+++ b/demo/scenes/softbody.h
@@ -0,0 +1,325 @@
+
+
+class SoftBody : public Scene
+{
+public:
+
+ SoftBody(const char* name, const char* mesh) :
+ Scene(name),
+ mFile(mesh),
+ mScale(2.0f),
+ mOffset(0.0f, 1.0f, 0.0f),
+ mRadius(0.1f),
+ mClusterSpacing(1.0f),
+ mClusterRadius(0.0f),
+ mClusterStiffness(0.5f),
+ mLinkRadius(0.0f),
+ mLinkStiffness(1.0f),
+ mGlobalStiffness(0.0f),
+ mSurfaceSampling(0.0f),
+ mVolumeSampling(4.0f),
+ mSkinningFalloff(2.0f),
+ mSkinningMaxDistance(100.0f),
+ mPlasticThreshold(0.0f),
+ mPlasticCreep(0.0f),
+ mRelaxationFactor(1.0f),
+ mPlinth(false)
+ {
+ mStack[0] = 1;
+ mStack[1] = 1;
+ mStack[2] = 1;
+ }
+
+ virtual void Initialize()
+ {
+ float radius = mRadius;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.35f;
+ g_params.particleFriction = 0.25f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 4;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.0f;
+ g_params.lift = 0.0f;
+ g_params.collisionDistance = radius*0.75f;
+
+ g_params.plasticThreshold = mPlasticThreshold;
+ g_params.plasticCreep = mPlasticCreep;
+
+ g_params.relaxationFactor = mRelaxationFactor;
+
+ g_windStrength = 0.0f;
+
+ g_numSubsteps = 2;
+
+ // draw options
+ g_drawPoints = false;
+ g_wireframe = false;
+ g_drawSprings = false;
+ g_drawBases = false;
+
+ g_buffers->rigidOffsets.push_back(0);
+
+ mInstances.resize(0);
+
+
+ CreateBodies();
+
+ if (mPlinth) {
+ AddPlinth();
+ }
+
+ // fix any particles below the ground plane in place
+ for (int i = 0; i < int(g_buffers->positions.size()); ++i)
+ if (g_buffers->positions[i].y < 0.0f)
+ g_buffers->positions[i].w = 0.0f;
+
+ // expand radius for better self collision
+ g_params.radius *= 1.5f;
+
+ g_lightDistance *= 1.5f;
+ }
+
+ virtual void CreateBodies()
+ {
+ // build soft body
+ for (int x = 0; x < mStack[0]; ++x)
+ {
+ for (int y = 0; y < mStack[1]; ++y)
+ {
+ for (int z = 0; z < mStack[2]; ++z)
+ {
+ CreateSoftBody(mRadius, mOffset + Vec3(x*(mScale.x + 1), y*(mScale.y + 1), z*(mScale.z + 1))*mRadius, mClusterStiffness, mInstances.size());
+ }
+ }
+ }
+ }
+
+ void CreateSoftBody(float radius, Vec3 position, float clusterStiffness, int group = 0)
+ {
+ Instance instance;
+
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform(mFile).c_str());
+ mesh->Normalize();
+ mesh->Transform(TranslationMatrix(Point3(position))*ScaleMatrix(mScale*radius));
+
+ instance.mMesh = mesh;
+ instance.mColor = Vec3(0.5f, 0.5f, 1.0f);
+ instance.mOffset = g_buffers->rigidTranslations.size();
+
+ double createStart = GetSeconds();
+
+ // create soft body definition
+ NvFlexExtAsset* asset = NvFlexExtCreateSoftFromMesh(
+ (float*)&instance.mMesh->m_positions[0],
+ instance.mMesh->m_positions.size(),
+ (int*)&instance.mMesh->m_indices[0],
+ instance.mMesh->m_indices.size(),
+ radius,
+ mVolumeSampling,
+ mSurfaceSampling,
+ mClusterSpacing*radius,
+ mClusterRadius*radius,
+ clusterStiffness,
+ mLinkRadius*radius,
+ mLinkStiffness,
+ mGlobalStiffness);
+
+ double createEnd = GetSeconds();
+
+ // create skinning
+ const int maxWeights = 4;
+
+ instance.mSkinningIndices.resize(instance.mMesh->m_positions.size()*maxWeights);
+ instance.mSkinningWeights.resize(instance.mMesh->m_positions.size()*maxWeights);
+
+ for (int i = 0; i < asset->numShapes; ++i)
+ instance.mRigidRestPoses.push_back(Vec3(&asset->shapeCenters[i * 3]));
+
+ double skinStart = GetSeconds();
+
+ NvFlexExtCreateSoftMeshSkinning(
+ (float*)&instance.mMesh->m_positions[0],
+ instance.mMesh->m_positions.size(),
+ asset->shapeCenters,
+ asset->numShapes,
+ mSkinningFalloff,
+ mSkinningMaxDistance,
+ &instance.mSkinningWeights[0],
+ &instance.mSkinningIndices[0]);
+
+ double skinEnd = GetSeconds();
+
+ printf("Created soft in %f ms Skinned in %f\n", (createEnd - createStart)*1000.0f, (skinEnd - skinStart)*1000.0f);
+
+ const int particleOffset = g_buffers->positions.size();
+ const int indexOffset = g_buffers->rigidOffsets.back();
+
+ // add particle data to solver
+ for (int i = 0; i < asset->numParticles; ++i)
+ {
+ g_buffers->positions.push_back(&asset->particles[i * 4]);
+ g_buffers->velocities.push_back(0.0f);
+
+ const int phase = NvFlexMakePhase(group, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter);
+ g_buffers->phases.push_back(phase);
+ }
+
+ // add shape data to solver
+ for (int i = 0; i < asset->numShapeIndices; ++i)
+ g_buffers->rigidIndices.push_back(asset->shapeIndices[i] + particleOffset);
+
+ for (int i = 0; i < asset->numShapes; ++i)
+ {
+ g_buffers->rigidOffsets.push_back(asset->shapeOffsets[i] + indexOffset);
+ g_buffers->rigidTranslations.push_back(Vec3(&asset->shapeCenters[i * 3]));
+ g_buffers->rigidRotations.push_back(Quat());
+ g_buffers->rigidCoefficients.push_back(asset->shapeCoefficients[i]);
+ }
+
+ // add link data to the solver
+ for (int i = 0; i < asset->numSprings; ++i)
+ {
+ g_buffers->springIndices.push_back(asset->springIndices[i * 2 + 0]);
+ g_buffers->springIndices.push_back(asset->springIndices[i * 2 + 1]);
+
+ g_buffers->springStiffness.push_back(asset->springCoefficients[i]);
+ g_buffers->springLengths.push_back(asset->springRestLengths[i]);
+ }
+
+ NvFlexExtDestroyAsset(asset);
+
+ mInstances.push_back(instance);
+ }
+
+ virtual void Draw(int pass)
+ {
+ if (!g_drawMesh)
+ return;
+
+ for (int s = 0; s < int(mInstances.size()); ++s)
+ {
+ const Instance& instance = mInstances[s];
+
+ Mesh m;
+ m.m_positions.resize(instance.mMesh->m_positions.size());
+ m.m_normals.resize(instance.mMesh->m_normals.size());
+ m.m_indices = instance.mMesh->m_indices;
+
+ for (int i = 0; i < int(instance.mMesh->m_positions.size()); ++i)
+ {
+ Vec3 softPos;
+ Vec3 softNormal;
+
+ for (int w = 0; w < 4; ++w)
+ {
+ const int cluster = instance.mSkinningIndices[i * 4 + w];
+ const float weight = instance.mSkinningWeights[i * 4 + w];
+
+ if (cluster > -1)
+ {
+ // offset in the global constraint array
+ int rigidIndex = cluster + instance.mOffset;
+
+ Vec3 localPos = Vec3(instance.mMesh->m_positions[i]) - instance.mRigidRestPoses[cluster];
+
+ Vec3 skinnedPos = g_buffers->rigidTranslations[rigidIndex] + Rotate(g_buffers->rigidRotations[rigidIndex], localPos);
+ Vec3 skinnedNormal = Rotate(g_buffers->rigidRotations[rigidIndex], instance.mMesh->m_normals[i]);
+
+ softPos += skinnedPos*weight;
+ softNormal += skinnedNormal*weight;
+ }
+ }
+
+ m.m_positions[i] = Point3(softPos);
+ m.m_normals[i] = softNormal;
+ }
+
+ DrawMesh(&m, instance.mColor);
+ }
+ }
+
+ struct Instance
+ {
+ Mesh* mMesh;
+ std::vector<int> mSkinningIndices;
+ std::vector<float> mSkinningWeights;
+ vector<Vec3> mRigidRestPoses;
+ Vec3 mColor;
+ int mOffset;
+ };
+
+ std::vector<Instance> mInstances;
+
+ const char* mFile;
+ Vec3 mScale;
+ Vec3 mOffset;
+
+ float mRadius;
+
+ float mClusterSpacing;
+ float mClusterRadius;
+ float mClusterStiffness;
+
+ float mLinkRadius;
+ float mLinkStiffness;
+
+ float mGlobalStiffness;
+
+ float mSurfaceSampling;
+ float mVolumeSampling;
+
+ float mSkinningFalloff;
+ float mSkinningMaxDistance;
+
+ float mPlasticThreshold;
+ float mPlasticCreep;
+
+ float mRelaxationFactor;
+
+ bool mPlinth;
+
+ int mStack[3];
+};
+
+
+
+
+class SoftBodyFixed : public SoftBody
+{
+public:
+
+ SoftBodyFixed(const char* name, const char* mesh) : SoftBody(name, mesh) {}
+
+ virtual void Initialize()
+ {
+ SoftBody::Initialize();
+
+ // fix any particles in the wall
+ for (int i = 0; i < int(g_buffers->positions.size()); ++i)
+ if (g_buffers->positions[i].x < mRadius)
+ g_buffers->positions[i].w = 0.0f;
+ }
+
+ virtual void CreateBodies()
+ {
+ int x = 0;
+ int y = 0;
+
+ for (int z = 0; z < 4; ++z)
+ {
+ float stiffness = sqr(mClusterStiffness*(z + 1));
+
+ CreateSoftBody(mRadius, mOffset + Vec3(x*(mScale.x + 1), y*(mScale.y + 1), -z*(mScale.z + 1))*mRadius, stiffness, mInstances.size());
+ }
+ }
+
+ virtual void PostInitialize()
+ {
+ SoftBody::PostInitialize();
+
+ (Vec4&)g_params.planes[1] = Vec4(1.0f, 0.0f, 0.0f, 0.0f);
+ g_params.numPlanes = 2;
+ }
+};
diff --git a/demo/scenes/spherecloth.h b/demo/scenes/spherecloth.h
new file mode 100644
index 0000000..cab7f4d
--- /dev/null
+++ b/demo/scenes/spherecloth.h
@@ -0,0 +1,85 @@
+
+
+
+class SphereCloth : public Scene
+{
+public:
+
+ SphereCloth(const char* name) :
+ Scene(name) {}
+
+ virtual void Initialize()
+ {
+ float stretchStiffness = 1.0f;
+ float bendStiffness = 0.5f;
+ float shearStiffness = 0.5f;
+
+ float radius = 0.05f;
+
+ int dimx = 70;
+ int dimz = 70;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter);
+
+ float spacing = radius*0.8f;
+
+ CreateSpringGrid(Vec3(-dimx*spacing*0.5f, 1.5f, -dimz*spacing*0.5f), dimx, dimz, 1, spacing, phase, stretchStiffness, bendStiffness, shearStiffness, 0.0f, 1.0f);
+
+ g_params.radius = radius*1.0f;
+ g_params.dynamicFriction = 0.45f;
+ g_params.particleFriction = 0.45f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 8;
+ g_params.viscosity = 0.0f;
+ g_params.drag = 0.05f;
+ g_params.collisionDistance = radius*0.5f;
+ g_params.relaxationMode = eNvFlexRelaxationGlobal;
+ g_params.relaxationFactor = 0.25f;
+ g_params.numPlanes = 1;
+
+ g_numSubsteps = 2;
+
+ g_windStrength = 0.0f;
+
+ // draw options
+ g_drawPoints = false;
+ g_drawSprings = false;
+
+ g_lightDistance *= 1.5f;
+
+ mTime = 0.0f;
+ }
+
+ void Update()
+ {
+ ClearShapes();
+
+ mTime += g_dt;
+
+ // let cloth settle on object
+ float startTime = 1.0f;
+
+ float time = Max(0.0f, mTime-startTime);
+ float lastTime = Max(0.0f, time-g_dt);
+
+ const float rotationSpeed = 1.0f;
+ const float translationSpeed = 0.0f;
+
+ Vec3 pos = Vec3(translationSpeed*(1.0f-cosf(time)), 0.5f, 0.0f);
+ Vec3 prevPos = Vec3(translationSpeed*(1.0f-cosf(lastTime)), 0.5f, 0.0f);
+
+ Quat rot = QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), kPi*(1.0f-cosf(rotationSpeed*time)));
+ Quat prevRot = QuatFromAxisAngle(Vec3(0.0f, 1.0f, 0.0f), kPi*(1.0f-cosf(rotationSpeed*lastTime)));
+
+ AddSphere(0.5f, pos, rot);
+ //AddCapsule(0.25f, 0.5f, pos, rot);
+
+ g_buffers->shapePrevPositions[0] = Vec4(prevPos, 0.0f);
+ g_buffers->shapePrevRotations[0] = prevRot;
+
+ UpdateShapes();
+ }
+
+ float mTime;
+ int mType;
+};
+
diff --git a/demo/scenes/surfacetension.h b/demo/scenes/surfacetension.h
new file mode 100644
index 0000000..b22ad6d
--- /dev/null
+++ b/demo/scenes/surfacetension.h
@@ -0,0 +1,57 @@
+
+class SurfaceTension : public Scene
+{
+public:
+
+ SurfaceTension(const char* name, float surfaceTension) : Scene(name), surfaceTension(surfaceTension) {}
+
+ virtual void Initialize()
+ {
+ mCounter = 0;
+
+ float radius = 0.1f;
+ float restDistance = radius*0.55f;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid);
+
+ CreateParticleGrid(Vec3(0.0f, 0.2f, -1.0f), 16, 64, 16, restDistance, Vec3(0.0f), 1.0f, false, 0.0f, phase, 0.005f);
+
+ g_params.radius = radius;
+
+ g_params.fluid = true;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.anisotropyScale = 2.5f / radius;
+ g_params.smoothing = 0.5f;
+ g_params.relaxationFactor = 1.f;
+ g_params.restitution = 0.0f;
+ g_params.collisionDistance = 0.01f;
+
+ g_params.dynamicFriction = 0.25f;
+ g_params.viscosity = 0.5f;
+ g_params.cohesion = 0.1f;
+ g_params.adhesion = 0.0f;
+ g_params.surfaceTension = surfaceTension;
+
+ g_params.gravity[1] = 0.0f;
+
+ g_numExtraParticles = 64 * 1024;
+
+ g_emitters[0].mEnabled = true;
+ g_emitters[0].mSpeed = (g_params.fluidRestDistance*2.f / g_dt);
+
+ g_lightDistance *= 2.0f;
+
+ // draw options
+ g_drawEllipsoids = true;
+ }
+
+ void Update()
+ {
+ if (g_frame == 300)
+ g_params.gravity[1] = -9.8f;
+ }
+
+ int mCounter;
+ float surfaceTension;
+};
diff --git a/demo/scenes/tearing.h b/demo/scenes/tearing.h
new file mode 100644
index 0000000..c36ca7a
--- /dev/null
+++ b/demo/scenes/tearing.h
@@ -0,0 +1,132 @@
+
+class Tearing : public Scene
+{
+public:
+
+ Tearing(const char* name) : Scene(name) {}
+
+ ~Tearing()
+ {
+ NvFlexExtDestroyTearingCloth(mCloth);
+ }
+
+ void Initialize()
+ {
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform("../../data/irregular_plane.obj").c_str());
+ mesh->Transform(RotationMatrix(kPi, Vec3(0.0f, 1.0f, 0.0f))*RotationMatrix(kPi*0.5f, Vec3(1.0f, 0.0f, 0.0f))*ScaleMatrix(2.0f));
+
+ Vec3 lower, upper;
+ mesh->GetBounds(lower, upper);
+
+ float radius = 0.065f;
+ int phase = NvFlexMakePhase(0, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter);
+
+ for (size_t i = 0; i < mesh->GetNumVertices(); ++i)
+ {
+ Vec3 p = Vec3(mesh->m_positions[i]);
+
+ float invMass = 1.0f;
+
+ if (p.y == upper.y)
+ invMass = 0.0f;
+
+ p += Vec3(0.0f, 1.5f, 0.0f);
+
+ g_buffers->positions.push_back(Vec4(p.x, p.y, p.z, invMass));
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);
+ }
+
+ g_numExtraParticles = 1000;
+
+ mCloth = NvFlexExtCreateTearingClothFromMesh((float*)&g_buffers->positions[0], int(g_buffers->positions.size()), int(g_buffers->positions.size()) + g_numExtraParticles, (int*)&mesh->m_indices[0], mesh->GetNumFaces(), 0.8f, 0.8f, 0.0f);
+
+ g_buffers->triangles.assign((int*)&mesh->m_indices[0], mesh->m_indices.size());
+ g_buffers->triangleNormals.resize(mesh->GetNumFaces(), Vec3(0.0f, 0.0f, 1.0f));
+
+ g_buffers->springIndices.assign(mCloth->springIndices, mCloth->numSprings * 2);
+ g_buffers->springStiffness.assign(mCloth->springCoefficients, mCloth->numSprings);
+ g_buffers->springLengths.assign(mCloth->springRestLengths, mCloth->numSprings);
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.025f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 16;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.relaxationFactor = 1.0f;
+ g_params.drag = 0.03f;
+
+ g_params.relaxationMode = eNvFlexRelaxationGlobal;
+ g_params.relaxationFactor = 0.35f;
+
+ g_numSubsteps = 2;
+
+ g_pause = false;
+
+ // draw options
+ g_drawPoints = false;
+ }
+
+ void Update()
+ {
+ g_params.wind[0] = 0.1f;
+ g_params.wind[1] = 0.1f;
+ g_params.wind[2] = -0.2f;
+ g_windStrength = 6.0f;
+
+ const float maxStrain = 3.0f;
+ const int maxCopies = 2048;
+ const int maxEdits = 2048;
+
+ NvFlexExtTearingParticleClone particleCopies[maxCopies];
+ int numParticleCopies;
+
+ NvFlexExtTearingMeshEdit triangleEdits[maxEdits];
+ int numTriangleEdits;
+
+ // update asset's copy of the particles
+ memcpy(mCloth->particles, &g_buffers->positions[0], sizeof(Vec4)*g_buffers->positions.size());
+
+ NvFlexExtTearClothMesh(mCloth, maxStrain, 4, particleCopies, &numParticleCopies, maxCopies, triangleEdits, &numTriangleEdits, maxEdits);
+
+ // copy particles
+ for (int i = 0; i < numParticleCopies; ++i)
+ {
+ const int srcIndex = particleCopies[i].srcIndex;
+ const int destIndex = particleCopies[i].destIndex;
+
+ g_buffers->positions[destIndex] = Vec4(Vec3(g_buffers->positions[srcIndex]), 1.0f); // override mass because picked particle has inf. mass
+ g_buffers->restPositions[destIndex] = g_buffers->restPositions[srcIndex];
+ g_buffers->velocities[destIndex] = g_buffers->velocities[srcIndex];
+ g_buffers->phases[destIndex] = g_buffers->phases[srcIndex];
+
+ g_buffers->activeIndices.push_back(destIndex);
+ }
+
+ // apply triangle modifications to index buffer
+ for (int i = 0; i < numTriangleEdits; ++i)
+ {
+ const int index = triangleEdits[i].triIndex;
+ const int newValue = triangleEdits[i].newParticleIndex;
+
+ g_buffers->triangles[index] = newValue;
+ }
+
+ mCloth->numParticles += numParticleCopies;
+
+ // update constraints
+ g_buffers->springIndices.assign(mCloth->springIndices, mCloth->numSprings * 2);
+ g_buffers->springStiffness.assign(mCloth->springCoefficients, mCloth->numSprings);
+ g_buffers->springLengths.assign(mCloth->springRestLengths, mCloth->numSprings);
+ }
+
+ virtual void Sync()
+ {
+ // update solver data not already updated in the main loop
+ NvFlexSetSprings(g_flex, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size());
+ NvFlexSetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3);
+ NvFlexSetRestParticles(g_flex, g_buffers->restPositions.buffer, g_buffers->restPositions.size());
+ }
+
+ NvFlexExtAsset* mCloth;
+}; \ No newline at end of file
diff --git a/demo/scenes/thinbox.h b/demo/scenes/thinbox.h
new file mode 100644
index 0000000..a77f258
--- /dev/null
+++ b/demo/scenes/thinbox.h
@@ -0,0 +1,66 @@
+
+
+class ThinBox : public Scene
+{
+public:
+
+ ThinBox(const char* name) : Scene(name) {}
+
+ int base;
+ int width;
+ int height;
+ int depth;
+
+ virtual void Initialize()
+ {
+ float radius = 0.03f;
+
+ width = 16;
+ height = 8;
+ depth = 8;
+
+ base = 4;
+
+ float sep = radius;
+
+ CreateParticleGrid(Vec3(0.0f, radius, 0.0f), width, height, depth, sep, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), 0.0f);
+
+ Vec3 upper;
+ Vec3 lower;
+ GetParticleBounds(lower, upper);
+ lower -= Vec3(radius*0.5f);
+ upper += Vec3(radius*0.5f);
+
+ Vec3 center = 0.5f*(upper + lower);
+
+ float width = (upper - lower).x*0.5f;
+ float depth = (upper - lower).z*0.5f;
+ float edge = 0.0075f*0.5f;
+ float height = 8 * radius;
+
+ AddBox(Vec3(edge, height, depth), center + Vec3(-width, height / 2, 0.0f));
+ AddBox(Vec3(edge, height, depth), center + Vec3(width, height / 2, 0.0f));
+ AddBox(Vec3(width - edge, height, edge), center + Vec3(0.0f, height / 2, (depth - edge)));
+ AddBox(Vec3(width - edge, height, edge), center + Vec3(0.0f, height / 2, -(depth - edge)));
+ AddBox(Vec3(width, edge, depth), Vec3(center.x, lower.y, center.z));
+
+ g_params.gravity[1] = -9.f;
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.0f;
+ g_params.fluid = false;
+ g_params.numIterations = 5;
+ g_params.numPlanes = 1;
+ g_params.restitution = 0.0f;
+ g_params.collisionDistance = radius;
+ g_params.particleCollisionMargin = radius*0.5f;
+
+ g_params.relaxationFactor = 0.0f;
+ g_numSubsteps = 2;
+
+ g_lightDistance *= 0.85f;
+
+ // draw options
+ g_drawPoints = true;
+ g_warmup = false;
+ }
+}; \ No newline at end of file
diff --git a/demo/scenes/trianglecollision.h b/demo/scenes/trianglecollision.h
new file mode 100644
index 0000000..65a7824
--- /dev/null
+++ b/demo/scenes/trianglecollision.h
@@ -0,0 +1,47 @@
+
+class TriangleCollision : public Scene
+{
+public:
+
+ TriangleCollision(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float radius = 0.05f;
+ CreateParticleGrid(Vec3(0.4f, 1.0f + radius*0.5f, 0.1f), 10, 5, 10, radius, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), 0.0f);
+
+ Mesh* disc = CreateDiscMesh(1.0f, 4);
+
+ // create shallow bowl
+ disc->m_positions[0].y -= 0.5f;
+ disc->CalculateNormals();
+
+
+ NvFlexTriangleMeshId mesh1 = CreateTriangleMesh(disc);
+ AddTriangleMesh(mesh1, Vec3(0.0f, 0.5f, 0.0f), Quat(), Vec3(1.0f, 0.5f, 1.0f));
+ AddTriangleMesh(mesh1, Vec3(1.0f, 0.5f, 1.0f), Quat(), Vec3(1.0f, 0.5f, 1.0f));
+
+ NvFlexTriangleMeshId mesh2 = CreateTriangleMesh(disc);
+ AddTriangleMesh(mesh2, Vec3(-1.0f, 0.5f, 1.0f), Quat(), Vec3(1.0f, 0.5f, 1.0f));
+ AddTriangleMesh(mesh2, Vec3(1.0f, 0.5f, -1.0f), Quat(), Vec3(1.0f, 1.0f, 1.0f));
+
+ NvFlexTriangleMeshId mesh3 = CreateTriangleMesh(disc);
+ AddTriangleMesh(mesh3, Vec3(-1.0f, 0.5f, -1.0f), Quat(), Vec3(1.0f, 0.25f, 1.0f));
+
+
+ delete disc;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.025f;
+ g_params.dissipation = 0.0f;
+ g_params.restitution = 0.0;
+ g_params.numIterations = 4;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+
+ g_numSubsteps = 1;
+
+ // draw options
+ g_drawPoints = true;
+ }
+
+};
diff --git a/demo/scenes/triggervolume.h b/demo/scenes/triggervolume.h
new file mode 100644
index 0000000..0e4c1a4
--- /dev/null
+++ b/demo/scenes/triggervolume.h
@@ -0,0 +1,81 @@
+
+
+
+class TriggerVolume : public Scene
+{
+public:
+
+ TriggerVolume(const char* name) : Scene(name) {}
+
+ void Initialize()
+ {
+ float radius = 0.05f;
+ CreateParticleGrid(Vec3(1.75, 2.0, -0.25), 10, 5, 10, radius, Vec3(0.0f), 1.0f, false, 0.0f, NvFlexMakePhase(0, eNvFlexPhaseSelfCollide), 0.0f);
+
+ g_numExtraParticles = 10000;
+
+ // regular box
+ AddBox(Vec3(0.5), Vec3(0.0, 0.5, 0.0));
+
+ // trigger box
+ AddBox(Vec3(0.5), Vec3(2.0f, 0.5, 0.0));
+ g_buffers->shapeFlags[1] |= eNvFlexShapeFlagTrigger;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.025f;
+ g_params.dissipation = 0.0f;
+ g_params.restitution = 0.0;
+ g_params.numIterations = 4;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+
+ g_numSubsteps = 1;
+
+ // draw options
+ g_drawPoints = true;
+
+ g_emitters[0].mEnabled = true;
+ }
+
+ virtual void Update()
+ {
+ const int maxContactsPerParticle = 6;
+
+ NvFlexVector<Vec4> contactPlanes(g_flexLib,g_buffers->positions.size()*maxContactsPerParticle);
+ NvFlexVector<Vec4> contactVelocities(g_flexLib, g_buffers->positions.size()*maxContactsPerParticle);
+ NvFlexVector<int> contactIndices(g_flexLib, g_buffers->positions.size());
+ NvFlexVector<unsigned int> contactCounts(g_flexLib, g_buffers->positions.size());
+
+ NvFlexGetContacts(g_flex, contactPlanes.buffer, contactVelocities.buffer, contactIndices.buffer, contactCounts.buffer);
+
+ contactPlanes.map();
+ contactVelocities.map();
+ contactIndices.map();
+ contactCounts.map();
+
+ int activeCount = NvFlexGetActiveCount(g_flex);
+
+ for (int i = 0; i < activeCount; ++i)
+ {
+ const int contactIndex = contactIndices[i];
+ const unsigned int count = contactCounts[contactIndex];
+
+ for (unsigned int c = 0; c < count; ++c)
+ {
+ Vec4 velocity = contactVelocities[contactIndex*maxContactsPerParticle + c];
+
+ const int shapeId = int(velocity.w);
+
+ // detect when particle intersects the trigger
+ // volume and teleport it over to the other box
+ if (shapeId == 1)
+ {
+ Vec3 pos = Vec3(Randf(-0.5f, 0.5f), 1.0f, Randf(-0.5f, 0.5f));
+
+ g_buffers->positions[i] = Vec4(pos, 1.0f);
+ g_buffers->velocities[i] = 0.0f;
+ }
+ }
+ }
+ }
+
+}; \ No newline at end of file
diff --git a/demo/scenes/viscosity.h b/demo/scenes/viscosity.h
new file mode 100644
index 0000000..0615855
--- /dev/null
+++ b/demo/scenes/viscosity.h
@@ -0,0 +1,79 @@
+
+class Viscosity : public Scene
+{
+public:
+
+ Viscosity(const char* name, float viscosity = 1.0f, float dissipation = 0.0f) : Scene(name), viscosity(viscosity), dissipation(dissipation) {}
+
+ virtual void Initialize()
+ {
+ float radius = 0.1f;
+ float restDistance = radius*0.5f;
+
+ g_params.radius = radius;
+
+ g_params.fluid = true;
+ g_params.numIterations = 3;
+ g_params.vorticityConfinement = 0.0f;
+ g_params.fluidRestDistance = restDistance;
+ g_params.anisotropyScale = 3.0f / radius;
+ g_params.smoothing = 0.35f;
+ g_params.relaxationFactor = 1.f;
+ g_params.restitution = 0.0f;
+ g_params.collisionDistance = 0.00125f;
+ g_params.shapeCollisionMargin = g_params.collisionDistance*0.25f;
+ g_params.dissipation = dissipation;
+
+ g_params.gravity[1] *= 2.0f;
+
+ g_fluidColor = Vec4(1.0f, 1.0f, 1.0f, 0.0f);
+ g_meshColor = Vec3(0.7f, 0.8f, 0.9f)*0.7f;
+
+ g_params.dynamicFriction = 1.0f;
+ g_params.staticFriction = 0.0f;
+ g_params.viscosity = 20.0f + 20.0f*viscosity;
+ g_params.adhesion = 0.1f*viscosity;
+ g_params.cohesion = 0.05f*viscosity;
+ g_params.surfaceTension = 0.0f;
+
+ const float shapeSize = 2.0f;
+ const Vec3 shapeLower = Vec3(-shapeSize*0.5f, 0.0f, -shapeSize*0.5f);
+ const Vec3 shapeUpper = shapeLower + Vec3(shapeSize);
+ const Vec3 shapeCenter = (shapeLower + shapeUpper)*0.5f;
+
+ NvFlexDistanceFieldId sdf = CreateSDF(GetFilePathByPlatform("../../data/bunny.ply").c_str(), 128);
+ AddSDF(sdf, shapeLower, Quat(), shapeSize);
+
+ float emitterSize = 1.f;
+
+ Emitter e;
+ e.mEnabled = true;
+ e.mWidth = int(emitterSize / restDistance);
+ e.mPos = Vec3(shapeCenter.x - 0.2f, shapeUpper.y + 0.75f, shapeCenter.z);
+ e.mDir = Vec3(0.0f, -1.0f, 0.0f);
+ e.mRight = Vec3(1.0f, 0.0f, 0.0f);
+ e.mSpeed = (restDistance*2.f / g_dt);
+
+ g_sceneUpper.z = 5.0f;
+
+ g_emitters.push_back(e);
+
+ g_numExtraParticles = 64 * 1024;
+
+ g_lightDistance *= 2.5f;
+
+ // draw options
+ g_drawEllipsoids = true;
+
+ g_emit = true;
+ g_pause = false;
+ }
+
+ virtual void DoGui()
+ {
+ imguiSlider("Emitter Pos", &g_emitters.back().mPos.x, -1.0f, 1.0f, 0.001f);
+ }
+
+ float viscosity;
+ float dissipation;
+}; \ No newline at end of file
diff --git a/demo/scenes/waterballoon.h b/demo/scenes/waterballoon.h
new file mode 100644
index 0000000..544bf78
--- /dev/null
+++ b/demo/scenes/waterballoon.h
@@ -0,0 +1,336 @@
+
+class WaterBalloon : public Scene
+{
+public:
+
+ WaterBalloon(const char* name) : Scene(name) {}
+
+ virtual ~WaterBalloon()
+ {
+ for (size_t i = 0; i < mCloths.size(); ++i)
+ NvFlexExtDestroyTearingCloth(mCloths[i].asset);
+ }
+
+ void AddInflatable(const Mesh* mesh, float overPressure, float invMass, int phase)
+ {
+ // create a cloth mesh using the global positions / indices
+ const int numParticles = int(mesh->m_positions.size());
+ const int maxParticles = numParticles * 2;
+
+ Balloon balloon;
+ balloon.particleOffset = g_buffers->positions.size();
+ balloon.triangleOffset = g_buffers->triangles.size();
+ balloon.splitThreshold = 4.0f;
+
+ // add particles to system
+ for (size_t i = 0; i < mesh->GetNumVertices(); ++i)
+ {
+ const Vec3 p = Vec3(mesh->m_positions[i]);
+
+ g_buffers->positions.push_back(Vec4(p.x, p.y, p.z, invMass));
+ g_buffers->restPositions.push_back(Vec4(p.x, p.y, p.z, invMass));
+
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);
+ }
+
+ for (size_t i = 0; i < mesh->m_indices.size(); i += 3)
+ {
+ int a = mesh->m_indices[i + 0];
+ int b = mesh->m_indices[i + 1];
+ int c = mesh->m_indices[i + 2];
+
+ Vec3 n = -Normalize(Cross(mesh->m_positions[b] - mesh->m_positions[a], mesh->m_positions[c] - mesh->m_positions[a]));
+ g_buffers->triangleNormals.push_back(n);
+
+ g_buffers->triangles.push_back(a + balloon.particleOffset);
+ g_buffers->triangles.push_back(b + balloon.particleOffset);
+ g_buffers->triangles.push_back(c + balloon.particleOffset);
+ }
+
+ // create tearing asset
+ NvFlexExtAsset* cloth = NvFlexExtCreateTearingClothFromMesh((float*)&g_buffers->positions[balloon.particleOffset], numParticles, maxParticles, (int*)&mesh->m_indices[0], mesh->GetNumFaces(), 1.0f, 1.0f, 0.0f);
+ balloon.asset = cloth;
+
+ mCloths.push_back(balloon);
+ }
+
+ void Initialize()
+ {
+ mCloths.resize(0);
+
+ float minSize = 0.25f;
+ float maxSize = 0.5f;
+ float spacing = 4.0f;
+
+ // convex rocks
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 1; j++)
+ AddRandomConvex(10, Vec3(i*maxSize*spacing, 0.0f, j*maxSize*spacing), minSize, maxSize, Vec3(0.0f, 1.0f, 0.0f), Randf(0.0f, k2Pi));
+
+ float radius = 0.1f;
+ int group = 0;
+
+ g_numExtraParticles = 20000;
+ g_numSubsteps = 3;
+
+ g_params.radius = radius;
+ g_params.dynamicFriction = 0.125f;
+ g_params.dissipation = 0.0f;
+ g_params.numIterations = 5;
+ g_params.particleCollisionMargin = g_params.radius*0.05f;
+ g_params.relaxationFactor = 1.0f;
+ g_params.drag = 0.0f;
+ g_params.anisotropyScale = 25.0f;
+ g_params.smoothing = 1.f;
+ g_params.maxSpeed = 0.5f*g_numSubsteps*radius / g_dt;
+ g_params.gravity[1] *= 1.0f;
+ g_params.collisionDistance = 0.01f;
+ g_params.solidPressure = 0.0f;
+
+ g_params.fluid = true;
+
+ g_params.fluidRestDistance = radius*0.65f;
+ g_params.viscosity = 0.0;
+ g_params.adhesion = 0.0f;
+ g_params.cohesion = 0.02f;
+
+
+ // add inflatables
+ Mesh* mesh = ImportMesh(GetFilePathByPlatform("../../data/sphere_high.ply").c_str());
+
+ for (int y = 0; y < 2; ++y)
+ for (int i = 0; i < 2; ++i)
+ {
+ Vec3 lower = Vec3(2.0f + i*2.0f, 0.4f + y*1.2f, 1.0f);
+
+ mesh->Normalize();
+ mesh->Transform(TranslationMatrix(Point3(lower)));
+
+ AddInflatable(mesh, 1.0f, 0.25f, NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseSelfCollideFilter));
+ }
+
+ g_numSolidParticles = g_buffers->positions.size();
+ g_numExtraParticles = g_buffers->positions.size();
+
+ // fill inflatables with water
+ std::vector<Vec3> positions(10000);
+ int n = PoissonSample3D(0.45f, g_params.radius*0.42f, &positions[0], positions.size(), 10000);
+ //int n = TightPack3D(0.45f, g_params.radius*0.42f, &positions[0], positions.size());
+
+ mNumFluidParticles = 0;
+
+ for (size_t i = 0; i < mCloths.size(); ++i)
+ {
+ const int vertStart = i*mesh->GetNumVertices();
+ const int vertEnd = vertStart + mesh->GetNumVertices();
+
+ const int phase = NvFlexMakePhase(group++, eNvFlexPhaseSelfCollide | eNvFlexPhaseFluid);
+
+ Vec3 center;
+ for (int v = vertStart; v < vertEnd; ++v)
+ center += Vec3(g_buffers->positions[v]);
+
+ center /= float(vertEnd - vertStart);
+
+ printf("%d, %d - %f %f %f\n", vertStart, vertEnd, center.x, center.y, center.z);
+
+ for (int i = 0; i < n; ++i)
+ {
+ g_buffers->positions.push_back(Vec4(center + positions[i], 1.0f));
+ g_buffers->restPositions.push_back(Vec4());
+ g_buffers->velocities.push_back(0.0f);
+ g_buffers->phases.push_back(phase);
+ }
+
+ mNumFluidParticles += n;
+ }
+
+ delete mesh;
+
+ g_drawPoints = false;
+ g_drawEllipsoids = true;
+ g_drawSprings = 0;
+ g_drawCloth = false;
+ g_warmup = true;
+
+ }
+
+ void RebuildConstraints()
+ {
+ // update constraint data
+ g_buffers->triangles.resize(0);
+ g_buffers->springIndices.resize(0);
+ g_buffers->springStiffness.resize(0);
+ g_buffers->springLengths.resize(0);
+
+ for (int c = 0; c < int(mCloths.size()); ++c)
+ {
+ Balloon& balloon = mCloths[c];
+
+ for (int i = 0; i < balloon.asset->numTriangles; ++i)
+ {
+ g_buffers->triangles.push_back(balloon.asset->triangleIndices[i * 3 + 0] + balloon.particleOffset);
+ g_buffers->triangles.push_back(balloon.asset->triangleIndices[i * 3 + 1] + balloon.particleOffset);
+ g_buffers->triangles.push_back(balloon.asset->triangleIndices[i * 3 + 2] + balloon.particleOffset);
+ }
+
+ for (int i = 0; i < balloon.asset->numSprings * 2; ++i)
+ g_buffers->springIndices.push_back(balloon.asset->springIndices[i] + balloon.particleOffset);
+
+
+ for (int i = 0; i < balloon.asset->numSprings; ++i)
+ {
+ g_buffers->springStiffness.push_back(balloon.asset->springCoefficients[i]);
+ g_buffers->springLengths.push_back(balloon.asset->springRestLengths[i]);
+ }
+ }
+ }
+
+ virtual void Sync()
+ {
+ // send new particle data to the GPU
+ NvFlexSetRestParticles(g_flex, g_buffers->restPositions.buffer, g_buffers->restPositions.size());
+
+ // update solver
+ NvFlexSetSprings(g_flex, g_buffers->springIndices.buffer, g_buffers->springLengths.buffer, g_buffers->springStiffness.buffer, g_buffers->springLengths.size());
+ NvFlexSetDynamicTriangles(g_flex, g_buffers->triangles.buffer, g_buffers->triangleNormals.buffer, g_buffers->triangles.size() / 3);
+ }
+
+ virtual void Update()
+ {
+ // temporarily restore the mouse particle's mass so that we can tear it
+ if (g_mouseParticle != -1)
+ g_buffers->positions[g_mouseParticle].w = g_mouseMass;
+
+ // force larger radius for solid interactions to prevent interpenetration
+ g_params.solidRestDistance = g_params.radius;
+
+ // build new particle arrays
+ std::vector<Vec4> newParticles;
+ std::vector<Vec4> newParticlesRest;
+ std::vector<Vec3> newVelocities;
+ std::vector<int> newPhases;
+ std::vector<Vec4> newNormals;
+
+ for (int c = 0; c < int(mCloths.size()); ++c)
+ {
+ Balloon& balloon = mCloths[c];
+
+ const int destOffset = newParticles.size();
+
+ // append existing particles
+ for (int i = 0; i < balloon.asset->numParticles; ++i)
+ {
+ newParticles.push_back(g_buffers->positions[balloon.particleOffset + i]);
+ newParticlesRest.push_back(g_buffers->restPositions[balloon.particleOffset + i]);
+ newVelocities.push_back(g_buffers->velocities[balloon.particleOffset + i]);
+ newPhases.push_back(g_buffers->phases[balloon.particleOffset + i]);
+ newNormals.push_back(g_buffers->normals[balloon.particleOffset + i]);
+ }
+
+ // perform splitting
+ const int maxCopies = 2048;
+ const int maxEdits = 2048;
+
+ NvFlexExtTearingParticleClone particleCopies[maxCopies];
+ int numParticleCopies;
+
+ NvFlexExtTearingMeshEdit triangleEdits[maxEdits];
+ int numTriangleEdits;
+
+ // update asset's copy of the particles
+ memcpy(balloon.asset->particles, &g_buffers->positions[balloon.particleOffset], sizeof(Vec4)*balloon.asset->numParticles);
+
+ // tear
+ NvFlexExtTearClothMesh(balloon.asset, balloon.splitThreshold, 1, particleCopies, &numParticleCopies, maxCopies, triangleEdits, &numTriangleEdits, maxEdits);
+
+ // resize particle data arrays
+ newParticles.resize(newParticles.size() + numParticleCopies);
+ newParticlesRest.resize(newParticlesRest.size() + numParticleCopies);
+ newVelocities.resize(newVelocities.size() + numParticleCopies);
+ newPhases.resize(newPhases.size() + numParticleCopies);
+ newNormals.resize(newNormals.size() + numParticleCopies);
+
+ // copy particles
+ for (int i = 0; i < numParticleCopies; ++i)
+ {
+ const int srcIndex = balloon.particleOffset + particleCopies[i].srcIndex;
+ const int destIndex = destOffset + particleCopies[i].destIndex;
+
+ newParticles[destIndex] = g_buffers->positions[srcIndex];
+ newParticlesRest[destIndex] = g_buffers->restPositions[srcIndex];
+ newVelocities[destIndex] = g_buffers->velocities[srcIndex];
+ newPhases[destIndex] = g_buffers->phases[srcIndex];
+ newNormals[destIndex] = g_buffers->normals[srcIndex];
+ }
+
+ if (numParticleCopies)
+ {
+ // reduce split threshold for this balloon
+ balloon.splitThreshold = 1.75f;
+ }
+
+ balloon.particleOffset = destOffset;
+ balloon.asset->numParticles += numParticleCopies;
+ }
+
+ // append fluid particles
+ const int fluidStart = g_numSolidParticles;
+ const int fluidEnd = fluidStart + mNumFluidParticles;
+
+ g_numSolidParticles = newParticles.size();
+
+ for (int i = fluidStart; i < fluidEnd; ++i)
+ {
+ newParticles.push_back(g_buffers->positions[i]);
+ newParticlesRest.push_back(Vec4());
+ newVelocities.push_back(g_buffers->velocities[i]);
+ newPhases.push_back(g_buffers->phases[i]);
+ newNormals.push_back(g_buffers->normals[i]);
+ }
+
+ g_buffers->positions.assign(&newParticles[0], newParticles.size());
+ g_buffers->restPositions.assign(&newParticlesRest[0], newParticlesRest.size());
+ g_buffers->velocities.assign(&newVelocities[0], newVelocities.size());
+ g_buffers->phases.assign(&newPhases[0], newPhases.size());
+ g_buffers->normals.assign(&newNormals[0], newNormals.size());
+
+ // build active indices list
+ g_buffers->activeIndices.resize(g_buffers->positions.size());
+ for (int i = 0; i < g_buffers->positions.size(); ++i)
+ g_buffers->activeIndices[i] = i;
+
+ // update constraint buffers
+ RebuildConstraints();
+
+ // restore mouse mass
+ if (g_mouseParticle != -1)
+ g_buffers->positions[g_mouseParticle].w = 0.0f;
+ }
+
+ virtual void Draw(int pass)
+ {
+ if (!g_drawMesh)
+ return;
+
+ for (size_t i = 0; i < mCloths.size(); ++i)
+ {
+ DrawCloth(&g_buffers->positions[0], &g_buffers->normals[0], NULL, &g_buffers->triangles[mCloths[i].triangleOffset], mCloths[i].asset->numTriangles, g_buffers->positions.size(), (i + 2) % 6);//, g_params.radius*0.25f);
+ }
+ }
+
+ struct Balloon
+ {
+ NvFlexExtAsset* asset;
+
+ int particleOffset;
+ int triangleOffset;
+
+ float splitThreshold;
+ };
+
+ int mNumFluidParticles;
+
+ std::vector<Balloon> mCloths;
+};
diff --git a/demo/shaders.h b/demo/shaders.h
new file mode 100644
index 0000000..937c2a2
--- /dev/null
+++ b/demo/shaders.h
@@ -0,0 +1,182 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2013-2017 NVIDIA Corporation. All rights reserved.
+
+#pragma once
+
+#define STRINGIFY(A) #A
+
+#include "../core/maths.h"
+#include "../core/mesh.h"
+
+#include "../include/NvFlex.h"
+
+
+#if FLEX_DX
+
+#include <d3d11.h>
+typedef ID3D11Buffer* VertexBuffer;
+typedef ID3D11Buffer* IndexBuffer;
+
+void GetRenderDevice(ID3D11Device** device, ID3D11DeviceContext** context);
+
+#else
+
+typedef unsigned int VertexBuffer;
+typedef unsigned int IndexBuffer;
+typedef unsigned int Texture;
+
+#endif
+
+struct SDL_Window;
+
+void InitRender(SDL_Window* window, bool fullscreen, int msaa);
+void DestroyRender();
+void ReshapeRender(SDL_Window* window);
+
+void StartFrame(Vec4 clearColor);
+void EndFrame();
+
+// set to true to enable vsync
+void PresentFrame(bool fullsync);
+
+void GetViewRay(int x, int y, Vec3& origin, Vec3& dir);
+
+// read back pixel values
+void ReadFrame(int* backbuffer, int width, int height);
+
+void SetView(Matrix44 view, Matrix44 proj);
+void SetFillMode(bool wireframe);
+void SetCullMode(bool enabled);
+
+// debug draw methods
+void BeginLines();
+void DrawLine(const Vec3& p, const Vec3& q, const Vec4& color);
+void EndLines();
+
+// shadowing
+struct ShadowMap;
+ShadowMap* ShadowCreate();
+void ShadowDestroy(ShadowMap* map);
+void ShadowBegin(ShadowMap* map);
+void ShadowEnd();
+
+// primitive draw methods
+void DrawPlanes(Vec4* planes, int n, float bias);
+void DrawPoints(VertexBuffer positions, VertexBuffer color, IndexBuffer indices, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity);
+void DrawMesh(const Mesh*, Vec3 color);
+void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex=3, float expand=0.0f, bool twosided=true, bool smooth=true);
+void DrawBuffer(float* buffer, Vec3 camPos, Vec3 lightPos);
+void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int color);
+
+struct GpuMesh;
+
+GpuMesh* CreateGpuMesh(const Mesh* m);
+void DestroyGpuMesh(GpuMesh* m);
+void DrawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color);
+void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color);
+
+// main lighting shader
+void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, float bias, Vec4 fogColor);
+void UnbindSolidShader();
+
+// new fluid renderer
+struct FluidRenderer;
+
+// owns render targets and shaders associated with fluid rendering
+FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height);
+void DestroyFluidRenderer(FluidRenderer*);
+
+struct FluidRenderBuffers
+{
+ VertexBuffer mPositionVBO;
+ VertexBuffer mDensityVBO;
+ VertexBuffer mAnisotropyVBO[3];
+ IndexBuffer mIndices;
+
+ VertexBuffer mFluidVBO; // to be removed
+
+ // wrapper buffers that allow Flex to write directly to VBOs
+ NvFlexBuffer* mPositionBuf;
+ NvFlexBuffer* mDensitiesBuf;
+ NvFlexBuffer* mAnisotropyBuf[3];
+ NvFlexBuffer* mIndicesBuf;
+
+ int mNumFluidParticles;
+};
+
+FluidRenderBuffers CreateFluidRenderBuffers(int numParticles, bool enableInterop);
+void DestroyFluidRenderBuffers(FluidRenderBuffers buffers);
+
+// update fluid particle buffers from a FlexSovler
+void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, NvFlexSolver* flex, bool anisotropy, bool density);
+
+// update fluid particle buffers from host memory
+void UpdateFluidRenderBuffers(FluidRenderBuffers buffers,
+ Vec4* particles,
+ float* densities,
+ Vec4* anisotropy1,
+ Vec4* anisotropy2,
+ Vec4* anisotropy3,
+ int numParticles,
+ int* indices,
+ int numIndices);
+
+// vertex buffers for diffuse particles
+struct DiffuseRenderBuffers
+{
+ VertexBuffer mDiffusePositionVBO;
+ VertexBuffer mDiffuseVelocityVBO;
+ IndexBuffer mDiffuseIndicesIBO;
+
+ NvFlexBuffer* mDiffuseIndicesBuf;
+ NvFlexBuffer* mDiffusePositionsBuf;
+ NvFlexBuffer* mDiffuseVelocitiesBuf;
+
+ int mNumDiffuseParticles;
+};
+
+// owns diffuse particle vertex buffers
+DiffuseRenderBuffers CreateDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop);
+void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers buffers);
+
+// update diffuse particle vertex buffers from a NvFlexSolver
+void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, NvFlexSolver* solver);
+
+// update diffuse particle vertex buffers from host memory
+void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers,
+ Vec4* diffusePositions,
+ Vec4* diffuseVelocities,
+ int* diffuseIndices,
+ int numDiffuseParticles);
+
+// screen space fluid rendering
+void RenderEllipsoids(FluidRenderer* render, FluidRenderBuffers buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, Vec4 color, float blur, float ior, bool debug);
+void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers buffer, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, float motionBlur, float inscatter, float outscatter, bool shadow, bool front);
+
+// UI rendering
+void imguiGraphDraw();
+void imguiGraphInit(const char* fontpath); \ No newline at end of file
diff --git a/demo/stb_truetype.h b/demo/stb_truetype.h
new file mode 100644
index 0000000..7545fdf
--- /dev/null
+++ b/demo/stb_truetype.h
@@ -0,0 +1,1810 @@
+// stb_truetype.h - v0.3 - public domain - 2009 Sean Barrett / RAD Game Tools
+//
+// This library processes TrueType files:
+// parse files
+// extract glyph metrics
+// extract glyph shapes
+// render glyphs to one-channel bitmaps with antialiasing (box filter)
+//
+// Todo:
+// non-MS cmaps
+// crashproof on bad data
+// hinting
+// subpixel positioning when rendering bitmap
+// cleartype-style AA
+//
+// ADDITIONAL CONTRIBUTORS
+//
+// Mikko Mononen: compound shape support, more cmap formats
+//
+// VERSIONS
+//
+// 0.3 (2009-06-24) cmap fmt=12, compound shapes (MM)
+// userdata, malloc-from-userdata, non-zero fill (STB)
+// 0.2 (2009-03-11) Fix unsigned/signed char warnings
+// 0.1 (2009-03-09) First public release
+//
+// USAGE
+//
+// Include this file in whatever places neeed to refer to it. In ONE C/C++
+// file, write:
+// #define STB_TRUETYPE_IMPLEMENTATION
+// before the #include of this file. This expands out the actual
+// implementation into that C/C++ file.
+//
+// Look at the header-file sections below for the API, but here's a quick skim:
+//
+// Simple 3D API (don't ship this, but it's fine for tools and quick start,
+// and you can cut and paste from it to move to more advanced)
+// stbtt_BakeFontBitmap() -- bake a font to a bitmap for use as texture
+// stbtt_GetBakedQuad() -- compute quad to draw for a given char
+//
+// "Load" a font file from a memory buffer (you have to keep the buffer loaded)
+// stbtt_InitFont()
+// stbtt_GetFontOffsetForIndex() -- use for TTC font collections
+//
+// Render a unicode codepoint to a bitmap
+// stbtt_GetCodepointBitmap() -- allocates and returns a bitmap
+// stbtt_MakeCodepointBitmap() -- renders into bitmap you provide
+// stbtt_GetCodepointBitmapBox() -- how big the bitmap must be
+//
+// Character advance/positioning
+// stbtt_GetCodepointHMetrics()
+// stbtt_GetFontVMetrics()
+//
+// NOTES
+//
+// The system uses the raw data found in the .ttf file without changing it
+// and without building auxiliary data structures. This is a bit inefficient
+// on little-endian systems (the data is big-endian), but assuming you're
+// caching the bitmaps or glyph shapes this shouldn't be a big deal.
+//
+// It appears to be very hard to programmatically determine what font a
+// given file is in a general way. I provide an API for this, but I don't
+// recommend it.
+//
+//
+// SOURCE STATISTICS (based on v0.3, 1800 LOC)
+//
+// Documentation & header file 350 LOC \___ 500 LOC documentation
+// Sample code 140 LOC /
+// Truetype parsing 580 LOC ---- 600 LOC TrueType
+// Software rasterization 240 LOC \ .
+// Curve tesselation 120 LOC \__ 500 LOC Bitmap creation
+// Bitmap management 70 LOC /
+// Baked bitmap interface 70 LOC /
+// Font name matching & access 150 LOC ---- 150
+// C runtime library abstraction 60 LOC ---- 60
+
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+////
+//// SAMPLE PROGRAMS
+////
+//
+// Incomplete text-in-3d-api example, which draws quads properly aligned to be lossless
+//
+#if 0
+#define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation
+#include "stb_truetype.h"
+
+char ttf_buffer[1<<20];
+unsigned char temp_bitmap[512*512];
+
+stbtt_chardata cdata[96]; // ASCII 32..126 is 95 glyphs
+GLstbtt_uint ftex;
+
+void my_stbtt_initfont(void)
+{
+ fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
+ stbtt_BakeFontBitmap(data,0, 32.0, temp_bitmap,512,512, 32,96, cdata); // no guarantee this fits!
+ // can free ttf_buffer at this point
+ glGenTextures(1, &ftex);
+ glBindTexture(GL_TEXTURE_2D, ftex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 512,512, 0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_bitmap);
+ // can free temp_bitmap at this point
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+}
+
+void my_stbtt_print(float x, float y, char *text)
+{
+ // assume orthographic projection with units = screen pixels, origin at top left
+ glBindTexture(GL_TEXTURE_2D, ftex);
+ glBegin(GL_QUADS);
+ while (*text) {
+ if (*text >= 32 && *text < 128) {
+ stbtt_aligned_quad q;
+ stbtt_GetBakedQuad(cdata, 512,512, *text-32, &x,&y,&q,1);//1=opengl,0=old d3d
+ glTexCoord2f(q.s0,q.t1); glVertex2f(q.x0,q.y0);
+ glTexCoord2f(q.s1,q.t1); glVertex2f(q.x1,q.y0);
+ glTexCoord2f(q.s1,q.t0); glVertex2f(q.x1,q.y1);
+ glTexCoord2f(q.s0,q.t0); glVertex2f(q.x0,q.y1);
+ }
+ ++text;
+ }
+ glEnd();
+}
+#endif
+//
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Complete program (this compiles): get a single bitmap, print as ASCII art
+//
+#if 0
+#include <stdio.h>
+#define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation
+#include "stb_truetype.h"
+
+char ttf_buffer[1<<25];
+
+int main(int argc, char **argv)
+{
+ stbtt_fontinfo font;
+ unsigned char *bitmap;
+ int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 'a'), s = (argc > 2 ? atoi(argv[2]) : 20);
+
+ fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/arialbd.ttf", "rb"));
+
+ stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0));
+ bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, 0,0);
+
+ for (j=0; j < h; ++j) {
+ for (i=0; i < w; ++i)
+ putchar(" .:ioVM@"[bitmap[j*w+i]>>5]);
+ putchar('\n');
+ }
+ return 0;
+}
+#endif
+//
+// Output:
+//
+// .ii.
+// @@@@@@.
+// V@Mio@@o
+// :i. V@V
+// :oM@@M
+// :@@@MM@M
+// @@o o@M
+// :@@. M@M
+// @@@o@@@@
+// :M@@V:@@.
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// Complete program: print "Hello World!" banner, with bugs
+//
+#if 0
+int main(int arg, char **argv)
+{
+ unsigned char screen[20][79];
+ int i,j, pos=0;
+ float scale;
+ char *text = "Heljo World!";
+
+ fread(buffer, 1, 1000000, fopen("c:/windows/fonts/arialbd.ttf", "rb"));
+ stbtt_InitFont(&font, buffer, 0);
+
+ scale = stbtt_ScaleForPixelHeight(&font, 16);
+ memset(screen, 0, sizeof(screen));
+
+ while (*text) {
+ int advance,lsb,x0,y0,x1,y1, newpos, baseline=13;
+ stbtt_GetCodepointHMetrics(&font, *text, &advance, &lsb);
+ stbtt_GetCodepointBitmapBox(&font, *text, scale,scale, &x0,&y0,&x1,&y1);
+ newpos = pos + (int) (lsb * scale) + x0;
+ stbtt_MakeCodepointBitmap(&font, &screen[baseline + y0][newpos], x1-x0,y1-y0, 79, scale,scale, *text);
+ // note that this stomps the old data, so where character boxes overlap (e.g. 'lj') it's wrong
+ // because this API is really for baking character bitmaps into textures
+ pos += (int) (advance * scale);
+ ++text;
+ }
+
+ for (j=0; j < 20; ++j) {
+ for (i=0; i < 79; ++i)
+ putchar(" .:ioVM@"[screen[j][i]>>5]);
+ putchar('\n');
+ }
+
+ return 0;
+}
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+////
+//// INTEGRATION WITH RUNTIME LIBRARIES
+////
+
+#ifdef STB_TRUETYPE_IMPLEMENTATION
+ // #define your own (u)stbtt_int8/16/32 before including to override this
+ #ifndef stbtt_uint8
+ typedef unsigned char stbtt_uint8;
+ typedef signed char stbtt_int8;
+ typedef unsigned short stbtt_uint16;
+ typedef signed short stbtt_int16;
+ typedef unsigned int stbtt_uint32;
+ typedef signed int stbtt_int32;
+ #endif
+
+ typedef char stbtt__check_size32[sizeof(stbtt_int32)==4 ? 1 : -1];
+ typedef char stbtt__check_size16[sizeof(stbtt_int16)==2 ? 1 : -1];
+
+ // #define your own STBTT_sort() to override this to avoid qsort
+ #ifndef STBTT_sort
+ #include <stdlib.h>
+ #define STBTT_sort(data,num_items,item_size,compare_func) qsort(data,num_items,item_size,compare_func)
+ #endif
+
+ // #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h
+ #ifndef STBTT_ifloor
+ #include <math.h>
+ #define STBTT_ifloor(x) ((int) floor(x))
+ #define STBTT_iceil(x) ((int) ceil(x))
+ #endif
+
+ // #define your own functions "STBTT_malloc" / "STBTT_free" to avoid malloc.h
+ #ifndef STBTT_malloc
+ #include <malloc.h>
+ #define STBTT_malloc(x,u) malloc(x)
+ #define STBTT_free(x,u) free(x)
+ #endif
+
+ #ifndef STBTT_assert
+ #include <assert.h>
+ #define STBTT_assert(x) assert(x)
+ #endif
+
+ #ifndef STBTT_strlen
+ #include <string.h>
+ #define STBTT_strlen(x) strlen(x)
+ #endif
+
+ #ifndef STBTT_memcpy
+ #include <memory.h>
+ #define STBTT_memcpy memcpy
+ #define STBTT_memset memset
+ #endif
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+////
+//// INTERFACE
+////
+////
+
+#ifndef __STB_INCLUDE_STB_TRUETYPE_H__
+#define __STB_INCLUDE_STB_TRUETYPE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// TEXTURE BAKING API
+//
+// If you use this API, you only have to call two functions ever.
+//
+
+typedef struct
+{
+ unsigned short x0,y0,x1,y1; // coordinates of bbox in bitmap
+ float xoff,yoff,xadvance;
+} stbtt_bakedchar;
+
+extern int stbtt_BakeFontBitmap(const unsigned char *data, int offset, // font location (use offset=0 for plain .ttf)
+ float pixel_height, // height of font in pixels
+ unsigned char *pixels, int pw, int ph, // bitmap to be filled in
+ int first_char, int num_chars, // characters to bake
+ stbtt_bakedchar *chardata); // you allocate this, it's num_chars long
+// if return is positive, the first unused row of the bitmap
+// if return is negative, returns the negative of the number of characters that fit
+// if return is 0, no characters fit and no rows were used
+// This uses a very crappy packing.
+
+typedef struct
+{
+ float x0,y0,s0,t0; // top-left
+ float x1,y1,s1,t1; // bottom-right
+} stbtt_aligned_quad;
+
+extern void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, // same data as above
+ int char_index, // character to display
+ float *xpos, float *ypos, // pointers to current position in screen pixel space
+ stbtt_aligned_quad *q, // output: quad to draw
+ int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier
+// Call GetBakedQuad with char_index = 'character - first_char', and it
+// creates the quad you need to draw and advances the current position.
+// It's inefficient; you might want to c&p it and optimize it.
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// FONT LOADING
+//
+//
+
+extern int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index);
+// Each .ttf file may have more than one font. Each has a sequential index
+// number starting from 0. Call this function to get the font offset for a
+// given index; it returns -1 if the index is out of range. A regular .ttf
+// file will only define one font and it always be at offset 0, so it will
+// return '0' for index 0, and -1 for all other indices. You can just skip
+// this step if you know it's that kind of font.
+
+
+// The following structure is defined publically so you can declare one on
+// the stack or as a global or etc.
+typedef struct
+{
+ void *userdata;
+ unsigned char *data; // pointer to .ttf file
+ int fontstart; // offset of start of font
+
+ int numGlyphs; // number of glyphs, needed for range checking
+
+ int loca,head,glyf,hhea,hmtx; // table locations as offset from start of .ttf
+ int index_map; // a cmap mapping for our chosen character encoding
+ int indexToLocFormat; // format needed to map from glyph index to glyph
+} stbtt_fontinfo;
+
+extern int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset);
+// Given an offset into the file that defines a font, this function builds
+// the necessary cached info for the rest of the system. You must allocate
+// the stbtt_fontinfo yourself, and stbtt_InitFont will fill it out. You don't
+// need to do anything special to free it, because the contents are a pure
+// cache with no additional data structures. Returns 0 on failure.
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// CHARACTER TO GLYPH-INDEX CONVERSIOn
+
+int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint);
+// If you're going to perform multiple operations on the same character
+// and you want a speed-up, call this function with the character you're
+// going to process, then use glyph-based functions instead of the
+// codepoint-based functions.
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// CHARACTER PROPERTIES
+//
+
+extern float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float pixels);
+// computes a scale factor to produce a font whose "height" is 'pixels' tall.
+// Height is measured as the distance from the highest ascender to the lowest
+// descender; in other words, it's equivalent to calling stbtt_GetFontVMetrics
+// and computing:
+// scale = pixels / (ascent - descent)
+// so if you prefer to measure height by the ascent only, use a similar calculation.
+
+extern void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap);
+// ascent is the coordinate above the baseline the font extends; descent
+// is the coordinate below the baseline the font extends (i.e. it is typically negative)
+// lineGap is the spacing between one row's descent and the next row's ascent...
+// so you should advance the vertical position by "*ascent - *descent + *lineGap"
+// these are expressed in unscaled coordinates
+
+extern void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing);
+// leftSideBearing is the offset from the current horizontal position to the left edge of the character
+// advanceWidth is the offset from the current horizontal position to the next horizontal position
+// these are expressed in unscaled coordinates
+
+extern int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2);
+// an additional amount to add to the 'advance' value between ch1 and ch2
+// @TODO; for now always returns 0!
+
+extern int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1);
+// Gets the bounding box of the visible part of the glyph, in unscaled coordinates
+
+extern void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing);
+extern int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2);
+extern int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1);
+// as above, but takes one or more glyph indices for greater efficiency
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// GLYPH SHAPES (you probably don't need these, but they have to go before
+// the bitmaps for C declaration-order reasons)
+//
+
+#ifndef STBTT_vmove // you can predefine these to use different values (but why?)
+ enum {
+ STBTT_vmove=1,
+ STBTT_vline,
+ STBTT_vcurve
+ };
+#endif
+
+#ifndef stbtt_vertex // you can predefine this to use different values
+ // (we share this with other code at RAD)
+ #define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file
+ typedef struct
+ {
+ stbtt_vertex_type x,y,cx,cy;
+ unsigned char type,padding;
+ } stbtt_vertex;
+#endif
+
+extern int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices);
+extern int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **vertices);
+// returns # of vertices and fills *vertices with the pointer to them
+// these are expressed in "unscaled" coordinates
+
+extern void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertices);
+// frees the data allocated above
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// BITMAP RENDERING
+//
+
+extern void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata);
+// frees the bitmap allocated below
+
+extern unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff);
+// allocates a large-enough single-channel 8bpp bitmap and renders the
+// specified character/glyph at the specified scale into it, with
+// antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque).
+// *width & *height are filled out with the width & height of the bitmap,
+// which is stored left-to-right, top-to-bottom.
+//
+// xoff/yoff are the offset it pixel space from the glyph origin to the top-left of the bitmap
+
+extern void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint);
+// the same as above, but you pass in storage for the bitmap in the form
+// of 'output', with row spacing of 'out_stride' bytes. the bitmap is
+// clipped to out_w/out_h bytes. call the next function to get the
+// height and width and positioning info
+
+extern void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1);
+// get the bbox of the bitmap centered around the glyph origin; so the
+// bitmap width is ix1-ix0, height is iy1-iy0, and location to place
+// the bitmap top left is (leftSideBearing*scale,iy0).
+// (Note that the bitmap uses y-increases-down, but the shape uses
+// y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.)
+
+extern unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff);
+extern void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1);
+extern void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph);
+
+//extern void stbtt_get_true_bbox(stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1);
+
+// @TODO: don't expose this structure
+typedef struct
+{
+ int w,h,stride;
+ unsigned char *pixels;
+} stbtt__bitmap;
+
+extern void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, int x_off, int y_off, int invert, void *userdata);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Finding the right font...
+//
+// You should really just solve this offline, keep your own tables
+// of what font is what, and don't try to get it out of the .ttf file.
+// That's because getting it out of the .ttf file is really hard, because
+// the names in the file can appear in many possible encodings, in many
+// possible languages, and e.g. if you need a case-insensitive comparison,
+// the details of that depend on the encoding & language in a complex way
+// (actually underspecified in truetype, but also gigantic).
+//
+// But you can use the provided functions in two possible ways:
+// stbtt_FindMatchingFont() will use *case-sensitive* comparisons on
+// unicode-encoded names to try to find the font you want;
+// you can run this before calling stbtt_InitFont()
+//
+// stbtt_GetFontNameString() lets you get any of the various strings
+// from the file yourself and do your own comparisons on them.
+// You have to have called stbtt_InitFont() first.
+
+
+extern int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags);
+// returns the offset (not index) of the font that matches, or -1 if none
+// if you use STBTT_MACSTYLE_DONTCARE, use a font name like "Arial Bold".
+// if you use any other flag, use a font name like "Arial"; this checks
+// the 'macStyle' header field; i don't know if fonts set this consistently
+#define STBTT_MACSTYLE_DONTCARE 0
+#define STBTT_MACSTYLE_BOLD 1
+#define STBTT_MACSTYLE_ITALIC 2
+#define STBTT_MACSTYLE_UNDERSCORE 4
+#define STBTT_MACSTYLE_NONE 8 // <= not same as 0, this makes us check the bitfield is 0
+
+extern int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2);
+// returns 1/0 whether the first string interpreted as utf8 is identical to
+// the second string interpreted as big-endian utf16... useful for strings from next func
+
+extern char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID);
+// returns the string (which may be big-endian double byte, e.g. for unicode)
+// and puts the length in bytes in *length.
+//
+// some of the values for the IDs are below; for more see the truetype spec:
+// http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html
+// http://www.microsoft.com/typography/otspec/name.htm
+
+enum { // platformID
+ STBTT_PLATFORM_ID_UNICODE =0,
+ STBTT_PLATFORM_ID_MAC =1,
+ STBTT_PLATFORM_ID_ISO =2,
+ STBTT_PLATFORM_ID_MICROSOFT =3
+};
+
+enum { // encodingID for STBTT_PLATFORM_ID_UNICODE
+ STBTT_UNICODE_EID_UNICODE_1_0 =0,
+ STBTT_UNICODE_EID_UNICODE_1_1 =1,
+ STBTT_UNICODE_EID_ISO_10646 =2,
+ STBTT_UNICODE_EID_UNICODE_2_0_BMP=3,
+ STBTT_UNICODE_EID_UNICODE_2_0_FULL=4,
+};
+
+enum { // encodingID for STBTT_PLATFORM_ID_MICROSOFT
+ STBTT_MS_EID_SYMBOL =0,
+ STBTT_MS_EID_UNICODE_BMP =1,
+ STBTT_MS_EID_SHIFTJIS =2,
+ STBTT_MS_EID_UNICODE_FULL =10,
+};
+
+enum { // encodingID for STBTT_PLATFORM_ID_MAC; same as Script Manager codes
+ STBTT_MAC_EID_ROMAN =0, STBTT_MAC_EID_ARABIC =4,
+ STBTT_MAC_EID_JAPANESE =1, STBTT_MAC_EID_HEBREW =5,
+ STBTT_MAC_EID_CHINESE_TRAD =2, STBTT_MAC_EID_GREEK =6,
+ STBTT_MAC_EID_KOREAN =3, STBTT_MAC_EID_RUSSIAN =7,
+};
+
+enum { // languageID for STBTT_PLATFORM_ID_MICROSOFT; same as LCID...
+ // problematic because there are e.g. 16 english LCIDs and 16 arabic LCIDs
+ STBTT_MS_LANG_ENGLISH =0x0409, STBTT_MS_LANG_ITALIAN =0x0410,
+ STBTT_MS_LANG_CHINESE =0x0804, STBTT_MS_LANG_JAPANESE =0x0411,
+ STBTT_MS_LANG_DUTCH =0x0413, STBTT_MS_LANG_KOREAN =0x0412,
+ STBTT_MS_LANG_FRENCH =0x040c, STBTT_MS_LANG_RUSSIAN =0x0419,
+ STBTT_MS_LANG_GERMAN =0x0407, STBTT_MS_LANG_SPANISH =0x0409,
+ STBTT_MS_LANG_HEBREW =0x040d, STBTT_MS_LANG_SWEDISH =0x041D,
+};
+
+enum { // languageID for STBTT_PLATFORM_ID_MAC
+ STBTT_MAC_LANG_ENGLISH =0 , STBTT_MAC_LANG_JAPANESE =11,
+ STBTT_MAC_LANG_ARABIC =12, STBTT_MAC_LANG_KOREAN =23,
+ STBTT_MAC_LANG_DUTCH =4 , STBTT_MAC_LANG_RUSSIAN =32,
+ STBTT_MAC_LANG_FRENCH =1 , STBTT_MAC_LANG_SPANISH =6 ,
+ STBTT_MAC_LANG_GERMAN =2 , STBTT_MAC_LANG_SWEDISH =5 ,
+ STBTT_MAC_LANG_HEBREW =10, STBTT_MAC_LANG_CHINESE_SIMPLIFIED =33,
+ STBTT_MAC_LANG_ITALIAN =3 , STBTT_MAC_LANG_CHINESE_TRAD =19,
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __STB_INCLUDE_STB_TRUETYPE_H__
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+////
+//// IMPLEMENTATION
+////
+////
+
+#ifdef STB_TRUETYPE_IMPLEMENTATION
+
+//////////////////////////////////////////////////////////////////////////
+//
+// accessors to parse data from file
+//
+
+// on platforms that don't allow misaligned reads, if we want to allow
+// truetype fonts that aren't padded to alignment, define ALLOW_UNALIGNED_TRUETYPE
+
+#define ttBYTE(p) (* (stbtt_uint8 *) (p))
+#define ttCHAR(p) (* (stbtt_int8 *) (p))
+#define ttFixed(p) ttLONG(p)
+
+#if defined(STB_TRUETYPE_BIGENDIAN) && !defined(ALLOW_UNALIGNED_TRUETYPE)
+
+ #define ttUSHORT(p) (* (stbtt_uint16 *) (p))
+ #define ttSHORT(p) (* (stbtt_int16 *) (p))
+ #define ttULONG(p) (* (stbtt_uint32 *) (p))
+ #define ttLONG(p) (* (stbtt_int32 *) (p))
+
+#else
+
+ stbtt_uint16 ttUSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; }
+ stbtt_int16 ttSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; }
+ stbtt_uint32 ttULONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }
+ stbtt_int32 ttLONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }
+
+#endif
+
+#define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3))
+#define stbtt_tag(p,str) stbtt_tag4(p,str[0],str[1],str[2],str[3])
+
+static int stbtt__isfont(const stbtt_uint8 *font)
+{
+ // check the version number
+ if (stbtt_tag(font, "1")) return 1; // TrueType 1
+ if (stbtt_tag(font, "typ1")) return 1; // TrueType with type 1 font -- we don't support this!
+ if (stbtt_tag(font, "OTTO")) return 1; // OpenType with CFF
+ if (stbtt_tag4(font, 0,1,0,0)) return 1; // OpenType 1.0
+ return 0;
+}
+
+// @OPTIMIZE: binary search
+static stbtt_uint32 stbtt__find_table(stbtt_uint8 *data, stbtt_uint32 fontstart, const char *tag)
+{
+ stbtt_int32 num_tables = ttUSHORT(data+fontstart+4);
+ stbtt_uint32 tabledir = fontstart + 12;
+ stbtt_int32 i;
+ for (i=0; i < num_tables; ++i) {
+ stbtt_uint32 loc = tabledir + 16*i;
+ if (stbtt_tag(data+loc+0, tag))
+ return ttULONG(data+loc+8);
+ }
+ return 0;
+}
+
+int stbtt_GetFontOffsetForIndex(const unsigned char *font_collection, int index)
+{
+ // if it's just a font, there's only one valid index
+ if (stbtt__isfont(font_collection))
+ return index == 0 ? 0 : -1;
+
+ // check if it's a TTC
+ if (stbtt_tag(font_collection, "ttcf")) {
+ // version 1?
+ if (ttULONG(font_collection+4) == 0x00010000 || ttULONG(font_collection+4) == 0x00020000) {
+ stbtt_int32 n = ttLONG(font_collection+8);
+ if (index >= n)
+ return -1;
+ return ttULONG(font_collection+12+index*14);
+ }
+ }
+ return -1;
+}
+
+int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data2, int fontstart)
+{
+ stbtt_uint8 *data = (stbtt_uint8 *) data2;
+ stbtt_uint32 cmap, t;
+ stbtt_int32 i,numTables;
+
+ info->data = data;
+ info->fontstart = fontstart;
+
+ cmap = stbtt__find_table(data, fontstart, "cmap");
+ info->loca = stbtt__find_table(data, fontstart, "loca");
+ info->head = stbtt__find_table(data, fontstart, "head");
+ info->glyf = stbtt__find_table(data, fontstart, "glyf");
+ info->hhea = stbtt__find_table(data, fontstart, "hhea");
+ info->hmtx = stbtt__find_table(data, fontstart, "hmtx");
+ if (!cmap || !info->loca || !info->head || !info->glyf || !info->hhea || !info->hmtx)
+ return 0;
+
+ t = stbtt__find_table(data, fontstart, "maxp");
+ if (t)
+ info->numGlyphs = ttUSHORT(data+t+4);
+ else
+ info->numGlyphs = 0xffff;
+
+ // find a cmap encoding table we understand *now* to avoid searching
+ // later. (todo: could make this installable)
+ // the same regardless of glyph.
+ numTables = ttUSHORT(data + cmap + 2);
+ info->index_map = 0;
+ for (i=0; i < numTables; ++i) {
+ stbtt_uint32 encoding_record = cmap + 4 + 8 * i;
+ // find an encoding we understand:
+ switch(ttUSHORT(data+encoding_record)) {
+ case STBTT_PLATFORM_ID_MICROSOFT:
+ switch (ttUSHORT(data+encoding_record+2)) {
+ case STBTT_MS_EID_UNICODE_BMP:
+ case STBTT_MS_EID_UNICODE_FULL:
+ // MS/Unicode
+ info->index_map = cmap + ttULONG(data+encoding_record+4);
+ break;
+ }
+ break;
+ }
+ }
+ if (info->index_map == 0)
+ return 0;
+
+ info->indexToLocFormat = ttUSHORT(data+info->head + 50);
+ return 1;
+}
+
+int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint)
+{
+ stbtt_uint8 *data = info->data;
+ stbtt_uint32 index_map = info->index_map;
+
+ stbtt_uint16 format = ttUSHORT(data + index_map + 0);
+ if (format == 0) { // apple byte encoding
+ stbtt_int32 bytes = ttUSHORT(data + index_map + 2);
+ if (unicode_codepoint < bytes-6)
+ return ttBYTE(data + index_map + 6 + unicode_codepoint);
+ return 0;
+ } else if (format == 6) {
+ stbtt_uint32 first = ttUSHORT(data + index_map + 6);
+ stbtt_uint32 count = ttUSHORT(data + index_map + 8);
+ if ((stbtt_uint32) unicode_codepoint >= first && (stbtt_uint32) unicode_codepoint < first+count)
+ return ttUSHORT(data + index_map + 10 + (unicode_codepoint - first)*2);
+ return 0;
+ } else if (format == 2) {
+ STBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean
+ return 0;
+ } else if (format == 4) { // standard mapping for windows fonts: binary search collection of ranges
+ stbtt_uint16 segcount = ttUSHORT(data+index_map+6) >> 1;
+ stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1;
+ stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10);
+ stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1;
+ stbtt_uint16 item, offset, start, end;
+
+ (void)end;
+
+ // do a binary search of the segments
+ stbtt_uint32 endCount = index_map + 14;
+ stbtt_uint32 search = endCount;
+
+ if (unicode_codepoint > 0xffff)
+ return 0;
+
+ // they lie from endCount .. endCount + segCount
+ // but searchRange is the nearest power of two, so...
+ if (unicode_codepoint >= ttUSHORT(data + search + rangeShift*2))
+ search += rangeShift*2;
+
+ // now decrement to bias correctly to find smallest
+ search -= 2;
+ while (entrySelector) {
+ stbtt_uint16 start, end;
+ searchRange >>= 1;
+ start = ttUSHORT(data + search + 2 + segcount*2 + 2);
+ end = ttUSHORT(data + search + 2);
+ start = ttUSHORT(data + search + searchRange*2 + segcount*2 + 2);
+ end = ttUSHORT(data + search + searchRange*2);
+ if (unicode_codepoint > end)
+ search += searchRange*2;
+ --entrySelector;
+
+ (void)start;
+ }
+ search += 2;
+
+ item = (stbtt_uint16) ((search - endCount) >> 1);
+
+ STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item));
+ start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item);
+ end = ttUSHORT(data + index_map + 14 + 2 + 2*item);
+ if (unicode_codepoint < start)
+ return 0;
+
+ offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item);
+ if (offset == 0)
+ return unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item);
+
+ return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item);
+ } else if (format == 12) {
+ stbtt_uint16 ngroups = ttUSHORT(data+index_map+6);
+ stbtt_int32 low,high;
+ low = 0; high = (stbtt_int32)ngroups;
+ // Binary search the right group.
+ while (low <= high) {
+ stbtt_int32 mid = low + ((high-low) >> 1); // rounds down, so low <= mid < high
+ stbtt_uint32 start_char = ttULONG(data+index_map+16+mid*12);
+ stbtt_uint32 end_char = ttULONG(data+index_map+16+mid*12+4);
+ if ((stbtt_uint32) unicode_codepoint < start_char)
+ high = mid-1;
+ else if ((stbtt_uint32) unicode_codepoint > end_char)
+ low = mid+1;
+ else {
+ stbtt_uint32 start_glyph = ttULONG(data+index_map+16+mid*12+8);
+ return start_glyph + unicode_codepoint-start_char;
+ }
+ }
+ return 0; // not found
+ }
+ // @TODO
+ STBTT_assert(0);
+ return 0;
+}
+
+int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices)
+{
+ return stbtt_GetGlyphShape(info, stbtt_FindGlyphIndex(info, unicode_codepoint), vertices);
+}
+
+static void stbtt_setvertex(stbtt_vertex *v, stbtt_uint8 type, stbtt_int16 x, stbtt_int16 y, stbtt_int16 cx, stbtt_int16 cy)
+{
+ v->type = type;
+ v->x = x;
+ v->y = y;
+ v->cx = cx;
+ v->cy = cy;
+}
+
+static int stbtt__GetGlyfOffset(const stbtt_fontinfo *info, int glyph_index)
+{
+ int g1,g2;
+
+ if (glyph_index >= info->numGlyphs) return -1; // glyph index out of range
+ if (info->indexToLocFormat >= 2) return -1; // unknown index->glyph map format
+
+ if (info->indexToLocFormat == 0) {
+ g1 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2) * 2;
+ g2 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2 + 2) * 2;
+ } else {
+ g1 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4);
+ g2 = info->glyf + ttULONG (info->data + info->loca + glyph_index * 4 + 4);
+ }
+
+ return g1==g2 ? -1 : g1; // if length is 0, return -1
+}
+
+int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1)
+{
+ int g = stbtt__GetGlyfOffset(info, glyph_index);
+ if (g < 0) return 0;
+
+ if (x0) *x0 = ttSHORT(info->data + g + 2);
+ if (y0) *y0 = ttSHORT(info->data + g + 4);
+ if (x1) *x1 = ttSHORT(info->data + g + 6);
+ if (y1) *y1 = ttSHORT(info->data + g + 8);
+ return 1;
+}
+
+int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1)
+{
+ return stbtt_GetGlyphBox(info, stbtt_FindGlyphIndex(info,codepoint), x0,y0,x1,y1);
+}
+
+int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices)
+{
+ stbtt_int16 numberOfContours;
+ stbtt_uint8 *endPtsOfContours;
+ stbtt_uint8 *data = info->data;
+ stbtt_vertex *vertices=0;
+ int num_vertices=0;
+ int g = stbtt__GetGlyfOffset(info, glyph_index);
+
+ *pvertices = NULL;
+
+ if (g < 0) return 0;
+
+ numberOfContours = ttSHORT(data + g);
+
+ if (numberOfContours > 0) {
+ stbtt_uint8 flags=0,flagcount;
+ stbtt_int32 ins, i,j=0,m,n, next_move, was_off=0, off;
+ stbtt_int16 x,y,cx,cy,sx,sy;
+ stbtt_uint8 *points;
+ endPtsOfContours = (data + g + 10);
+ ins = ttUSHORT(data + g + 10 + numberOfContours * 2);
+ points = data + g + 10 + numberOfContours * 2 + 2 + ins;
+
+ n = 1+ttUSHORT(endPtsOfContours + numberOfContours*2-2);
+
+ m = n + numberOfContours; // a loose bound on how many vertices we might need
+ vertices = (stbtt_vertex *) STBTT_malloc(m * sizeof(vertices[0]), info->userdata);
+ if (vertices == 0)
+ return 0;
+
+ next_move = 0;
+ flagcount=0;
+
+ // in first pass, we load uninterpreted data into the allocated array
+ // above, shifted to the end of the array so we won't overwrite it when
+ // we create our final data starting from the front
+
+ off = m - n; // starting offset for uninterpreted data, regardless of how m ends up being calculated
+
+ // first load flags
+
+ for (i=0; i < n; ++i) {
+ if (flagcount == 0) {
+ flags = *points++;
+ if (flags & 8)
+ flagcount = *points++;
+ } else
+ --flagcount;
+ vertices[off+i].type = flags;
+ }
+
+ // now load x coordinates
+ x=0;
+ for (i=0; i < n; ++i) {
+ flags = vertices[off+i].type;
+ if (flags & 2) {
+ stbtt_int16 dx = *points++;
+ x += (flags & 16) ? dx : -dx; // ???
+ } else {
+ if (!(flags & 16)) {
+ x = x + (stbtt_int16) (points[0]*256 + points[1]);
+ points += 2;
+ }
+ }
+ vertices[off+i].x = x;
+ }
+
+ // now load y coordinates
+ y=0;
+ for (i=0; i < n; ++i) {
+ flags = vertices[off+i].type;
+ if (flags & 4) {
+ stbtt_int16 dy = *points++;
+ y += (flags & 32) ? dy : -dy; // ???
+ } else {
+ if (!(flags & 32)) {
+ y = y + (stbtt_int16) (points[0]*256 + points[1]);
+ points += 2;
+ }
+ }
+ vertices[off+i].y = y;
+ }
+
+ // now convert them to our format
+ num_vertices=0;
+ sx = sy = cx = cy = 0;
+ for (i=0; i < n; ++i) {
+ flags = vertices[off+i].type;
+ x = (stbtt_int16) vertices[off+i].x;
+ y = (stbtt_int16) vertices[off+i].y;
+ if (next_move == i) {
+ // when we get to the end, we have to close the shape explicitly
+ if (i != 0) {
+ if (was_off)
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy);
+ else
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0);
+ }
+
+ // now start the new one
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vmove,x,y,0,0);
+ next_move = 1 + ttUSHORT(endPtsOfContours+j*2);
+ ++j;
+ was_off = 0;
+ sx = x;
+ sy = y;
+ } else {
+ if (!(flags & 1)) { // if it's a curve
+ if (was_off) // two off-curve control points in a row means interpolate an on-curve midpoint
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx+x)>>1, (cy+y)>>1, cx, cy);
+ cx = x;
+ cy = y;
+ was_off = 1;
+ } else {
+ if (was_off)
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, x,y, cx, cy);
+ else
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vline, x,y,0,0);
+ was_off = 0;
+ }
+ }
+ }
+ if (i != 0) {
+ if (was_off)
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve,sx,sy,cx,cy);
+ else
+ stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0);
+ }
+ } else if (numberOfContours == -1) {
+ // Compound shapes.
+ int more = 1;
+ stbtt_uint8 *comp = data + g + 10;
+ num_vertices = 0;
+ vertices = 0;
+ while (more) {
+ stbtt_uint16 flags, gidx;
+ int comp_num_verts = 0, i;
+ stbtt_vertex *comp_verts = 0, *tmp = 0;
+ float mtx[6] = {1,0,0,1,0,0}, m, n;
+
+ flags = ttSHORT(comp); comp+=2;
+ gidx = ttSHORT(comp); comp+=2;
+
+ if (flags & 2) { // XY values
+ if (flags & 1) { // shorts
+ mtx[4] = ttSHORT(comp); comp+=2;
+ mtx[5] = ttSHORT(comp); comp+=2;
+ } else {
+ mtx[4] = ttCHAR(comp); comp+=1;
+ mtx[5] = ttCHAR(comp); comp+=1;
+ }
+ }
+ else {
+ // @TODO handle matching point
+ STBTT_assert(0);
+ }
+ if (flags & (1<<3)) { // WE_HAVE_A_SCALE
+ mtx[0] = mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;
+ mtx[1] = mtx[2] = 0;
+ } else if (flags & (1<<6)) { // WE_HAVE_AN_X_AND_YSCALE
+ mtx[0] = ttSHORT(comp)/16384.0f; comp+=2;
+ mtx[1] = mtx[2] = 0;
+ mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;
+ } else if (flags & (1<<7)) { // WE_HAVE_A_TWO_BY_TWO
+ mtx[0] = ttSHORT(comp)/16384.0f; comp+=2;
+ mtx[1] = ttSHORT(comp)/16384.0f; comp+=2;
+ mtx[2] = ttSHORT(comp)/16384.0f; comp+=2;
+ mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;
+ }
+
+ // Find transformation scales.
+ m = (float) sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]);
+ n = (float) sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]);
+
+ // Get indexed glyph.
+ comp_num_verts = stbtt_GetGlyphShape(info, gidx, &comp_verts);
+ if (comp_num_verts > 0) {
+ // Transform vertices.
+ for (i = 0; i < comp_num_verts; ++i) {
+ stbtt_vertex* v = &comp_verts[i];
+ stbtt_vertex_type x,y;
+ x=v->x; y=v->y;
+ v->x = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4]));
+ v->y = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5]));
+ x=v->cx; y=v->cy;
+ v->cx = (stbtt_vertex_type)(m * (mtx[0]*x + mtx[2]*y + mtx[4]));
+ v->cy = (stbtt_vertex_type)(n * (mtx[1]*x + mtx[3]*y + mtx[5]));
+ }
+ // Append vertices.
+ tmp = (stbtt_vertex*)STBTT_malloc((num_vertices+comp_num_verts)*sizeof(stbtt_vertex), info->userdata);
+ if (!tmp) {
+ if (vertices) STBTT_free(vertices, info->userdata);
+ if (comp_verts) STBTT_free(comp_verts, info->userdata);
+ return 0;
+ }
+ if (num_vertices > 0) memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex));
+ memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex));
+ if (vertices) STBTT_free(vertices, info->userdata);
+ vertices = tmp;
+ STBTT_free(comp_verts, info->userdata);
+ num_vertices += comp_num_verts;
+ }
+ // More components ?
+ more = flags & (1<<5);
+ }
+ } else if (numberOfContours < 0) {
+ // @TODO other compound variations?
+ STBTT_assert(0);
+ } else {
+ // numberOfCounters == 0, do nothing
+ }
+
+ *pvertices = vertices;
+ return num_vertices;
+}
+
+void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing)
+{
+ stbtt_uint16 numOfLongHorMetrics = ttUSHORT(info->data+info->hhea + 34);
+ if (glyph_index < numOfLongHorMetrics) {
+ if (advanceWidth) *advanceWidth = ttSHORT(info->data + info->hmtx + 4*glyph_index);
+ if (leftSideBearing) *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*glyph_index + 2);
+ } else {
+ if (advanceWidth) *advanceWidth = ttSHORT(info->data + info->hmtx + 4*(numOfLongHorMetrics-1));
+ if (leftSideBearing) *leftSideBearing = ttSHORT(info->data + info->hmtx + 4*numOfLongHorMetrics + 2*(glyph_index - numOfLongHorMetrics));
+ }
+}
+
+int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo * /*info*/, int /*glyph1*/, int /*glyph2*/)
+{
+ return 0;
+}
+
+int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo * /*info*/, int /*ch1*/, int /*ch2*/)
+{
+ return 0;
+}
+
+void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing)
+{
+ stbtt_GetGlyphHMetrics(info, stbtt_FindGlyphIndex(info,codepoint), advanceWidth, leftSideBearing);
+}
+
+void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap)
+{
+ if (ascent ) *ascent = ttSHORT(info->data+info->hhea + 4);
+ if (descent) *descent = ttSHORT(info->data+info->hhea + 6);
+ if (lineGap) *lineGap = ttSHORT(info->data+info->hhea + 8);
+}
+
+float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float height)
+{
+ int fheight = ttSHORT(info->data + info->hhea + 4) - ttSHORT(info->data + info->hhea + 6);
+ return (float) height / fheight;
+}
+
+void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v)
+{
+ STBTT_free(v, info->userdata);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// antialiasing software rasterizer
+//
+
+void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)
+{
+ int x0,y0,x1,y1;
+ if (!stbtt_GetGlyphBox(font, glyph, &x0,&y0,&x1,&y1))
+ x0=y0=x1=y1=0; // e.g. space character
+ // now move to integral bboxes (treating pixels as little squares, what pixels get touched)?
+ if (ix0) *ix0 = STBTT_ifloor(x0 * scale_x);
+ if (iy0) *iy0 = -STBTT_iceil (y1 * scale_y);
+ if (ix1) *ix1 = STBTT_iceil (x1 * scale_x);
+ if (iy1) *iy1 = -STBTT_ifloor(y0 * scale_y);
+}
+
+void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)
+{
+ stbtt_GetGlyphBitmapBox(font, stbtt_FindGlyphIndex(font,codepoint), scale_x, scale_y, ix0,iy0,ix1,iy1);
+}
+
+typedef struct stbtt__edge {
+ float x0,y0, x1,y1;
+ int invert;
+} stbtt__edge;
+
+typedef struct stbtt__active_edge
+{
+ int x,dx;
+ float ey;
+ struct stbtt__active_edge *next;
+ int valid;
+} stbtt__active_edge;
+
+#define FIXSHIFT 10
+#define FIX (1 << FIXSHIFT)
+#define FIXMASK (FIX-1)
+
+static stbtt__active_edge *new_active(stbtt__edge *e, int off_x, float start_point, void *userdata)
+{
+ stbtt__active_edge *z = (stbtt__active_edge *) STBTT_malloc(sizeof(*z), userdata); // @TODO: make a pool of these!!!
+ float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
+ STBTT_assert(e->y0 <= start_point);
+ if (!z) return z;
+ // round dx down to avoid going too far
+ if (dxdy < 0)
+ z->dx = -STBTT_ifloor(FIX * -dxdy);
+ else
+ z->dx = STBTT_ifloor(FIX * dxdy);
+ z->x = STBTT_ifloor(FIX * (e->x0 + dxdy * (start_point - e->y0)));
+ z->x -= off_x * FIX;
+ z->ey = e->y1;
+ z->next = 0;
+ z->valid = e->invert ? 1 : -1;
+ return z;
+}
+
+// note: this routine clips fills that extend off the edges... ideally this
+// wouldn't happen, but it could happen if the truetype glyph bounding boxes
+// are wrong, or if the user supplies a too-small bitmap
+static void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__active_edge *e, int max_weight)
+{
+ // non-zero winding fill
+ int x0=0, w=0;
+
+ while (e) {
+ if (w == 0) {
+ // if we're currently at zero, we need to record the edge start point
+ x0 = e->x; w += e->valid;
+ } else {
+ int x1 = e->x; w += e->valid;
+ // if we went to zero, we need to draw
+ if (w == 0) {
+ int i = x0 >> FIXSHIFT;
+ int j = x1 >> FIXSHIFT;
+
+ if (i < len && j >= 0) {
+ if (i == j) {
+ // x0,x1 are the same pixel, so compute combined coverage
+ scanline[i] = scanline[i] + (stbtt_uint8) ((x1 - x0) * max_weight >> FIXSHIFT);
+ } else {
+ if (i >= 0) // add antialiasing for x0
+ scanline[i] = scanline[i] + (stbtt_uint8) (((FIX - (x0 & FIXMASK)) * max_weight) >> FIXSHIFT);
+ else
+ i = -1; // clip
+
+ if (j < len) // add antialiasing for x1
+ scanline[j] = scanline[j] + (stbtt_uint8) (((x1 & FIXMASK) * max_weight) >> FIXSHIFT);
+ else
+ j = len; // clip
+
+ for (++i; i < j; ++i) // fill pixels between x0 and x1
+ scanline[i] = scanline[i] + (stbtt_uint8) max_weight;
+ }
+ }
+ }
+ }
+
+ e = e->next;
+ }
+}
+
+static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)
+{
+ stbtt__active_edge *active = NULL;
+ int y,j=0;
+ int max_weight = (255 / vsubsample); // weight per vertical scanline
+ int s; // vertical subsample index
+ unsigned char scanline_data[512], *scanline;
+
+ if (result->w > 512)
+ scanline = (unsigned char *) STBTT_malloc(result->w, userdata);
+ else
+ scanline = scanline_data;
+
+ y = off_y * vsubsample;
+ e[n].y0 = (off_y + result->h) * (float) vsubsample + 1;
+
+ while (j < result->h) {
+ STBTT_memset(scanline, 0, result->w);
+ for (s=0; s < vsubsample; ++s) {
+ // find center of pixel for this scanline
+ float scan_y = y + 0.5f;
+ stbtt__active_edge **step = &active;
+
+ // update all active edges;
+ // remove all active edges that terminate before the center of this scanline
+ while (*step) {
+ stbtt__active_edge * z = *step;
+ if (z->ey <= scan_y) {
+ *step = z->next; // delete from list
+ STBTT_assert(z->valid);
+ z->valid = 0;
+ STBTT_free(z, userdata);
+ } else {
+ z->x += z->dx; // advance to position for current scanline
+ step = &((*step)->next); // advance through list
+ }
+ }
+
+ // resort the list if needed
+ for(;;) {
+ int changed=0;
+ step = &active;
+ while (*step && (*step)->next) {
+ if ((*step)->x > (*step)->next->x) {
+ stbtt__active_edge *t = *step;
+ stbtt__active_edge *q = t->next;
+
+ t->next = q->next;
+ q->next = t;
+ *step = q;
+ changed = 1;
+ }
+ step = &(*step)->next;
+ }
+ if (!changed) break;
+ }
+
+ // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline
+ while (e->y0 <= scan_y) {
+ if (e->y1 > scan_y) {
+ stbtt__active_edge *z = new_active(e, off_x, scan_y, userdata);
+ // find insertion point
+ if (active == NULL)
+ active = z;
+ else if (z->x < active->x) {
+ // insert at front
+ z->next = active;
+ active = z;
+ } else {
+ // find thing to insert AFTER
+ stbtt__active_edge *p = active;
+ while (p->next && p->next->x < z->x)
+ p = p->next;
+ // at this point, p->next->x is NOT < z->x
+ z->next = p->next;
+ p->next = z;
+ }
+ }
+ ++e;
+ }
+
+ // now process all active edges in XOR fashion
+ if (active)
+ stbtt__fill_active_edges(scanline, result->w, active, max_weight);
+
+ ++y;
+ }
+ STBTT_memcpy(result->pixels + j * result->stride, scanline, result->w);
+ ++j;
+ }
+
+ while (active) {
+ stbtt__active_edge *z = active;
+ active = active->next;
+ STBTT_free(z, userdata);
+ }
+
+ if (scanline != scanline_data)
+ STBTT_free(scanline, userdata);
+}
+
+static int stbtt__edge_compare(const void *p, const void *q)
+{
+ stbtt__edge *a = (stbtt__edge *) p;
+ stbtt__edge *b = (stbtt__edge *) q;
+
+ if (a->y0 < b->y0) return -1;
+ if (a->y0 > b->y0) return 1;
+ return 0;
+}
+
+typedef struct
+{
+ float x,y;
+} stbtt__point;
+
+static void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, int *wcount, int windings, float scale_x, float scale_y, int off_x, int off_y, int invert, void *userdata)
+{
+ float y_scale_inv = invert ? -scale_y : scale_y;
+ stbtt__edge *e;
+ int n,i,j,k,m;
+ int vsubsample = result->h < 8 ? 15 : 5;
+ // vsubsample should divide 255 evenly; otherwise we won't reach full opacity
+
+ // now we have to blow out the windings into explicit edge lists
+ n = 0;
+ for (i=0; i < windings; ++i)
+ n += wcount[i];
+
+ e = (stbtt__edge *) STBTT_malloc(sizeof(*e) * (n+1), userdata); // add an extra one as a sentinel
+ if (e == 0) return;
+ n = 0;
+
+ m=0;
+ for (i=0; i < windings; ++i) {
+ stbtt__point *p = pts + m;
+ m += wcount[i];
+ j = wcount[i]-1;
+ for (k=0; k < wcount[i]; j=k++) {
+ int a=k,b=j;
+ // skip the edge if horizontal
+ if (p[j].y == p[k].y)
+ continue;
+ // add edge from j to k to the list
+ e[n].invert = 0;
+ if (invert ? p[j].y > p[k].y : p[j].y < p[k].y) {
+ e[n].invert = 1;
+ a=j,b=k;
+ }
+ e[n].x0 = p[a].x * scale_x;
+ e[n].y0 = p[a].y * y_scale_inv * vsubsample;
+ e[n].x1 = p[b].x * scale_x;
+ e[n].y1 = p[b].y * y_scale_inv * vsubsample;
+ ++n;
+ }
+ }
+
+ // now sort the edges by their highest point (should snap to integer, and then by x)
+ STBTT_sort(e, n, sizeof(e[0]), stbtt__edge_compare);
+
+ // now, traverse the scanlines and find the intersections on each scanline, use xor winding rule
+ stbtt__rasterize_sorted_edges(result, e, n, vsubsample, off_x, off_y, userdata);
+
+ STBTT_free(e, userdata);
+}
+
+static void stbtt__add_point(stbtt__point *points, int n, float x, float y)
+{
+ if (!points) return; // during first pass, it's unallocated
+ points[n].x = x;
+ points[n].y = y;
+}
+
+// tesselate until threshhold p is happy... @TODO warped to compensate for non-linear stretching
+static int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n)
+{
+ // midpoint
+ float mx = (x0 + 2*x1 + x2)/4;
+ float my = (y0 + 2*y1 + y2)/4;
+ // versus directly drawn line
+ float dx = (x0+x2)/2 - mx;
+ float dy = (y0+y2)/2 - my;
+ if (n > 16) // 65536 segments on one curve better be enough!
+ return 1;
+ if (dx*dx+dy*dy > objspace_flatness_squared) { // half-pixel error allowed... need to be smaller if AA
+ stbtt__tesselate_curve(points, num_points, x0,y0, (x0+x1)/2.0f,(y0+y1)/2.0f, mx,my, objspace_flatness_squared,n+1);
+ stbtt__tesselate_curve(points, num_points, mx,my, (x1+x2)/2.0f,(y1+y2)/2.0f, x2,y2, objspace_flatness_squared,n+1);
+ } else {
+ stbtt__add_point(points, *num_points,x2,y2);
+ *num_points = *num_points+1;
+ }
+ return 1;
+}
+
+// returns number of contours
+stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num_verts, float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata)
+{
+ stbtt__point *points=0;
+ int num_points=0;
+
+ float objspace_flatness_squared = objspace_flatness * objspace_flatness;
+ int i,n=0,start=0, pass;
+
+ // count how many "moves" there are to get the contour count
+ for (i=0; i < num_verts; ++i)
+ if (vertices[i].type == STBTT_vmove)
+ ++n;
+
+ *num_contours = n;
+ if (n == 0) return 0;
+
+ *contour_lengths = (int *) STBTT_malloc(sizeof(**contour_lengths) * n, userdata);
+
+ if (*contour_lengths == 0) {
+ *num_contours = 0;
+ return 0;
+ }
+
+ // make two passes through the points so we don't need to realloc
+ for (pass=0; pass < 2; ++pass) {
+ float x=0,y=0;
+ if (pass == 1) {
+ points = (stbtt__point *) STBTT_malloc(num_points * sizeof(points[0]), userdata);
+ if (points == NULL) goto error;
+ }
+ num_points = 0;
+ n= -1;
+ for (i=0; i < num_verts; ++i) {
+ switch (vertices[i].type) {
+ case STBTT_vmove:
+ // start the next contour
+ if (n >= 0)
+ (*contour_lengths)[n] = num_points - start;
+ ++n;
+ start = num_points;
+
+ x = vertices[i].x, y = vertices[i].y;
+ stbtt__add_point(points, num_points++, x,y);
+ break;
+ case STBTT_vline:
+ x = vertices[i].x, y = vertices[i].y;
+ stbtt__add_point(points, num_points++, x, y);
+ break;
+ case STBTT_vcurve:
+ stbtt__tesselate_curve(points, &num_points, x,y,
+ vertices[i].cx, vertices[i].cy,
+ vertices[i].x, vertices[i].y,
+ objspace_flatness_squared, 0);
+ x = vertices[i].x, y = vertices[i].y;
+ break;
+ }
+ }
+ (*contour_lengths)[n] = num_points - start;
+ }
+
+ return points;
+error:
+ STBTT_free(points, userdata);
+ STBTT_free(*contour_lengths, userdata);
+ *contour_lengths = 0;
+ *num_contours = 0;
+ return NULL;
+}
+
+void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, int x_off, int y_off, int invert, void *userdata)
+{
+ float scale = scale_x > scale_y ? scale_y : scale_x;
+ int winding_count, *winding_lengths;
+ stbtt__point *windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, &winding_count, userdata);
+ if (windings) {
+ stbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, x_off, y_off, invert, userdata);
+ STBTT_free(winding_lengths, userdata);
+ STBTT_free(windings, userdata);
+ }
+}
+
+void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)
+{
+ STBTT_free(bitmap, userdata);
+}
+
+unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff)
+{
+ int ix0,iy0,ix1,iy1;
+ stbtt__bitmap gbm;
+ stbtt_vertex *vertices;
+ int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);
+
+ if (scale_x == 0) scale_x = scale_y;
+ if (scale_y == 0) {
+ if (scale_x == 0) return NULL;
+ scale_y = scale_x;
+ }
+
+ stbtt_GetGlyphBitmapBox(info, glyph, scale_x, scale_y, &ix0,&iy0,&ix1,&iy1);
+
+ // now we get the size
+ gbm.w = (ix1 - ix0);
+ gbm.h = (iy1 - iy0);
+ gbm.pixels = NULL; // in case we error
+
+ if (width ) *width = gbm.w;
+ if (height) *height = gbm.h;
+ if (xoff ) *xoff = ix0;
+ if (yoff ) *yoff = iy0;
+
+ if (gbm.w && gbm.h) {
+ gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata);
+ if (gbm.pixels) {
+ gbm.stride = gbm.w;
+
+ stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, ix0, iy0, 1, info->userdata);
+ }
+ }
+ STBTT_free(vertices, info->userdata);
+ return gbm.pixels;
+}
+
+void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph)
+{
+ int ix0,iy0;
+ stbtt_vertex *vertices;
+ int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);
+ stbtt__bitmap gbm;
+
+ stbtt_GetGlyphBitmapBox(info, glyph, scale_x, scale_y, &ix0,&iy0,0,0);
+ gbm.pixels = output;
+ gbm.w = out_w;
+ gbm.h = out_h;
+ gbm.stride = out_stride;
+
+ if (gbm.w && gbm.h)
+ stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, ix0,iy0, 1, info->userdata);
+
+ STBTT_free(vertices, info->userdata);
+}
+
+unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff)
+{
+ return stbtt_GetGlyphBitmap(info, scale_x, scale_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff);
+}
+
+void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)
+{
+ stbtt_MakeGlyphBitmap(info, output, out_w, out_h, out_stride, scale_x, scale_y, stbtt_FindGlyphIndex(info,codepoint));
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// bitmap baking
+//
+// This is SUPER-SHITTY packing to keep source code small
+
+extern int stbtt_BakeFontBitmap(const unsigned char *data, int offset, // font location (use offset=0 for plain .ttf)
+ float pixel_height, // height of font in pixels
+ unsigned char *pixels, int pw, int ph, // bitmap to be filled in
+ int first_char, int num_chars, // characters to bake
+ stbtt_bakedchar *chardata)
+{
+ float scale;
+ int x,y,bottom_y, i;
+ stbtt_fontinfo f;
+ stbtt_InitFont(&f, data, offset);
+ STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels
+ x=y=1;
+ bottom_y = 1;
+
+ scale = stbtt_ScaleForPixelHeight(&f, pixel_height);
+
+ for (i=0; i < num_chars; ++i) {
+ int advance, lsb, x0,y0,x1,y1,gw,gh;
+ int g = stbtt_FindGlyphIndex(&f, first_char + i);
+ stbtt_GetGlyphHMetrics(&f, g, &advance, &lsb);
+ stbtt_GetGlyphBitmapBox(&f, g, scale,scale, &x0,&y0,&x1,&y1);
+ gw = x1-x0;
+ gh = y1-y0;
+ if (x + gw + 1 >= pw)
+ y = bottom_y, x = 1; // advance to next row
+ if (y + gh + 1 >= ph) // check if it fits vertically AFTER potentially moving to next row
+ return -i;
+ STBTT_assert(x+gw < pw);
+ STBTT_assert(y+gh < ph);
+ stbtt_MakeGlyphBitmap(&f, pixels+x+y*pw, gw,gh,pw, scale,scale, g);
+ chardata[i].x0 = (stbtt_int16) x;
+ chardata[i].y0 = (stbtt_int16) y;
+ chardata[i].x1 = (stbtt_int16) (x + gw);
+ chardata[i].y1 = (stbtt_int16) (y + gh);
+ chardata[i].xadvance = scale * advance;
+ chardata[i].xoff = (float) x0;
+ chardata[i].yoff = (float) y0;
+ x = x + gw + 2;
+ if (y+gh+2 > bottom_y)
+ bottom_y = y+gh+2;
+ }
+ return bottom_y;
+}
+
+void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)
+{
+ float d3d_bias = opengl_fillrule ? 0 : -0.5f;
+ float ipw = 1.0f / pw, iph = 1.0f / ph;
+ stbtt_bakedchar *b = chardata + char_index;
+ int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5);
+ int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5);
+
+ q->x0 = round_x + d3d_bias;
+ q->y0 = round_y + d3d_bias;
+ q->x1 = round_x + b->x1 - b->x0 + d3d_bias;
+ q->y1 = round_y + b->y1 - b->y0 + d3d_bias;
+
+ q->s0 = b->x0 * ipw;
+ q->t0 = b->y0 * ipw;
+ q->s1 = b->x1 * iph;
+ q->t1 = b->y1 * iph;
+
+ *xpos += b->xadvance;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// font name matching -- recommended not to use this
+//
+
+// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string
+static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2)
+{
+ stbtt_int32 i=0;
+
+ // convert utf16 to utf8 and compare the results while converting
+ while (len2) {
+ stbtt_uint16 ch = s2[0]*256 + s2[1];
+ if (ch < 0x80) {
+ if (i >= len1) return -1;
+ if (s1[i++] != ch) return -1;
+ } else if (ch < 0x800) {
+ if (i+1 >= len1) return -1;
+ if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
+ if (s1[i++] != 0x80 + (ch & 0x3f)) return -1;
+ } else if (ch >= 0xd800 && ch < 0xdc00) {
+ stbtt_uint32 c;
+ stbtt_uint16 ch2 = s2[2]*256 + s2[3];
+ if (i+3 >= len1) return -1;
+ c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
+ if (s1[i++] != 0xf0 + (c >> 18)) return -1;
+ if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
+ if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
+ if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
+ s2 += 2; // plus another 2 below
+ len2 -= 2;
+ } else if (ch >= 0xdc00 && ch < 0xe000) {
+ return -1;
+ } else {
+ if (i+2 >= len1) return -1;
+ if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
+ if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
+ if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
+ }
+ s2 += 2;
+ len2 -= 2;
+ }
+ return i;
+}
+
+int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2)
+{
+ return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8*) s1, len1, (stbtt_uint8*) s2, len2);
+}
+
+// returns results in whatever encoding you request... but note that 2-byte encodings
+// will be BIG-ENDIAN... use stbtt_CompareUTF8toUTF16_bigendian() to compare
+char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID)
+{
+ stbtt_int32 i,count,stringOffset;
+ stbtt_uint8 *fc = font->data;
+ stbtt_uint32 offset = font->fontstart;
+ stbtt_uint32 nm = stbtt__find_table(fc, offset, "name");
+ if (!nm) return NULL;
+
+ count = ttUSHORT(fc+nm+2);
+ stringOffset = nm + ttUSHORT(fc+nm+4);
+ for (i=0; i < count; ++i) {
+ stbtt_uint32 loc = nm + 6 + 12 * i;
+ if (platformID == ttUSHORT(fc+loc+0) && encodingID == ttUSHORT(fc+loc+2)
+ && languageID == ttUSHORT(fc+loc+4) && nameID == ttUSHORT(fc+loc+6)) {
+ *length = ttUSHORT(fc+loc+8);
+ return (char *) (fc+stringOffset+ttUSHORT(fc+loc+10));
+ }
+ }
+ return NULL;
+}
+
+static int stbtt__matchpair(stbtt_uint8 *fc, stbtt_uint32 nm, stbtt_uint8 *name, stbtt_int32 nlen, stbtt_int32 target_id, stbtt_int32 next_id)
+{
+ stbtt_int32 i;
+ stbtt_int32 count = ttUSHORT(fc+nm+2);
+ stbtt_int32 stringOffset = nm + ttUSHORT(fc+nm+4);
+
+ for (i=0; i < count; ++i) {
+ stbtt_uint32 loc = nm + 6 + 12 * i;
+ stbtt_int32 id = ttUSHORT(fc+loc+6);
+ if (id == target_id) {
+ // find the encoding
+ stbtt_int32 platform = ttUSHORT(fc+loc+0), encoding = ttUSHORT(fc+loc+2), language = ttUSHORT(fc+loc+4);
+
+ // is this a Unicode encoding?
+ if (platform == 0 || (platform == 3 && encoding == 1) || (platform == 3 && encoding == 10)) {
+ stbtt_int32 slen = ttUSHORT(fc+loc+8), off = ttUSHORT(fc+loc+10);
+
+ // check if there's a prefix match
+ stbtt_int32 matchlen = stbtt__CompareUTF8toUTF16_bigendian_prefix(name, nlen, fc+stringOffset+off,slen);
+ if (matchlen >= 0) {
+ // check for target_id+1 immediately following, with same encoding & language
+ if (i+1 < count && ttUSHORT(fc+loc+12+6) == next_id && ttUSHORT(fc+loc+12) == platform && ttUSHORT(fc+loc+12+2) == encoding && ttUSHORT(fc+loc+12+4) == language) {
+ stbtt_int32 slen = ttUSHORT(fc+loc+12+8), off = ttUSHORT(fc+loc+12+10);
+ if (slen == 0) {
+ if (matchlen == nlen)
+ return 1;
+ } else if (matchlen < nlen && name[matchlen] == ' ') {
+ ++matchlen;
+ if (stbtt_CompareUTF8toUTF16_bigendian((char*) (name+matchlen), nlen-matchlen, (char*)(fc+stringOffset+off),slen))
+ return 1;
+ }
+ } else {
+ // if nothing immediately following
+ if (matchlen == nlen)
+ return 1;
+ }
+ }
+ }
+
+ // @TODO handle other encodings
+ }
+ }
+ return 0;
+}
+
+static int stbtt__matches(stbtt_uint8 *fc, stbtt_uint32 offset, stbtt_uint8 *name, stbtt_int32 flags)
+{
+ stbtt_int32 nlen = stbtt_int32(STBTT_strlen((char *) name));
+ stbtt_uint32 nm,hd;
+ if (!stbtt__isfont(fc+offset)) return 0;
+
+ // check italics/bold/underline flags in macStyle...
+ if (flags) {
+ hd = stbtt__find_table(fc, offset, "head");
+ if ((ttUSHORT(fc+hd+44) & 7) != (flags & 7)) return 0;
+ }
+
+ nm = stbtt__find_table(fc, offset, "name");
+ if (!nm) return 0;
+
+ if (flags) {
+ // if we checked the macStyle flags, then just check the family and ignore the subfamily
+ if (stbtt__matchpair(fc, nm, name, nlen, 16, -1)) return 1;
+ if (stbtt__matchpair(fc, nm, name, nlen, 1, -1)) return 1;
+ if (stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1;
+ } else {
+ if (stbtt__matchpair(fc, nm, name, nlen, 16, 17)) return 1;
+ if (stbtt__matchpair(fc, nm, name, nlen, 1, 2)) return 1;
+ if (stbtt__matchpair(fc, nm, name, nlen, 3, -1)) return 1;
+ }
+
+ return 0;
+}
+
+int stbtt_FindMatchingFont(const unsigned char *font_collection, const char *name_utf8, stbtt_int32 flags)
+{
+ stbtt_int32 i;
+ for (i=0;;++i) {
+ stbtt_int32 off = stbtt_GetFontOffsetForIndex(font_collection, i);
+ if (off < 0) return off;
+ if (stbtt__matches((stbtt_uint8 *) font_collection, off, (stbtt_uint8*) name_utf8, flags))
+ return off;
+ }
+}
+
+#endif // STB_TRUETYPE_IMPLEMENTATION