Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Neill3d/MoPlugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Neill3d committed Jun 23, 2019
2 parents 473d492 + 60fc0ae commit d1d485f
Show file tree
Hide file tree
Showing 51 changed files with 1,256 additions and 161 deletions.
112 changes: 108 additions & 4 deletions Bin/System/GLSL_FX/Particles.glslfx
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ namespace Render
}
}

GLSLShader FS_Instancing
GLSLShader FS_InstancingSimple
{

in vec3 lNormal;
Expand All @@ -1510,12 +1510,27 @@ namespace Render

layout(binding=0) uniform sampler2D ColorSampler;

float ApplyLight(in vec3 L, in vec3 N)
{
float lambertTerm = clamp(dot(N, L), 0.0, 1.0);
vec3 E = normalize(wv);
vec3 R = reflect(-L, N);
float specular = clamp(pow(max(dot(R, E), 0.0), 64.0), 0.0, 1.0);

return lambertTerm + specular;
}

void main()
{
vec3 lightDir[2];
lightDir[0] = normalize(vec3(1.0, 1.0, 1.0));
lightDir[1] = normalize(vec3(-1.0, -1.0, -1.0));

vec3 n = normalize(lNormal);
float diffuse = clamp(dot( normalize(lNormal), normalize(gCameraPos.xyz) ), 0.0, 1.0);

float diffuse = ApplyLight(lightDir[0], n);
diffuse += ApplyLight(lightDir[1], n);

vec4 color = pcolor;

if (gUseColorMap > 0.0)
Expand All @@ -1531,6 +1546,77 @@ namespace Render
}
}

GLSLShader FS_InstancingFlat
{

in vec3 lNormal;
in float life;
in vec4 pcolor;
in vec3 wv;
in vec2 puv;

layout(location=0) out vec4 outColor;
layout(location=1) out vec4 outNormal; // output a view space normal
layout(location=2) out vec4 outMask;
layout(location=3) out vec4 outPosition;

layout(binding=0) uniform sampler2D ColorSampler;

void main()
{
vec3 n = normalize(lNormal);
vec4 color = pcolor;

if (gUseColorMap > 0.0)
{
color = color * texture(ColorSampler, puv);
}
//
outColor = color;

outNormal = vec4(n, 1.0); // vec4(0.0, 1.0, 0.0, 0.0);
outPosition = vec4(wv, 1.0); // fMesh->lightmap);
outMask = vec4(0.0); // theShader->mask;
}
}


GLSLShader FS_InstancingDynamic
{

in vec3 lNormal;
in float life;
in vec4 pcolor;
in vec3 wv;
in vec2 puv;

layout(location=0) out vec4 outColor;
layout(location=1) out vec4 outNormal; // output a view space normal
layout(location=2) out vec4 outMask;
layout(location=3) out vec4 outPosition;

layout(binding=0) uniform sampler2D ColorSampler;

void main()
{

vec3 n = normalize(lNormal);
float diffuse = clamp(dot( normalize(lNormal), normalize(gCameraPos.xyz) ), 0.0, 1.0);

vec4 color = pcolor;

if (gUseColorMap > 0.0)
{
color = color * texture(ColorSampler, puv);
}
//
outColor = vec4(diffuse * color.xyz, color.w);

outNormal = vec4(n, 1.0); // vec4(0.0, 1.0, 0.0, 0.0);
outPosition = vec4(wv, 1.0); // fMesh->lightmap);
outMask = vec4(0.0); // theShader->mask;
}
}
}

// DONE: convert glsl 330 into glsl 420 syntax
Expand Down Expand Up @@ -1737,12 +1823,30 @@ Technique renderStretchedBillboards
}
}

Technique renderInstances
Technique renderInstancesSimple
{
Pass p0
{
VertexProgram = {Evaluate::ColorCode, Render::VS_Instancing};
FragmentProgram = Render::FS_InstancingSimple;
}
}

Technique renderInstancesFlat
{
Pass p0
{
VertexProgram = {Evaluate::ColorCode, Render::VS_Instancing};
FragmentProgram = Render::FS_InstancingFlat;
}
}

Technique renderInstancesDynamic
{
Pass p0
{
VertexProgram = {Evaluate::ColorCode, Render::VS_Instancing};
FragmentProgram = Render::FS_Instancing;
FragmentProgram = Render::FS_InstancingDynamic;
}
}

Expand Down
Binary file modified Bin/x64/plugins_2017/shader_gpu_particles.dll
Binary file not shown.
Binary file modified Bin/x64/plugins_2018/shader_gpu_particles.dll
Binary file not shown.
26 changes: 13 additions & 13 deletions MotionCodeLibrary/src/GeometryUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FBModel *MakeSnapshot(FBModel *pModel, const bool ResetXForm)
pVertexData->VertexArrayMappingRequest();

int vertCountInMesh = lGeom->VertexCount();
int *indices = pVertexData->GetIndexArray();
// int *indices = pVertexData->GetIndexArray();

