Skip to content

Commit

Permalink
Merge pull request #37 from CedricGuillemet/dev-0.8
Browse files Browse the repository at this point in the history
Imogen 0.8 - codename Unicorn Jabu
  • Loading branch information
CedricGuillemet authored Jan 2, 2019
2 parents 06733a4 + 8264182 commit d0c5a62
Show file tree
Hide file tree
Showing 106 changed files with 15,794 additions and 7,704 deletions.
32 changes: 16 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ file(GLOB_RECURSE SRC_FILES
file(GLOB EXT_FILES
${CMAKE_SOURCE_DIR}/ext/*.h
${CMAKE_SOURCE_DIR}/ext/*.cpp
${CMAKE_SOURCE_DIR}/ext/gl3w/GL/*.c
${CMAKE_SOURCE_DIR}/ext/cmft/*.cpp
${CMAKE_SOURCE_DIR}/ext/cmft/common/*.cpp
${CMAKE_SOURCE_DIR}/ext/enkiTS-C-11/src/*.cpp
${CMAKE_SOURCE_DIR}/ext/NativeFileDialog/src/nfd_common.c
${CMAKE_SOURCE_DIR}/ext/gl3w/GL/*.c
${CMAKE_SOURCE_DIR}/ext/cmft/*.cpp
${CMAKE_SOURCE_DIR}/ext/cmft/common/*.cpp
${CMAKE_SOURCE_DIR}/ext/enkiTS-C-11/src/*.cpp
${CMAKE_SOURCE_DIR}/ext/NativeFileDialog/src/nfd_common.c
)

if(WIN32)
Expand Down Expand Up @@ -68,15 +68,15 @@ find_package(OpenGL)

set (USE_MSVC_RUNTIME_LIBRARY_DLL true)
IF (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
#We statically link to reduce dependancies
FOREACH(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RETAIL)
IF(${flag_var} MATCHES "/MD")
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
ENDIF(${flag_var} MATCHES "/MD")
IF(${flag_var} MATCHES "/MDd")
STRING(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
ENDIF(${flag_var} MATCHES "/MDd")
ENDFOREACH(flag_var)
#We statically link to reduce dependancies
FOREACH(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RETAIL)
IF(${flag_var} MATCHES "/MD")
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
ENDIF(${flag_var} MATCHES "/MD")
IF(${flag_var} MATCHES "/MDd")
STRING(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
ENDIF(${flag_var} MATCHES "/MDd")
ENDFOREACH(flag_var)
ENDIF (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)

set(SDL2_LIBS "SDL2" "SDL2main")
Expand Down Expand Up @@ -148,8 +148,8 @@ set_target_properties("Imogen" PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE
#--------------------------------------------------------------------
if(ENABLE_HIDECONSOLE_BUILD)
if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
endif()
endif()

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,6 @@ FFMPEG - Fabrice Bellard

Python 3 - Python.org

pybind 11 - https://github.com/pybind/pybind11
pybind 11 - https://github.com/pybind/pybind11

nanosvg - Mikko Mononen https://github.com/memononen/nanosvg
Binary file modified bin/Imogen.exe
Binary file not shown.
Binary file removed bin/Lib/__pycache__/_collections_abc.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/_sitebuiltins.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/_weakrefset.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/abc.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/ast.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/codecs.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/contextlib.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/copyreg.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/dis.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/enum.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/functools.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/genericpath.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/heapq.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/inspect.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/io.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/keyword.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/linecache.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/ntpath.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/opcode.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/operator.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/os.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/pkgutil.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/platform.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/pydoc.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/re.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/reprlib.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/signal.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/site.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/sre_compile.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/sre_constants.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/sre_parse.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/stat.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/subprocess.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/threading.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/token.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/tokenize.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/traceback.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/types.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/warnings.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/__pycache__/weakref.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file removed bin/Lib/collections/__pycache__/abc.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file removed bin/Lib/encodings/__pycache__/aliases.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/encodings/__pycache__/latin_1.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/encodings/__pycache__/utf_8.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file removed bin/Lib/importlib/__pycache__/abc.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/importlib/__pycache__/machinery.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/importlib/__pycache__/util.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/urllib/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed bin/Lib/urllib/__pycache__/parse.cpython-37.pyc
Binary file not shown.
730 changes: 730 additions & 0 deletions bin/Media/Pictures/23.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions bin/Nodes/C/FurDisplay.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "Imogen.h"

int main(void *param, Evaluation *evaluation)
{
EnableDepthBuffer(evaluation->targetIndex, 1);
return EVAL_OK;
}
12 changes: 12 additions & 0 deletions bin/Nodes/C/FurGenerator.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "Imogen.h"

typedef struct FurGenerator_t
{
int hairCount;
float lengthFactor;
} FurGenerator;

int main(FurGenerator *param, Evaluation *evaluation)
{
return AllocateComputeBuffer(evaluation->targetIndex, param->hairCount, 4 * 4 *sizeof(float) );
}
3 changes: 2 additions & 1 deletion bin/Nodes/C/ImageRead.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ int ReadJob(JobData *data)
int main(ImageRead *param, Evaluation *evaluation)
{
int i;
Image image;
char *files[6] = {param->posxfile, param->negxfile, param->negyfile, param->posyfile, param->poszfile, param->negzfile};

if (strlen(param->filename))
Expand All @@ -62,6 +61,7 @@ int main(ImageRead *param, Evaluation *evaluation)
data.targetIndex = evaluation->targetIndex;
data.face = 0;
data.isCube = 0;
data.image.bits = 0;
Job(ReadJob, &data, sizeof(JobData));
}
else
Expand All @@ -79,6 +79,7 @@ int main(ImageRead *param, Evaluation *evaluation)
data.targetIndex = evaluation->targetIndex;
data.face = CUBEMAP_POSX + i;
data.isCube = 1;
data.image.bits = 0;
Job(ReadJob, &data, sizeof(JobData));
}
}
Expand Down
2 changes: 2 additions & 0 deletions bin/Nodes/C/ImageWrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ int main(ImageWrite *param, Evaluation *evaluation)
Image image;
int imageWidth, imageHeight;

image.bits = 0;
// set info stock image
if (ReadImage(stockImages[param->format], &image) == EVAL_OK)
{
Expand Down Expand Up @@ -43,6 +44,7 @@ int main(ImageWrite *param, Evaluation *evaluation)
if (!evaluation->forcedDirty)
return EVAL_OK;

image.bits = 0;
if (Evaluate(evaluation->inputIndices[0], param->width, param->height, &image) == EVAL_OK)
{
if (WriteImage(param->filename, &image, param->format, param->quality) == EVAL_OK)
Expand Down
12 changes: 10 additions & 2 deletions bin/Nodes/C/Imogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ float fabsf(float value);

typedef struct Image_t
{
void *bits;
void *decoder;
int width, height;
//int components;
int mDataSize;
unsigned char mNumMips;
unsigned char mNumFaces;
unsigned char mFormat;
void *mStream;
void *bits;
} Image;

typedef struct Evaluation_t
{
float inv_view_rot[16];
float viewProjection[16];
float viewInverse[16];

int targetIndex;
int forcedDirty;
Expand All @@ -28,6 +29,8 @@ typedef struct Evaluation_t
int inputIndices[8];

float viewport[2];
int frame;
int localFrame;
} Evaluation;

enum BlendOp
Expand Down Expand Up @@ -93,6 +96,7 @@ int SetEvaluationImageCube(int target, Image *image, int cubeFace);
// set the bits pointer with an allocated memory
int AllocateImage(Image *image);
int FreeImage(Image *image);
int LoadSVG(const char *filename, Image *image, float dpi);

// Image resize
// Image thumbnail
Expand All @@ -103,6 +107,7 @@ int SetThumbnailImage(Image *image);
int Evaluate(int target, int width, int height, Image *image);

void SetBlendingMode(int target, int blendSrc, int blendDst);
void EnableDepthBuffer(int target, int enable);
int GetEvaluationSize(int target, int *imageWidth, int *imageHeight);
int SetEvaluationSize(int target, int imageWidth, int imageHeight);
int SetEvaluationCubeSize(int target, int faceWidth);
Expand All @@ -112,5 +117,8 @@ int Job(int(*jobFunction)(void*), void *ptr, unsigned int size);
int JobMain(int(*jobMainFunction)(void*), void *ptr, unsigned int size);
void SetProcessing(int target, int processing);

// compute shader memory allocation
int AllocateComputeBuffer(int target, int elementCount, int elementSize);

#define EVAL_OK 0
#define EVAL_ERR 1
24 changes: 24 additions & 0 deletions bin/Nodes/C/SVG.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "Imogen.h"

typedef struct SVG_t
{
char filename[1024];
float dpi;
} SVG;

int main(SVG *param, Evaluation *evaluation)
{
Image image;
image.bits = 0;
if (param->dpi <= 1.f)
param->dpi = 96.f;

if (strlen(param->filename))
{
if (LoadSVG(param->filename, &image, param->dpi) == EVAL_OK)
{
SetEvaluationImage(evaluation->targetIndex, &image);
}
}
return EVAL_OK;
}
3 changes: 2 additions & 1 deletion bin/Nodes/C/Thumbnail.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
int main(void *param, Evaluation *evaluation)
{
Image image;

image.bits = 0;
if (ReadImage("Stock/thumbnail-icon.png", &image) == EVAL_OK)
{
if (SetEvaluationImage(evaluation->targetIndex, &image) == EVAL_OK)
Expand All @@ -15,6 +15,7 @@ int main(void *param, Evaluation *evaluation)
if (!evaluation->forcedDirty)
return EVAL_OK;

image.bits = 0;
if (Evaluate(evaluation->inputIndices[0], 256, 256, &image) == EVAL_OK)
{
if (SetThumbnailImage(&image) == EVAL_OK)
Expand Down
2 changes: 1 addition & 1 deletion bin/Nodes/GLSL/PBR.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ vec4 PBR()

vec3 envSpecularColor = EnvBRDFApprox( specularColor, roughnessE, ndotv );

vec3 env = texture(CubeSampler4, refl, roughnessE*12.0).xyz;
vec3 env = texture(CubeSampler4, InvertCubeY(refl), roughnessE*12.0).xyz;

diffuse += diffuseColor * EnvRemap(env);
specular += envSpecularColor * env;
Expand Down
5 changes: 4 additions & 1 deletion bin/Nodes/GLSL/Shader.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ void main()
layout (std140) uniform EvaluationBlock
{
mat4 viewRot;

mat4 viewProjection;
mat4 viewInverse;
int targetIndex;
int forcedDirty;
int uiPass;
Expand All @@ -31,6 +32,8 @@ layout (std140) uniform EvaluationBlock
ivec4 inputIndices[2];

vec2 viewport;
int frame;
int localFrame;
} EvaluationParam;

struct Camera
Expand Down
75 changes: 75 additions & 0 deletions bin/Nodes/GLSLCompute/FurDisplay.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#define pi 3.15159
#define isqrt2 0.707106

//////////////////////////////////////////////////////////////////////////////////////////////////

#ifdef VERTEX_SHADER

layout (std140) uniform EvaluationBlock
{
mat4 viewRot;
mat4 viewProjection;
mat4 viewInverse;
int targetIndex;
int forcedDirty;
int uiPass;
int frameNumber;
vec4 mouse; // x,y, lbut down, rbut down
ivec4 inputIndices[2];

vec2 viewport;
} EvaluationParam;

layout(location = 0)in vec2 inUV;
layout(location = 1)in vec4 inCompute0;
layout(location = 2)in vec4 inCompute1;
layout(location = 3)in vec4 inCompute2;
layout(location = 4)in vec4 inCompute3;

out vec2 uv;
out vec4 color;
out vec3 normal;
out vec3 up;
void main()
{
float startWidth = 0.1;
float endWidth = 0.0;
vec4 i1 = mix(inCompute0, inCompute2, inUV.y);
vec4 i2 = mix(inCompute2, inCompute3, inUV.y);

vec4 bezierPos = mix(i1, i2, inUV.y);
vec4 tgt = normalize(i2 - i1);

vec3 right = normalize(cross(bezierPos.xyz - EvaluationParam.viewInverse[3].xyz, tgt.xyz));
up = cross(right, tgt.xyz);

float width = min(mix(startWidth, endWidth, inUV.y), startWidth * 0.5);

vec4 pos = bezierPos + vec4(right,0.) * inUV.x * width;

gl_Position = EvaluationParam.viewProjection * vec4(pos.xyz, 1.0);


normal = right;
uv = vec2(inUV.x * 0.5 + 0.5, inUV.y);
color = vec4(inCompute0.a, inCompute1.a, inCompute2.a, 1.);
}
#endif

#ifdef FRAGMENT_SHADER
layout (location=0) out vec4 co;
in vec2 uv;
in vec4 color;
in vec3 normal;
in vec3 up;

void main()
{
/*float u01 = (uv.x * 2.0 - 1.0);
vec3 n = mix(up, normal, abs(u01));
float dnl = max(dot(normalize(n), normalize(vec3(1.))), 0.) * 0.4 + 0.6;
co = color * dnl;
*/
co = color;
}
#endif
38 changes: 38 additions & 0 deletions bin/Nodes/GLSLCompute/FurGenerator.glslc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
layout (std140) uniform FurGeneratorBlock
{
int hairCount;
float lengthFactor;
} FurGeneratorParam;


out vec4 outCompute0; // color in w, length in outCompute3.w
out vec4 outCompute1;
out vec4 outCompute2;
out vec4 outCompute3;

uniform sampler2D Sampler0;
uniform sampler2D Sampler1;

void main()
{
float n = float(gl_VertexID);
vec2 uv = vec2(mod(n, 32.0), floor(n/32.0)) / 32.0;
uv *= 10.;

vec4 color = texture(Sampler0, uv);
float length = texture(Sampler1, uv).x * 2.0;

float ng = n * 2.9781;
vec4 gp = vec4(uv.x, 0., uv.y, 0.) * 8.0;
gp.xyz += vec3(cos(ng*1.117), 0., sin(ng*0.914)) * 0.2;
outCompute0 = gp;
vec3 nrm = normalize(vec3(0.,1.,0.) + vec3(cos(ng), 0., sin(ng)) * 0.25 );
outCompute1 = vec4(nrm, 0.);
outCompute2 = gp + vec4(nrm, 0.) * 0.01;
outCompute3 = gp + vec4(nrm, 0.) * 0.02;

outCompute0.a = color.r;
outCompute1.a = color.g;
outCompute2.a = color.b;
outCompute3.a = length;
}
Loading

0 comments on commit d0c5a62

Please sign in to comment.