Skip to content

Commit

Permalink
Merge branch 'sd/assets'
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Mar 24, 2021
2 parents 4131b7f + 463be34 commit 7554d9a
Show file tree
Hide file tree
Showing 41 changed files with 14 additions and 10,702 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ vec3 blinnphong(vec3 N, vec3 V, vec3 L, vec3 color){
vec3 H = normalize(L + V);

float spec_coeff = pow(max(dot(H, N), 0.0), shininess);

if (diff_coeff <= 0.0 || isnan(spec_coeff))
spec_coeff = 0.0;
// final lighting model
return vec3(
ambient * color +
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ vec3 blinnphong(vec3 N, vec3 V, vec3 L, vec3 color){
// specular coefficient
vec3 H = normalize(L + V);
float spec_coeff = pow(max(dot(H, N), 0.0), shininess);
if (diff_coeff <= 0.0 || isnan(spec_coeff))
spec_coeff = 0.0;
// final lighting model
return vec3(
ambient * color +
Expand Down Expand Up @@ -309,7 +311,7 @@ void main()

float steps = 0.1;
// the algorithm numbers correspond to the order in the
// RaymarchAlgorithm enum defined in AbstractPlotting types.jl
// RaymarchAlgorithm enum defined in AbstractPlotting types.jl
if(algorithm == 0)
color = isosurface(start, step_in_dir);
else if(algorithm == 1)
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion experiments/mesh.frag
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ vec3 blinnphong(vec3 N, vec3 V, vec3 L, vec3 color){
vec3 H = normalize(L + V);

float spec_coeff = pow(max(dot(H, N), 0.0), shininess);

if (diff_coeff <= 0.0 || isnan(spec_coeff))
spec_coeff = 0.0;
// final lighting model
return vec3(
get_ambient() * color +
Expand Down
5 changes: 2 additions & 3 deletions experiments/shaderabstr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ program = disp.renderlist[1][3].vertexarray.program

struct OGLContext <: ShaderAbstractions.AbstractContext end

using GLMakie.GLVisualize: assetpath
instance = ShaderAbstractions.VertexArray(posmeta, triangles_buff)

ShaderAbstractions.type_string(OGLContext(), Vec2f0)

p = ShaderAbstractions.Program(
OGLContext(),
read(assetpath("shader", "mesh.vert"), String),
read(assetpath("shader", "mesh.frag"), String),
read(loadshader("mesh.vert"), String),
read(loadshader("mesh.frag"), String),
instance;
)

Expand Down
18 changes: 1 addition & 17 deletions src/GLMakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,7 @@ end
struct GLBackend <: AbstractPlotting.AbstractBackend
end

"""
returns path relative to the assets folder
"""
assetpath(folders...) = joinpath(@__DIR__, "GLVisualize", "assets", folders...)

"""
Loads a file from the asset folder
"""
function loadasset(folders...; kw_args...)
path = assetpath(folders...)
isfile(path) || isdir(path) || error("Could not locate file at $path")
load(path; kw_args...)
end


const deps_path = joinpath(@__DIR__, "..", "deps", "deps.jl")
loadshader(name) = normpath(joinpath(@__DIR__, "..", "assets", "shader", name))

# don't put this into try catch, to not mess with normal errors
include("gl_backend.jl")
Expand All @@ -58,7 +43,6 @@ function __init__()
end

export set_window_config!
export assetpath, loadasset

if Base.VERSION >= v"1.4.2"
include("precompile.jl")
Expand Down
6 changes: 1 addition & 5 deletions src/GLVisualize/GLVisualize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@ using Base.Iterators: Repeated, repeated
using LinearAlgebra

import AbstractPlotting: to_font, glyph_uv_width!
import ..GLMakie: get_texture!
import ..GLMakie: get_texture!, loadshader

const GLBoundingBox = FRect3D

using ..GLMakie: assetpath, loadasset


include("visualize_interface.jl")
export visualize # Visualize an object
export visualize_default # get the default parameter for a visualization

include(joinpath("visualize", "lines.jl"))
include(joinpath("visualize", "image_like.jl"))
Expand Down
Loading

0 comments on commit 7554d9a

Please sign in to comment.