Skip to content

Commit ffd470f

Browse files
committed
no need
1 parent 2929c95 commit ffd470f

File tree

4 files changed

+39
-410
lines changed

4 files changed

+39
-410
lines changed

advanced_shader/blue_marble.rb

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1+
# frozen_string_literal: true
2+
13
require 'picrate'
24
# Earth model with bump mapping, specular texture and dynamic cloud layer.
35
# Adapted from the THREE.js tutorial to processing by Andres Colubri,
46
# translated to picrate by Martin Prout:
57
# http://learningthreejs.com/blog/2013/09/16/how-to-make-the-earth-in-webgl/
68
class BlueMarble < Processing::App
7-
attr_reader :earth, :clouds, :earth_shader, :cloud_shader, :earth_rotation
9+
attr_reader :cloud_shader, :clouds, :earth, :earth_shader, :earth_rotation
810
attr_reader :clouds_rotation, :target_angle
911

10-
SHADERS = %w(EarthFrag.glsl EarthVert.glsl CloudFrag.glsl CloudVert.glsl).freeze
11-
SHADER_NAME = %i(earth_frag earth_vert cloud_frag cloud_vert).freeze
12-
IMAGES = %w(earthmap1k earthcloudmap earthcloudmaptrans earthbump1k earthspec1k).freeze
13-
IMAGE_NAME = %i(earth_tex cloud_tex alpha_tex bump_map spec_map).freeze
12+
SHADER_NAME = %i[earth_frag earth_vert cloud_frag cloud_vert].freeze
13+
IMAGE_NAME = %i[earth_tex cloud_tex alpha_tex bump_map spec_map].freeze
1414

1515
def setup
1616
sketch_title 'Blue Marble'
1717
@earth_rotation = 0
1818
@clouds_rotation = 0
19-
glsl_files = SHADERS.map { |shade| data_path(shade) }
20-
shaders = SHADER_NAME.zip(glsl_files.to_java(:string)).to_h
21-
images = IMAGES.map { |img| load_image(data_path("#{img}.jpg")) }
19+
glsl_files = shader_paths.to_java(:string)
20+
shaders = SHADER_NAME.zip(glsl_files).to_h
21+
images = init_images
2222
textures = IMAGE_NAME.zip(images).to_h
2323
@earth_shader = load_shader(shaders[:earth_frag], shaders[:earth_vert])
2424
earth_shader.set('texMap', textures[:earth_tex])
@@ -55,6 +55,18 @@ def draw
5555
@clouds_rotation += 0.001
5656
end
5757

58+
def init_images
59+
%w[earthmap1k earthcloudmap earthcloudmaptrans earthbump1k earthspec1k].map do |img|
60+
load_image(data_path(format('%<name>s.jpg', name: img)))
61+
end
62+
end
63+
64+
def shader_paths
65+
%w[EarthFrag EarthVert CloudFrag CloudVert].map do |shader|
66+
data_path(format('%<name>s.glsl', name: shader))
67+
end
68+
end
69+
5870
def settings
5971
size(600, 600, P3D)
6072
end

advanced_shader/data/JuliaDE-double.glsl

Lines changed: 0 additions & 191 deletions
This file was deleted.

0 commit comments

Comments
 (0)