Commit fe0e95be authored by BrutPitt's avatar BrutPitt
Browse files

ver. 1.4.0 - Release

parent f309f89a
......@@ -20,7 +20,7 @@ LAYOUT_BINDING(1) uniform sampler2D tex;
#define idxSOLID_AO (pixelColorOFFSET + 2)
#define idxSOLID_DR (pixelColorOFFSET + 3)
#if !defined(GL_ES) && !defined(__APPLE__)
#if !defined(GL_ES)
subroutine vec4 _pixelColor(vec4 color, vec4 N);
LAYOUT_LOCATION(1) subroutine uniform _pixelColor pixelColor;
#endif
......@@ -79,9 +79,7 @@ vec3 packing2Colors8bit(vec3 colorA, vec3 colorB)
}
#endif
#if !defined(__APPLE__)
LAYOUT_INDEX(idxSOLID) SUBROUTINE(_pixelColor)
#endif
vec4 pixelColorDirect(vec4 color, vec4 N)
{
......@@ -91,7 +89,7 @@ vec4 pixelColorDirect(vec4 color, vec4 N)
float lambertian = max(0.0, dot(light, N.xyz));
vec3 V = normalize(newVertex.xyz);
#if defined(GL_ES) || defined(__APPLE__)
#if defined(GL_ES) || !defined(GLCHAOSP_USES_LIGHTMODELS_SUBS)
float specular = u.lightModel == uint(idxPHONG) ? specularPhong(V, light, N.xyz) : (u.lightModel == uint(idxBLINPHONG) ? specularBlinnPhong(V, light, N.xyz) : specularGGX(V, light, N.xyz));
#else
float specular = lightModel(V, light, N.xyz);
......@@ -105,9 +103,7 @@ vec4 pixelColorDirect(vec4 color, vec4 N)
return vec4(smoothstep(u.sstepColorMin, u.sstepColorMax, lightColor + ambColor) , color.a);
}
#if !defined(__APPLE__)
LAYOUT_INDEX(idxSOLID_AO) SUBROUTINE(_pixelColor)
#endif
vec4 pixelColorAO(vec4 color, vec4 N)
{
vec3 light = normalize(u.lightDir); // +vtx
......@@ -115,7 +111,7 @@ vec4 pixelColorAO(vec4 color, vec4 N)
float lambertian = max(0.0, dot(light, N.xyz));
vec3 V = normalize(newVertex.xyz);
#if defined(GL_ES) || defined(__APPLE__)
#if defined(GL_ES) || !defined(GLCHAOSP_USES_LIGHTMODELS_SUBS)
float specular = u.lightModel == uint(idxPHONG) ? specularPhong(V, light, N.xyz) : (u.lightModel == uint(idxBLINPHONG) ? specularBlinnPhong(V, light, N.xyz) : specularGGX(V, light, N.xyz));
#else
float specular = lightModel(V, light, N.xyz);
......@@ -127,18 +123,14 @@ vec4 pixelColorAO(vec4 color, vec4 N)
return vec4(packing2Colors16bit(lColor, color.rgb), getFragDepth(newVertex.z));
}
#if !defined(__APPLE__)
LAYOUT_INDEX(idxSOLID_DR) SUBROUTINE(_pixelColor)
#endif
vec4 pixelColorDR(vec4 color, vec4 N)
{
return vec4(color.xyz, getFragDepth(newVertex.z));
}
#if !defined(__APPLE__)
LAYOUT_INDEX(idxBLENDING) SUBROUTINE(_pixelColor)
#endif
vec4 pixelColorBlending(vec4 color, vec4 N)
{
if(color.a < u.alphaSkip ) { discard; return vec4(0.0); } //returm need for Angle error
......@@ -162,7 +154,7 @@ vec4 mainFunc(vec2 ptCoord)
vec4 bound = colorBoundary(newVertex, 0) + colorBoundary(newVertex, 1) + colorBoundary(newVertex, 2);
color.xyz = mix(color.xyz, bound.xyz, bound.a);
#if defined(GL_ES) || defined(__APPLE__)
#if defined(GL_ES)
#if defined(GL_ES) && !defined(GLCHAOSP_LIGHTVER_EXPERIMENTAL)
return u.lightActive==uint(1) ? pixelColorDirect(color, N) : pixelColorBlending(color, N);
#else
......@@ -177,6 +169,5 @@ vec4 mainFunc(vec2 ptCoord)
#endif
#else
return pixelColor(color, N);
#endif
}
\ No newline at end of file
......@@ -80,7 +80,7 @@ LAYOUT_BINDING(4) uniform _tMat {
mat4 mvLightM;
} m;
#if !defined(GL_ES) && !defined(__APPLE__)
#if !defined(GL_ES) && defined(GLCHAOSP_USES_LIGHTMODELS_SUBS)
#define lightModelOFFSET 5
subroutine float _lightModel(vec3 V, vec3 L, vec3 N);
LAYOUT_LOCATION(0) subroutine uniform _lightModel lightModel;
......@@ -92,10 +92,6 @@ LAYOUT_BINDING(4) uniform _tMat {
#define idxBLINPHONG (lightModelOFFSET + 1)
#define idxGGX (lightModelOFFSET + 2)
#define planeON 1
#define boundON 2
float packColor16(vec2 color)
{
return uintBitsToFloat( packUnorm2x16(color) );
......@@ -105,7 +101,6 @@ vec2 unPackColor16(float pkColor)
return unpackUnorm2x16(floatBitsToUint(pkColor));
}
#if !defined(GL_ES)
/*
uint packUnorm4x8(vec4 v)
......@@ -177,9 +172,11 @@ bool clippedPlane(vec4 vtx, int plane)
bool clippedPoint(vec4 vtx)
{
return pl.additiveSpace ?
clippedPlane(vtx, 0) && clippedPlane(vtx, 1) && clippedPlane(vtx, 2) && pl.atLeastOneActive :
clippedPlane(vtx, 0) || clippedPlane(vtx, 1) || clippedPlane(vtx, 2) ;
return pl.atLeastOneActive ?
(pl.additiveSpace ?
clippedPlane(vtx, 0) && clippedPlane(vtx, 1) && clippedPlane(vtx, 2) :
clippedPlane(vtx, 0) || clippedPlane(vtx, 1) || clippedPlane(vtx, 2)) :
false;
}
// Z Buffer
......@@ -256,7 +253,7 @@ float restoreZ(float D)
float form_01_to_m1p1(float f) { return 2. * f - 1.; }
float form_m1p1_to_01(float f) { return f*.5 + .5; }
#if !defined(__APPLE__)
#if defined(GLCHAOSP_USES_LIGHTMODELS_SUBS)
LAYOUT_INDEX(idxPHONG) SUBROUTINE(_lightModel)
#endif
float specularPhong(vec3 V, vec3 L, vec3 N)
......@@ -267,7 +264,7 @@ float specularPhong(vec3 V, vec3 L, vec3 N)
return pow(specAngle, u.lightShinExp * .25);
}
#if !defined(__APPLE__)
#if defined(GLCHAOSP_USES_LIGHTMODELS_SUBS)
LAYOUT_INDEX(idxBLINPHONG) SUBROUTINE(_lightModel)
#endif
float specularBlinnPhong(vec3 V, vec3 L, vec3 N)
......@@ -280,7 +277,7 @@ float specularBlinnPhong(vec3 V, vec3 L, vec3 N)
}
#if !defined(__APPLE__)
#if defined(GLCHAOSP_USES_LIGHTMODELS_SUBS)
LAYOUT_INDEX(idxGGX) SUBROUTINE(_lightModel)
#endif
float specularGGX(vec3 V, vec3 L, vec3 N)
......
......@@ -165,7 +165,7 @@ vec4 pixelColorLight(vec3 vtx, vec4 color, vec4 N, float AO, float shadow)
float lambertian = max(0.0, dot(light, N.xyz));
vec3 V = normalize(vtx);
#if defined(GL_ES) || defined(__APPLE__)
#if defined(GL_ES) || !defined(GLCHAOSP_USES_LIGHTMODELS_SUBS)
float specular = u.lightModel == uint(idxPHONG) ? specularPhong(V, light, N.xyz) : (u.lightModel == uint(idxBLINPHONG) ? specularBlinnPhong(V, light, N.xyz) : specularGGX(V, light, N.xyz));
#else
float specular = lightModel(V, light, N.xyz);
......@@ -261,13 +261,7 @@ float buildSmoothScattereShadow(vec4 frag)
if(projCoords.z>1.0) return 0.0;
// get depth of current fragment from light's perspective
float bias = u.shadowBias;
#ifdef __APPLE__
bias+=1.0;
#endif
float currentDepth = restoreZ(projCoords.z) + bias;
float currentDepth = restoreZ(projCoords.z) + u.shadowBias;
vec2 stepTex = u.shadowGranularity*u.invScrnRes;
......@@ -288,7 +282,7 @@ float buildSmoothScattereShadow(vec4 frag)
vec3 projCoords = .5 * (fragPosLightSpace.xyz)/fragPosLightSpace.w + .5;
closestDepth = restoreZ(texture(shadowTex, projCoords.xy+poissonDisk[(x*diam+y)%16]/1000.0).r);
float currentDepth = restoreZ(projCoords.z) + bias;
float currentDepth = restoreZ(projCoords.z) + u.shadowBias;
shadow += currentDepth < closestDepth ? u.shadowDarkness*u.shadowDarkness*invDiv : invDiv ; // 1.0/9.0
}
......@@ -312,12 +306,7 @@ float buildSmoothShadow(vec4 frag)
//float bias = 0.005 * tan(acos(clamp(dot(normalize(u.lightDir),frag.xyz), 0., .9999)));
float bias = u.shadowBias;
#ifdef __APPLE__
bias+=1.0;
#endif
float currentDepth = restoreZ(projCoords.z) + bias;
float currentDepth = restoreZ(projCoords.z) + u.shadowBias;
vec2 stepTex = u.shadowGranularity*u.invScrnRes;
......@@ -338,7 +327,7 @@ float buildSmoothShadow(vec4 frag)
vec3 projCoords = .5 * (fragPosLightSpace.xyz)/fragPosLightSpace.w + .5;
closestDepth = restoreZ(texture(shadowTex, projCoords.xy).r);
float currentDepth = restoreZ(projCoords.z) + bias;
float currentDepth = restoreZ(projCoords.z) + u.shadowBias;
shadow += (currentDepth < closestDepth ? u.shadowDarkness*u.shadowDarkness*invDiv : invDiv) * .1 ; // 1.0/9.0
*/
......
<h1 align="center"> <a href="https://michelemorrone.eu/glchaosp">glChAoS.P / wglChAoS.P - Ver 1.3.1</a> ==> 1.4.0 (WiP)</h1>
<h1 align="center"> <a href="https://michelemorrone.eu/glchaosp">glChAoS.P / wglChAoS.P - Ver 1.4.0</a> </h1>
[**glChAoS.P**](https://michelemorrone.eu/glchaosp) / [**glChAoSP**](https://michelemorrone.eu/glchaosp): Open**gl** **Ch**aotic **A**ttractors **o**f **S**light (**dot**) **P**articles
A real time 3D strange attractors scout... and hypercompex fractals (new!)
To view all Attractors / Fractals currently inserted in this version, follow the link: [Attractors Formula](https://www.michelemorrone.eu/glchaosp/index.html#AttractorsFormula2)
# ** IMPORTANT ** Windows users with NVidia cards
Please read this issue: [**fatal error C9999:** *** exception during compilation ***](https://github.com/BrutPitt/glChAoS.P/issues/3)
It influence all version of **glChAoS.P**, also the previous ones
**Since NVidia has biblical times to answer** I bypass momentarily the issue.
I added `glChAoSP_NVidiaWorkaround.zip` Windows binaries, in the **[glChAoS.P Release Download](https://github.com/BrutPitt/glChAoS.P/releases)**: the package contains only two executable (32/64 bit), so you need to replace the original ones of `glChAoSP.zip` file, inside **glChAoS.P** directory strucure.
In this workaround I uses OpenGL 4.1, without Zero Drivers Overhead feature of OpenGL 4.5, without GLSL subroutines, with consequent slower performance.
You can read more here: https://github.com/BrutPitt/glChAoS.P/issues/3#issuecomment-535753200
## All availabe 1.3.1 releases
## All availabe 1.4.0 releases
- **[glChAoS.P](https://github.com/BrutPitt/glChAoS.P/releases)** - **DeskTop** - binaries available **Windows** / **Linux** / **OS X**
- **[wglChAoS.P](https://michelemorrone.eu/glchaosp/webGL.html)** - **WebGL** via **webAssembly** - **live** / **online** using your browser - also for mobile devices
- **[wglChAoS.P Advanced Mode](https://github.com/BrutPitt/glChAoS.P/blob/master/wglChAoSP/readme.md)** - **WebGL** advanced mode release with new render engine
### New 3D DLA (Diffusion Limited Aggregation) - [DLA3D Video Example](https://youtu.be/_R7akPh64XU)
### 3D DLA (Diffusion Limited Aggregation) - [DLA3D Video Example](https://youtu.be/_R7akPh64XU)
[![](https://raw.githubusercontent.com/BrutPitt/glChAoS.P/master/screenShots/dla3D.jpg)](https://youtu.be/_R7akPh64XU)
Personal [DLAf-optimized](https://github.com/BrutPitt/DLAf-optimized) project, adaptation and optimization from original code of [Michael Fogleman](https://github.com/fogleman), with possibility to export/import to/from PLY format and to continue a previous rendering.
......@@ -45,7 +34,7 @@ With **Billboard** and **PointSprite** techniques
| :-----: | :----: |
|![](https://raw.githubusercontent.com/BrutPitt/glChAoS.P/master/screenShots/sShot_2019818_5533.jpg) | ![](https://raw.githubusercontent.com/BrutPitt/glChAoS.P/master/screenShots/sShot_2019818_55251.jpg)|
### Ver 1.3 with further rendering engine improvement - **[Rendering Video Example](https://youtu.be/mkX4fdv-kZU)**
### Further rendering engine improvement (from ver. >= 1.3.x) - **[Rendering Video Example](https://youtu.be/mkX4fdv-kZU)**
| DualPass rendering: Z-buffer surface reconstruction | DualPass + Ambient Occlusion |
| :---: | :---: |
| ![](https://raw.githubusercontent.com/BrutPitt/glChAoS.P/master/screenShots/sShot_2019818_55315.jpg) | ![](https://raw.githubusercontent.com/BrutPitt/glChAoS.P/master/screenShots/sShot_2019818_55328.jpg)|
......@@ -56,7 +45,7 @@ With **Billboard** and **PointSprite** techniques
<p>&nbsp;<br>&nbsp;<br></p>
## wglChAoS.P - the WebGL2 online version (ver. 1.3.2)
## wglChAoS.P - the WebGL2 online version (ver. 1.4.0)
<p align="center"><a href="https://michelemorrone.eu/glchaosp/webGL.html">
<img src="https://raw.githubusercontent.com/BrutPitt/glChAoS.P/master/screenShots/ssWGLtitle.jpg"></a>
......@@ -277,7 +266,7 @@ Add the location in to `INCLUDE` environment variable or unpack/copy the `boost`
**Windows**
Windows user needs of Visual Studio 2017 or, in alternative, CMake 3.10 (or higher) for other compilers toolschain (non tested, but it should work).
Windows user needs of Visual Studio 2019 (it works also wit VS 2017/2015, but is need to change appropriate *Platform Toolse* and/or *Windows SDK version* that you have installed). In alternative, CMake 3.10 (or higher) for other compilers toolschain (non tested, but it should work).
- **Microsoft Visual Studio**
In the folder `./src/msBuilds` there is the solution project for use with Visual Studio 2017.
......
......@@ -228,7 +228,7 @@ set(COMMON_DEFINES "-DVGIZMO_USES_TEMPLATE -DGLFW_INCLUDE_NONE -DIMGUI_IMPL_OPEN
if(APPLE)
set(COMMON_DEFINES "${COMMON_DEFINES} -DGLAPP_NO_GLSL_PIPELINE -Wno-logical-op-parentheses -Wno-unused-command-line-argument -Wno-parentheses -framework Cocoa -framework IOKit -framework CoreVideo")
else()
set(COMMON_DEFINES "${COMMON_DEFINES} ")
set(COMMON_DEFINES "${COMMON_DEFINES} -DGLCHAOSP_USES_LIGHTMODELS_SUBS")
endif(APPLE)
......
......@@ -264,7 +264,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\tools\;$(ProjectDir)..\..\src\libs\;$(ProjectDir)..\..\src\libs\glfw\include\</AdditionalIncludeDirectories>
......@@ -290,7 +290,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug OpenGL 4.1|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\tools\;$(ProjectDir)..\..\src\libs\;$(ProjectDir)..\..\src\libs\glfw\include\</AdditionalIncludeDirectories>
......@@ -317,7 +317,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug noThread OpenGL 4.1|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\tools\;$(ProjectDir)..\..\src\libs\;$(ProjectDir)..\..\src\libs\glfw\include\</AdditionalIncludeDirectories>
......@@ -344,7 +344,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\tools\;$(ProjectDir)..\..\src\libs\;$(ProjectDir)..\..\src\libs\glfw\include\</AdditionalIncludeDirectories>
......@@ -367,7 +367,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug OpenGL 4.1|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\tools\;$(ProjectDir)..\..\src\libs\;$(ProjectDir)..\..\src\libs\glfw\include\</AdditionalIncludeDirectories>
......@@ -388,7 +388,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug noThread OpenGL 4.1|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;GLM_ENABLE_EXPERIMENTAL;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\src\tools\;$(ProjectDir)..\..\src\libs\;$(ProjectDir)..\..\src\libs\glfw\include\</AdditionalIncludeDirectories>
......@@ -409,7 +409,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
......@@ -440,7 +440,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release OpenGL 4.1|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
......@@ -472,7 +472,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release singleThread OpenGL 4.1|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
......@@ -504,7 +504,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;GLAPP_REQUIRE_OGL45;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
......@@ -540,7 +540,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release OpenGL 4.1|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
......@@ -567,7 +567,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release singleThread OpenGL 4.1|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>VGIZMO_USES_TEMPLATE;GLCHAOSP_USES_LIGHTMODELS_SUBS;GLFW_INCLUDE_NONE;GLM_ENABLE_EXPERIMENTAL;IMGUI_IMPL_OPENGL_LOADER_GLAD;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
......
......@@ -176,26 +176,28 @@ GLuint particlesBaseClass::render(GLuint fbIdx, emitterBaseClass *emitter)
auto selectSubroutines = [&]() {
GLuint subIDX[2];
const int idxPixelColor = (getBlendState() && !isSolid) ? pixColIDX::pixBlendig :
getBlendState() || !isAO_RD_SHDW ? pixColIDX::pixDirect :
isAO_SHDW && !postRenderingActive() ? pixColIDX::pixAO :
pixColIDX::pixDR ;
const uint idxPixelColor = (getBlendState() && !isSolid) ? pixColIDX::pixBlendig :
getBlendState() || !isAO_RD_SHDW ? pixColIDX::pixDirect :
isAO_SHDW && !postRenderingActive() ? pixColIDX::pixAO :
pixColIDX::pixDR ;
#ifdef GLAPP_REQUIRE_OGL45
subIDX[locSubPixelColor] = idxPixelColor;
subIDX[locSubLightModel] = uData.lightModel + lightMDL::modelOffset;
GLuint subVtxIdx = idxViewOBJ && plyObjGetColor ? particlesViewColor::packedRGB : particlesViewColor::paletteIndex;
glUniformSubroutinesuiv(GL_VERTEX_SHADER, GLsizei(1), &subVtxIdx);
subIDX[subsLoc::pixelColor] = idxPixelColor;
subIDX[subsLoc::lightModel] = uData.lightModel + lightMDL::modelOffset;
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, GLsizei(2), subIDX);
glUniformSubroutinesuiv(GL_VERTEX_SHADER, GLsizei(1), &subVtxIdx);
#else
uData.renderType = idxPixelColor;
#if !defined(GLCHAOSP_LIGHTVER)
#if !defined(__APPLE__)
#ifdef GLCHAOSP_USES_LIGHTMODELS_SUBS
subIDX[locSubPixelColor] = idxSubPixelColor[idxPixelColor-pixColIDX::pixOffset];
subIDX[locSubLightModel] = idxSubLightModel[uData.lightModel];
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, GLsizei(2), subIDX);
#else
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, GLsizei(1), &idxSubPixelColor[idxPixelColor]);
#endif
glUniformSubroutinesuiv(GL_VERTEX_SHADER, GLsizei(1), idxViewOBJ ? &idxSubOBJ : &idxSubVEL);
#endif
......@@ -367,7 +369,7 @@ GLuint particlesBaseClass::render(GLuint fbIdx, emitterBaseClass *emitter)
getPostRendering()->setUniform1i(getPostRendering()->getLocPrevData(), getRenderFBO().getTex(fbIdx));
#endif
#if !defined(__APPLE__) && !defined(GLCHAOSP_LIGHTVER_EXPERIMENTAL)
#if defined(GLCHAOSP_USES_LIGHTMODELS_SUBS) && !defined(GLCHAOSP_LIGHTVER_EXPERIMENTAL)
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, GLsizei(1), &subIDX);
#endif
......@@ -1015,15 +1017,14 @@ void postRenderingClass::create() {
removeAllShaders(true);
#if !defined(GLCHAOSP_LIGHTVER)
locSubLightModel = glGetSubroutineUniformLocation(getProgram(), GL_FRAGMENT_SHADER, "lightModel");
#endif
#if !defined(GLAPP_REQUIRE_OGL45)
USE_PROGRAM
locAOTex = getUniformLocation("aoTex");
locShadowTex = getUniformLocation("shadowTex");
locPrevData = getUniformLocation("prevData");
#if !defined(GLCHAOSP_LIGHTVER)
locSubLightModel = glGetSubroutineUniformLocation(getProgram(), GL_FRAGMENT_SHADER, "lightModel");
#endif
uniformBlocksClass::bindIndex(getProgram(), "_particlesData", uniformBlocksClass::bindIdx);
renderEngine->getTMat()->blockBinding(getProgram());
//uniformBlocksClass::bindIndex(getProgram(), "_clippingPlanes", GLuint(renderBaseClass::bind::planesIDX));
......
......@@ -364,8 +364,8 @@ public:
private:
mmFBO fbo;
renderBaseClass *renderEngine;
GLuint locSubLightModel;
#if !defined(GLAPP_REQUIRE_OGL45)
GLuint locSubLightModel;
GLuint locAOTex, locPrevData, locShadowTex;
GLuint idxSubLightModel[3];
#endif
......@@ -885,6 +885,7 @@ public:
enum lightIDX { off, on };
enum lightMDL { modelOffset = 5, modelPhong=modelOffset, modelBlinnPhong, modelGGX };
enum pixColIDX { pixOffset, pixBlendig=pixOffset, pixDirect, pixAO, pixDR };
enum subsLoc { lightModel, pixelColor };
particlesBaseClass () {
......@@ -911,23 +912,24 @@ public:
}
void getCommonLocals() {
#if !defined(GLCHAOSP_LIGHTVER)
#if !defined(GLAPP_REQUIRE_OGL45)
#if !defined(GLCHAOSP_LIGHTVER)
locSubPixelColor = glGetSubroutineUniformLocation(getProgram(), GL_FRAGMENT_SHADER, "pixelColor");
locSubLightModel = glGetSubroutineUniformLocation(getProgram(), GL_FRAGMENT_SHADER, "lightModel");
const int numSub = 2;
if(locSubPixelColor>=numSub) locSubPixelColor = 0;
if(locSubLightModel>=numSub) locSubLightModel = 0;
#endif
#if !defined(GLAPP_REQUIRE_OGL45)
if(locSubPixelColor>=numSub || locSubPixelColor == -1) locSubPixelColor = 0;
if(locSubLightModel>=numSub || locSubLightModel == -1) locSubLightModel = 0;
locPaletteTex = getUniformLocation("paletteTex" );
locDotsTex = getUniformLocation("tex");
#if !defined(GLCHAOSP_LIGHTVER)
#if !defined(__APPLE__)
idxSubPixelColor[pixBlendig] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorBlending");
idxSubPixelColor[pixDirect ] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorDirect");
idxSubPixelColor[pixAO ] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorAO");
idxSubPixelColor[pixDR ] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorDR");
idxSubPixelColor[pixBlendig] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorBlending");
idxSubPixelColor[pixDirect ] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorDirect");
idxSubPixelColor[pixAO ] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorAO");
idxSubPixelColor[pixDR ] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "pixelColorDR");
#ifdef GLCHAOSP_USES_LIGHTMODELS_SUBS
idxSubLightModel[0] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "specularPhong");
idxSubLightModel[1] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "specularBlinnPhong");
idxSubLightModel[2] = glGetSubroutineIndex(getProgram(),GL_FRAGMENT_SHADER, "specularGGX");
......@@ -1100,12 +1102,12 @@ protected:
GLfloat stepInc;
#if !defined(GLAPP_REQUIRE_OGL45)
GLuint locSubLightModel, locSubPixelColor;
GLuint locDotsTex, locPaletteTex;
GLuint idxSubOBJ, idxSubVEL;
GLuint idxSubLightModel[3];
GLuint idxSubPixelColor[4];
GLuint idxSubLightModel[3] = { 0, 0, 0 };
GLuint idxSubPixelColor[4] = { 0, 0, 0, 0 };
#endif
GLuint locSubLightModel, locSubPixelColor;
vec3 lightVec = vec3(50.f, 15.f, 25.f);
bool depthBuffActive = true;
......
......@@ -23,6 +23,7 @@
//#define GLAPP_IMGUI_VIEWPORT
#ifdef __EMSCRIPTEN__
#define DOT_TEXT_SHFT 1
#else
......
......@@ -318,6 +318,9 @@ void mainGLApp::glfwInit()
"#define LAYOUT_INDEX(X) layout(index = X)\n"
"#define LAYOUT_LOCATION(X) layout(location = X)\n"
"#define SUBROUTINE(X) subroutine(X)\n"
#ifdef GLCHAOSP_USES_LIGHTMODELS_SUBS
"#define GLCHAOSP_USES_LIGHTMODELS_SUBS\n"
#endif
"#define CONST const\n";
#else
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
......@@ -326,8 +329,8 @@ void mainGLApp::glfwInit()
"#define LAYOUT_LOCATION(X)\n"
"#define LAYOUT_INDEX(X)\n"
"#define SUBROUTINE(X) subroutine(X)\n"
#ifdef __APPLE__ // troubles on MAC with multiple subroutines
"#define __APPLE__\n"
#ifdef GLCHAOSP_USES_LIGHTMODELS_SUBS // troubles on MAC with multiple subroutines
"#define GLCHAOSP_USES_LIGHTMODELS_SUBS\n"
#endif
#ifdef GLCHAOSP_LIGHTVER
"#define TEST_WGL\n"
......
......@@ -181,9 +181,10 @@ public:
};
Vec4() {}
Vec4(T s) : x(s), y(s), z(s), w(s) {}
Vec4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {}
Vec4(const VEC3_T& v, T s = T(0)) : x(v.x), y(v.y), z(v.z), w(s) {}
Vec4(T s) : x(s), y(s), z(s), w(s) {}
Vec4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {}
Vec4(const VEC3_T& v, T s = T(0)) : x(v.x), y(v.y), z(v.z), w(s) {}
Vec4(T s, const VEC3_T& v) : x(s), y(v.y), z(v.z), w(v.w) {}
const Vec4 operator-() const { return Vec4(-x, -y, -z, -w); }
......@@ -461,14 +462,12 @@ TEMPLATE_TYPENAME_T inline const MAT4_T inverse(MAT4_T const &m) {
VEC4_T v2(m.m12, m.m02, m.m02, m.m02);
VEC4_T v3(m.m13, m.m03, m.m03, m.m03);
VEC4_T i0(v1 * f0 - v2 * f1 + v3 * f2);
VEC4_T i1(v0 * f0 - v2 * f3 + v3 * f4);
VEC4_T i2(v0 * f1 - v1 * f3 + v3 * f5);
VEC4_T i3(v0 * f2 - v1 * f4 + v2 * f5);
VEC4_T signV(T(1), T(-1), T(1), T(-1));
MAT4_T inv((v1 * f0 - v2 * f1 + v3 * f2) * signV,
(v0 * f0 - v2 * f3 + v3 * f4) * -signV,
(v0 * f1 - v1 * f3 + v3 * f5) * signV,
(v0 * f2 - v1 * f4 + v2 * f5) * -signV);
VEC4_T signA( 1, -1, 1, -1), signB(-1, 1, -1, 1);
MAT4_T inv(i0 * signA, i1 * signB, i2 * signA, i3 * signB);
VEC4_T v0r0(m.v0 * VEC4_T(inv.m00, inv.m10, inv.m20, inv.m30));
return inv * (T(1) / (v0r0.x + v0r0.y + v0r0.z + v0r0.w)); }// 1/determinant ==> "operator *" is faster
// external operators
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment