Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Add OpenSimplex
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathonracz committed Jan 8, 2018
1 parent c3affd6 commit 27ffb80
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "jtracer/External/OpenSimplexCPP"]
path = jtracer/External/OpenSimplexCPP
url = https://jonathonracz@github.com/jonathonracz/OpenSimplexCPP.git
2 changes: 2 additions & 0 deletions jtracer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = YES;
MTL_HEADER_SEARCH_PATHS = "${PROJECT_DIR}/jtracer/External/OpenSimplexCPP/include";
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
Expand Down Expand Up @@ -384,6 +385,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_HEADER_SEARCH_PATHS = "${PROJECT_DIR}/jtracer/External/OpenSimplexCPP/include";
SDKROOT = macosx;
};
name = Release;
Expand Down
1 change: 1 addition & 0 deletions jtracer/External/OpenSimplexCPP
Submodule OpenSimplexCPP added at e24106
7 changes: 6 additions & 1 deletion jtracer/JTMetal.metal
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ using namespace metal;
#include "Trace/JTBindPoints.h"
#include "Trace/JTNumerics.h"

#include "OpenSimplex/OpenSimplex.h"

kernel void jtMetal(texture2d<half, access::write> output [[texture(jt::TextureIndex::output)]],
JT_CONSTANT jt::Uniforms& uniforms [[buffer(jt::BufferIndex::uniforms)]],
simd::uint2 gid [[thread_position_in_grid]])
Expand All @@ -23,5 +25,8 @@ kernel void jtMetal(texture2d<half, access::write> output [[texture(jt::TextureI
if((gid.x >= output.get_width()) || (gid.y >= output.get_height()))
return;

output.write(half4(random.nextNormalized(), gid.y / static_cast<float>(output.get_height()), 0.0f, 1.0f), gid);
//OpenSimplex osimp(uniforms.frameCount);
//float pixelValue = osimp.noise2(gid.x, gid.y);

output.write(half4(1.0f, 0.0f, 0.0f, 1.0f), gid);
}

0 comments on commit 27ffb80

Please sign in to comment.