Skip to content

Commit

Permalink
Added shadertoy3 sample
Browse files Browse the repository at this point in the history
  • Loading branch information
seanbaxter committed Dec 8, 2020
1 parent af103a6 commit ba9e6e9
Show file tree
Hide file tree
Showing 3 changed files with 1,250 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shadertoy/shadertoy.cxx
Expand Up @@ -207,7 +207,7 @@ struct [[

vec3 hash32(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));
p3 += dot(p3, p3.yxz+19.19);
p3 += dot(p3, p3.yxz+19.19f);
return fract((p3.xxy+p3.yzz)*p3.zyx);
}

Expand All @@ -222,7 +222,7 @@ struct [[
if(r > 0) {
vec2 uv2 = rot(uv, a);
float yolk = sdShape(11 / sqrt(2.f) * uv2, r);
float white = sdShape(5.2 / sqrt(2.f) * uv2, r);
float white = sdShape(5.2f / sqrt(2.f) * uv2, r);
sd = vec2(opUnion(sd.x, white), opUnion(sd.y, yolk));
}
return sd;
Expand Down
29 changes: 29 additions & 0 deletions shadertoy3/CMakeLists.txt
@@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.9)

project(shadertoy3)

include_directories(../thirdparty/imgui)

set(SOURCE_FILES
shadertoy3.cxx

../thirdparty/imgui/imgui.cpp
../thirdparty/imgui/imgui_draw.cpp
../thirdparty/imgui/imgui_widgets.cpp
../thirdparty/imgui/backends/imgui_impl_glfw.cpp
../thirdparty/imgui/backends/imgui_impl_opengl3.cpp
)

add_compile_options(
"$<$<CONFIG:DEBUG>:-g>"
)

set_source_files_properties(shadertoy3.cxx PROPERTIES COMPILE_FLAGS -shader)

add_executable(shadertoy3 ${SOURCE_FILES})

target_link_libraries(shadertoy3
glfw
gl3w
GL
)

0 comments on commit ba9e6e9

Please sign in to comment.