Changeset 2191
- Timestamp:
- Jan 1, 2013, 8:11:43 PM (10 years ago)
- Location:
- trunk/tutorial
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tutorial/04_texture.cpp
r2183 r2191 19 19 using namespace lol; 20 20 21 static int const TEXTURE_WIDTH = 128;21 static int const TEXTURE_WIDTH = 512; 22 22 23 23 extern char const *lolfx_04_texture; … … 58 58 59 59 int height = m_heightmap[4 * (TEXTURE_WIDTH - 1)]; 60 height = height / 2 + 255 / 4 + rand() % 97 - 48;60 height = (height + 127 + 40 * lol::sin(m_frames * 0.03) + rand() % 97 - 38) / 2; 61 61 height = std::max(15, std::min(height, 240)); 62 62 m_heightmap[4 * (TEXTURE_WIDTH - 1)] = height; -
trunk/tutorial/04_texture.lolfx
r2190 r2191 32 32 float width = 800.0; 33 33 float height = 600.0; 34 float line_width = 1.8; 35 float dot_size = 2.0; 36 vec4 delta = vec4(1.0 / 128, 0.0, 37 2.0 / 128, 0.0); 34 float texture_width = 512.0; 35 float line_width = 1.2; 36 float dot_size = 1.0; 37 vec4 delta = vec4(1.0 / 512, 0.0, 38 2.0 / 512, 0.0); 38 39 39 40 vec2 p = pass_Position.xy; 40 vec2 tc = vec2(floor(p.x * 128.0) / 128.0, p.y);41 float t = p.x * 128.0 - floor(p.x * 128.0);41 vec2 tc = vec2(floor(p.x * 512.0) / 512.0, p.y); 42 float t = p.x * 512.0 - floor(p.x * 512.0); 42 43 vec4 c; 43 44 c[0] = texture2D(u_Texture, tc - delta.xy).x; … … 46 47 c[3] = texture2D(u_Texture, tc + delta.zw).x; 47 48 49 /* Find the 4 closest points in screen space */ 48 50 vec2 p0 = vec2((tc.x - delta.x) * width, c[0] * height); 49 51 vec2 p1 = vec2((tc.x ) * width, c[1] * height);
Note: See TracChangeset
for help on using the changeset viewer.