Skip to content

Commit

Permalink
Merge branch 'dev-0.2' of https://github.com/CedricGuillemet/Imogen
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricGuillemet committed Oct 2, 2018
2 parents a818a7f + f4ab2b6 commit 1b63a17
Show file tree
Hide file tree
Showing 63 changed files with 9,295 additions and 879 deletions.
35 changes: 32 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,47 @@ file(GLOB_RECURSE SRC_FILES
${CMAKE_SOURCE_DIR}/src/*.h
${CMAKE_SOURCE_DIR}/src/*.cpp
)
file(GLOB_RECURSE EXT_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/enkiTS-C-11/src/*.cpp
${CMAKE_SOURCE_DIR}/ext/NativeFileDialog/src/nfd_common.c
)

if(WIN32)
set(NFD_FILES ${CMAKE_SOURCE_DIR}/ext/NativeFileDialog/src/nfd_win.cpp)
set(PLATFORM_LIBS "libtcc")
else()
set(NFD_FILES ${CMAKE_SOURCE_DIR}/ext/NativeFileDialog/src/nfd_gtk.c
)
# Use the package PkgConfig to detect GTK+ headers/library files
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)

# Setup CMake to use GTK+, tell the compiler where to look for headers
# and to the linker where to look for libraries
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})

# Add other flags to the compiler
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
set(PLATFORM_LIBS dl pthread ${GTK3_LIBRARIES} libtcc.a)
endif()

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/ext
${CMAKE_CURRENT_SOURCE_DIR}/ext/SDL2-2.0.8/include
${CMAKE_CURRENT_SOURCE_DIR}/ext/gl3w
${CMAKE_CURRENT_SOURCE_DIR}/ext/tcc-0.9.27/
${CMAKE_CURRENT_SOURCE_DIR}/ext/NativeFileDialog/src/include/
${CMAKE_CURRENT_SOURCE_DIR}/ext/enkiTS-C-11/src/
)

link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ext/SDL2-2.0.8/lib/x64
${CMAKE_CURRENT_SOURCE_DIR}/ext/tcc-0.9.27/libtcc
)
find_package(OpenGL)

Expand Down Expand Up @@ -81,9 +108,9 @@ endif()
SET(LINK_OPTIONS " ")
SET(EXE_NAME "Imogen")

ADD_EXECUTABLE(${EXE_NAME} ${SRC_FILES} ${EXT_FILES} )
ADD_EXECUTABLE(${EXE_NAME} ${SRC_FILES} ${EXT_FILES} ${NFD_FILES})

TARGET_LINK_LIBRARIES(${EXE_NAME} ${SDL2_LIBS} ${OPENGL_LIBRARIES})
TARGET_LINK_LIBRARIES(${EXE_NAME} ${SDL2_LIBS} ${OPENGL_LIBRARIES} ${PLATFORM_LIBS})

#--------------------------------------------------------------------
# preproc
Expand All @@ -94,8 +121,10 @@ add_definitions(-DBX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1)
add_definitions(-D__STDC_LIMIT_MACROS)
add_definitions(-D__STDC_CONSTANT_MACROS)
add_definitions(-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS)
if(WINDOWS)
add_definitions(-DWIN32)
add_definitions(-D_WIN32)
endif()
add_definitions(-DUSE_DL_PREFIX)
#--------------------------------------------------------------------
# output dirs
Expand Down
20 changes: 20 additions & 0 deletions bin/C/ImageRead.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "Imogen.h"

typedef struct ImageRead_t
{
char filename[1024];
} ImageRead;

int main(ImageRead *param, Evaluation *evaluation)
{
Image image;
if (ReadImage(param->filename, &image) == EVAL_OK)
{
if (SetEvaluationImage(evaluation->targetIndex, &image) == EVAL_OK)
{
FreeImage(&image);
return EVAL_OK;
}
}
return EVAL_ERR;
}
42 changes: 42 additions & 0 deletions bin/C/ImageWrite.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

#include "Imogen.h"

typedef struct ImageWrite_t
{
char filename[1024];
int format;
int quality;
int width, height;
}ImageWrite;

int main(ImageWrite *param, Evaluation *evaluation)
{
char *stockImages[5] = {"Stock/jpg-icon.png", "Stock/png-icon.png", "Stock/tga-icon.png", "Stock/bmp-icon.png", "Stock/hdr-icon.png"};
Image image;

// set info stock image
if (ReadImage(stockImages[param->format], &image) == EVAL_OK)
{
if (SetEvaluationImage(evaluation->targetIndex, &image) == EVAL_OK)
{
FreeImage(&image);
}
}

if (!evaluation->forcedDirty)
return EVAL_OK;

if (Evaluate(evaluation->inputIndices[0], 256<<param->width, 256<<param->height, &image) == EVAL_OK)
{
if (WriteImage(param->filename, &image, param->format, param->quality) == EVAL_OK)
{
FreeImage(&image);
Log("Image %s saved.\n", param->filename);
return EVAL_OK;
}
else
Log("Unable to write image : %s\n", param->filename);
}

return EVAL_ERR;
}
39 changes: 39 additions & 0 deletions bin/C/Imogen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
int Log(const char *szFormat, ...);

typedef struct Image_t
{
int width, height;
int components;
void *bits;
} Image;

typedef struct Evaluation_t
{
int targetIndex;
int inputIndices[8];
int forcedDirty;
} Evaluation;

// call FreeImage when done
int ReadImage(char *filename, Image *image);
// writes an allocated image
int WriteImage(char *filename, Image *image, int format, int quality);
// call FreeImage when done
int GetEvaluationImage(int target, Image *image);
//
int SetEvaluationImage(int target, Image *image);
// call FreeImage when done
// set the bits pointer with an allocated memory
int AllocateImage(Image *image);
int FreeImage(Image *image);

// Image resize
// Image thumbnail
int SetThumbnailImage(Image *image);

// force evaluation of a target with a specified size
// no guarantee that the resulting Image will have that size.
int Evaluate(int target, int width, int height, Image *image);

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

int main(void *param, Evaluation *evaluation)
{
Image image;

if (ReadImage("Stock/thumbnail-icon.png", &image) == EVAL_OK)
{
if (SetEvaluationImage(evaluation->targetIndex, &image) == EVAL_OK)
{
FreeImage(&image);
}
}

if (!evaluation->forcedDirty)
return EVAL_OK;

if (GetEvaluationImage(evaluation->inputIndices[0], &image) == EVAL_OK)
{
if (SetThumbnailImage(&image) == EVAL_OK)
{
FreeImage(&image);
return EVAL_OK;
}
}

return EVAL_ERR;
}
2 changes: 1 addition & 1 deletion bin/GLSL/LambertMaterial.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ vec4 LambertMaterial()
// sphere center
vec3 sc = vec3(0.0,1.0,0.0);

vec3 col = texture(equiRectEnvSampler, envMapEquirect(rd)).xyz;
vec3 col = texture(Sampler1, envMapEquirect(rd)).xyz;

if (castRay(ro, rd)<10.0)
{
Expand Down
4 changes: 2 additions & 2 deletions bin/GLSL/PBR.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ float camHeight = -0.2;
vec3 lightColor = vec3( 2. );
vec3 lightDir = normalize( vec3( .7, .9, -.2 ) );

vec3 col = texture(equiRectEnvSampler, envMapEquirect(rd)).xyz;
vec3 col = texture(Sampler4, envMapEquirect(rd)).xyz;
float t = CastRay( ro, rd, localToWorld );
if ( t > 0.0 )
{
Expand Down Expand Up @@ -274,7 +274,7 @@ float camHeight = -0.2;

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

vec3 env = textureLod(equiRectEnvSampler, envMapEquirect(refl),roughnessE*12.0).xyz;
vec3 env = textureLod(Sampler4, envMapEquirect(refl),roughnessE*12.0).xyz;

diffuse += diffuseColor * EnvRemap(env);
specular += envSpecularColor * env;
Expand Down
5 changes: 4 additions & 1 deletion bin/GLSL/Shader.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ uniform sampler2D Sampler0;
uniform sampler2D Sampler1;
uniform sampler2D Sampler2;
uniform sampler2D Sampler3;
uniform sampler2D equiRectEnvSampler;
uniform sampler2D Sampler4;
uniform sampler2D Sampler5;
uniform sampler2D Sampler6;
uniform sampler2D Sampler7;

vec2 Rotate2D(vec2 v, float a)
{
Expand Down
10 changes: 6 additions & 4 deletions bin/GLSL/Transform.glsl
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
layout (std140) uniform TransformBlock
{
vec2 translate;
vec2 scale;
float rotate;
float scale;
} TransformParam;
};

vec4 Transform()
{
vec2 rs = (vUV+TransformParam.translate) * TransformParam.scale;
vec2 ro = vec2(rs.x*cos(TransformParam.rotate) - rs.y * sin(TransformParam.rotate), rs.x*sin(TransformParam.rotate) + rs.y * cos(TransformParam.rotate));
vec2 rs = (vUV+translate) * scale;
rs -= 0.5;
vec2 ro = vec2(rs.x*cos(rotate) - rs.y * sin(rotate), rs.x*sin(rotate) + rs.y * cos(rotate));
ro += 0.5;
vec2 nuv = ro;//fract(ro);
vec4 tex = texture(Sampler0, nuv);
return tex;
Expand Down
Binary file modified bin/Imogen.exe
Binary file not shown.
Binary file added bin/Outputs/GamekultLogo_4K.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Outputs/JapaneseTile_4K.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Outputs/PartyCatDeformed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Pictures/PartyCat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Stock/bmp-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Stock/hdr-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Stock/jpg-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Stock/png-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Stock/tga-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/Stock/thumbnail-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bin/library.dat
Binary file not shown.
Binary file added bin/libtcc.dll
Binary file not shown.
16 changes: 14 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Imogen 0.1.1 - codename Pegasus Seiya
-------------------------------------------------------------------------------
Imogen 0.2 - codename Dragon Shiryu

New:
- C CPU nodes. edit and run C code on the fly
- image reader/writer with jpg, png, tga, bmp, partial HDR support
- thumbnail node: node, library, display
- save and restore docking layout
- Export button in node graph dock that force every export in the graph

WIP
Changed:
- Separate scale X and Y values in Transform node

-------------------------------------------------------------------------------
Imogen 0.1.1 - codename Pegasus Seiya

New:
- SDL 2 instead of custom Windows only ImApp.h (one big step toward Linux port)
Expand Down
16 changes: 16 additions & 0 deletions ext/NativeFileDialog/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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.

Loading

0 comments on commit 1b63a17

Please sign in to comment.