//unsigned int dubCount = 0;
//const int *dubIndices = pVertexData->GetVertexArrayDuplicationMap( dubCount );
Expand All @@ -47,8 +47,8 @@ FBModel *MakeSnapshot(FBModel *pModel, const bool ResetXForm)
int uvCount, uvIndexCount;

FBUV *uvs = lMesh->GetUVSetDirectArray(uvCount);
int *uvIndices = lMesh->GetUVSetIndexArray(uvIndexCount);
FBGeometryMappingMode uvMode = lMesh->GetUVSetMappingMode();
// int *uvIndices = lMesh->GetUVSetIndexArray(uvIndexCount);
// FBGeometryMappingMode uvMode = lMesh->GetUVSetMappingMode();

lMesh->GeometryEnd();

Expand Down Expand Up @@ -185,7 +185,7 @@ void FillInputModelData(FBModelList &modelList, InputModelData &data, FBArrayTem
int numberOfMaterials = 0;


int lmaterialIndexCount = 0;
// int lmaterialIndexCount = 0;
//int *lmaterialIndices = lMesh->GetMaterialIndexArray( lmaterialIndexCount );

//data.materialIndices.resize( materialIndexCount + lmaterialIndexCount );
Expand All @@ -208,7 +208,7 @@ void FillInputModelData(FBModelList &modelList, InputModelData &data, FBArrayTem

FBGeometry *lGeom = pModel->Geometry;
FBMesh *lMesh = (FBMesh*) lGeom;
FBModelVertexData *pVertexData = pModel->ModelVertexData;
// FBModelVertexData *pVertexData = pModel->ModelVertexData;

const int lvertCountInMesh = lGeom->VertexCount();
vertCountInMesh += lvertCountInMesh;
Expand All @@ -217,11 +217,11 @@ void FillInputModelData(FBModelList &modelList, InputModelData &data, FBArrayTem
polyCount += lpolyCount;

int polyVertexCount;
int *polyVertexIndices = (int*) lMesh->PolygonVertexArrayGet(polyVertexCount);
lMesh->PolygonVertexArrayGet(polyVertexCount); // int *polyVertexIndices = (int*)

int lnormalDirectCount, lnormalIndicesCount;
float *normals = (float*) lMesh->GetNormalsDirectArray( lnormalDirectCount );
int *normalIndices = lMesh->GetNormalsIndexArray( lnormalIndicesCount );
int lnormalDirectCount; // , lnormalIndicesCount;
lMesh->GetNormalsDirectArray( lnormalDirectCount ); // float *normals = (float*)
//int *normalIndices = lMesh->GetNormalsIndexArray( lnormalIndicesCount );

// Important! For indices I will use polygon vertex mapping type, so indices count == poly vertices count

Expand All @@ -235,10 +235,10 @@ void FillInputModelData(FBModelList &modelList, InputModelData &data, FBArrayTem

if (uvSets.GetCount() )
{
int luvDirectCount, luvIndicesCount;
int luvDirectCount; // , luvIndicesCount;

FBUV *uvs = lMesh->GetUVSetDirectArray( luvDirectCount );
int *uvIndices = lMesh->GetUVSetIndexArray( luvIndicesCount );
lMesh->GetUVSetDirectArray( luvDirectCount ); // FBUV *uvs =
//int *uvIndices = lMesh->GetUVSetIndexArray( luvIndicesCount );

uvDirectCount += luvDirectCount;
uvIndicesCount += polyVertexCount;
Expand Down Expand Up @@ -977,7 +977,7 @@ void ReComputeNormals(FBModel *pModel)
void InvertNormals(FBModel *pModel)
{
FBGeometry *pGeometry = pModel->Geometry;
FBMesh *pMesh = (FBMesh*) pGeometry;
// FBMesh *pMesh = (FBMesh*) pGeometry;

if (pGeometry)
{
Expand Down
4 changes: 2 additions & 2 deletions MotionCodeLibrary/src/GraphView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ void GraphView::BeginViewExpose(bool predraw)

glLineWidth(1.0);

int lWidth = CalcWidth();
int lHeight = CalcHeight();
// int lWidth = CalcWidth();
// int lHeight = CalcHeight();

// Push2dViewport(lWidth, lHeight);

Expand Down
2 changes: 1 addition & 1 deletion MotionCodeLibrary/src/algorithm/math3d_mobu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ void linSolve(unsigned m, double *&A, double *&B, double *&c)
B[j] = B[j] - B[i] * d;
}
// backward
for (int j=0; j<m; j++)
for (unsigned int j=0; j<m; j++)
{
assert( A[j*m+j] != 0.0 );
c[j] = B[j] / A[j*m+j];
Expand Down
72 changes: 72 additions & 0 deletions Projects/ImportGeomCache/impgeomcache.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<Configuration>Release 2018</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release 2019|x64">
<Configuration>Release 2019</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
Expand Down Expand Up @@ -96,6 +100,12 @@
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down Expand Up @@ -127,6 +137,10 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
Expand All @@ -136,24 +150,28 @@
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release 2016|x64'">..\..\bin\x64\plugins_2016\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release 2017|x64'">..\..\bin\x64\plugins_2017\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release 2018|x64'">..\..\bin\x64\plugins_2018\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'">..\..\bin\x64\plugins_2019\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\obj\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release 2015|x64'">..\..\..\obj\$(Configuration)\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release 2014|x64'">..\..\..\obj\$(Configuration)\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release 2016|x64'">..\..\..\obj\$(Configuration)\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release 2017|x64'">..\..\..\obj\$(Configuration)\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release 2018|x64'">..\..\..\obj\$(Configuration)\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'">..\..\..\obj\$(Configuration)\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</IgnoreImportLibrary>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release 2015|x64'">true</IgnoreImportLibrary>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release 2014|x64'">true</IgnoreImportLibrary>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release 2016|x64'">true</IgnoreImportLibrary>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release 2017|x64'">true</IgnoreImportLibrary>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release 2018|x64'">true</IgnoreImportLibrary>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'">true</IgnoreImportLibrary>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release 2015|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release 2014|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release 2016|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release 2017|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release 2018|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\_plugins\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\obj\$(Platform)\plugins\$(ProjectName)\</IntDir>
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</IgnoreImportLibrary>
Expand All @@ -166,12 +184,14 @@
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release 2016|x64'">..\..\MotionCodeLibrary\Include;$(ADSK_MOBU_2016_64)\OpenRealitySDK\include;$(ADSK_MOBU_2016_64)\OpenRealitySDK\include\fbsdk;$(MOPLUGS_EXTERNAL)\glm-0.9.5.3;$(MOPLUGS_EXTERNAL)\glew\include;$(MOPLUGS_FRAMEWORK)\code;$(IncludePath)</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release 2017|x64'">..\..\MotionCodeLibrary\Include;$(ADSK_MOBU_2017_64)\OpenRealitySDK\include;$(ADSK_MOBU_2017_64)\OpenRealitySDK\include\fbsdk;$(MOPLUGS_EXTERNAL)\glm-0.9.5.3;$(MOPLUGS_EXTERNAL)\glew\include;$(MOPLUGS_FRAMEWORK)\code;$(IncludePath)</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release 2018|x64'">..\..\MotionCodeLibrary\Include;$(ADSK_MOBU_2018_64)\OpenRealitySDK\include;$(ADSK_MOBU_2018_64)\OpenRealitySDK\include\fbsdk;$(MOPLUGS_EXTERNAL)\glm-0.9.5.3;$(MOPLUGS_EXTERNAL)\glew\include;$(MOPLUGS_FRAMEWORK)\code;$(IncludePath)</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'">..\..\MotionCodeLibrary\Include;$(ADSK_MOBU_2019_64)\OpenRealitySDK\include;$(ADSK_MOBU_2019_64)\OpenRealitySDK\include\fbsdk;$(MOPLUGS_EXTERNAL)\glm-0.9.5.3;$(MOPLUGS_EXTERNAL)\glew\include;$(MOPLUGS_FRAMEWORK)\code;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ADSK_MOBU_2014_64)\OpenRealitySDK\lib\$(Platform);..\..\glew-1.11.0\lib\Release\x64;..\..\MotionCodeLibrary\Lib;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release 2015|x64'">$(ADSK_MOBU_2015_64)\OpenRealitySDK\lib\$(Platform);$(MOPLUGS_EXTERNAL)\glew\lib\Release\x64;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release 2014|x64'">$(ADSK_MOBU_2014_64)\OpenRealitySDK\lib\$(Platform);$(MOPLUGS_EXTERNAL)\glew\lib\Release\x64;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release 2016|x64'">$(ADSK_MOBU_2016_64)\OpenRealitySDK\lib\$(Platform);$(MOPLUGS_EXTERNAL)\glew\lib\Release\x64;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release 2017|x64'">$(ADSK_MOBU_2017_64)\OpenRealitySDK\lib\$(Platform);$(MOPLUGS_EXTERNAL)\glew\lib\Release\x64;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release 2018|x64'">$(ADSK_MOBU_2018_64)\OpenRealitySDK\lib\$(Platform);$(MOPLUGS_EXTERNAL)\glew\lib\Release\x64;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'">$(ADSK_MOBU_2019_64)\OpenRealitySDK\lib\$(Platform);$(MOPLUGS_EXTERNAL)\glew\lib\Release\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
Expand Down Expand Up @@ -485,6 +505,58 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release 2019|x64'">
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>true</MkTypLibCompatible>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TargetEnvironment>X64</TargetEnvironment>
<TypeLibraryName>
</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;GLEW_STATIC;TIXML_USE_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeaderOutputFile>
</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>
</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)vc80.pdb</ProgramDataBaseFileName>
<BrowseInformation>
</BrowseInformation>
<BrowseInformationFile>
</BrowseInformationFile>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>fbsdk.lib;opengl32.lib;glu32.lib;glew32s.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>
</ProgramDatabaseFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>
</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
Loading

0 comments on commit d1d485f

Please sign in to comment.