ccdemos/textures.cc
author Radek Brich <radek.brich@devl.cz>
Sat, 10 May 2008 14:29:37 +0200
branchpyrit
changeset 95 ca7d4c665531
parent 93 96d65f841791
child 100 c005054bf4c1
permissions -rw-r--r--
build script fixes, add ldflags build option update and enhance demos fix bug in 4x grid oversampling warn if writePNG called while compiled without libpng make shapes in ShapeList const and add many other const needed due to snowball effect slightly optimize Camera::makeRayPacket using _mm_shuffle_ps make Vector SIMD vectorization disabled by default (causes problems) fix bug in implicit reflection of transmissive surfaces, when surface's reflection parameter is set to zero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
#include "raytracer.h"
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
     2
#include "kdtree.h"
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
#include "common_sdl.h"
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     6
Camera cam(Vector(0.0f,6.0f,6.0f), Vector(0.0f,2.0f,-7.0f), Vector(0.0f,0.0f,-1.0f));
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     7
Light light(Vector(-2.0f, 10.0f, -2.0f), Colour(0.9f, 0.9f, 0.9f));
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     9
Float lx, ly, lz, cf;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    10
81
9dbb9c8c115b add 2D pixmap texture class
Radek Brich <radek.brich@devl.cz>
parents: 79
diff changeset
    11
void update_callback(Float*)
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    12
{
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    13
	if (lx != 0.0)
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
		light.pos.x += lx;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    15
	if (ly != 0.0)
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    16
		light.pos.y += ly;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    17
	if (lz != 0.0)
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    18
		light.pos.z += lz;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    19
	if (cf != 0.0)
92
9af5c039b678 add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents: 91
diff changeset
    20
		cam.setF(cam.getF() + cf);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    21
}
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    22
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
void key_callback(int key, int down)
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
{
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25
	switch (key)
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    26
	{
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    27
		case SDLK_r:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    28
			lx = -0.1f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    30
		case SDLK_t:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    31
			lx = +0.1f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    32
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    33
		case SDLK_f:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    34
			ly = -0.1f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    35
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    36
		case SDLK_g:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    37
			ly = +0.1f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    38
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    39
		case SDLK_v:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    40
			lz = -0.1f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    41
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    42
		case SDLK_b:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    43
			lz = +0.1f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    44
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    45
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    46
		case SDLK_z:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    47
			cf = -0.02f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    48
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    49
		case SDLK_x:
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    50
			cf = +0.02f * down;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    51
			break;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    52
	}
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    53
}
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    54
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    55
int main(int argc, char **argv)
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    56
{
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    57
	Raytracer rt;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    58
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    59
	KdTree top;
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    60
	rt.setCamera(&cam);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    61
	rt.setTop(&top);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    62
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    63
	rt.addLight(&light);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    64
	light.castShadows(false);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    65
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    66
	const Colour c_white(1, 1, 1);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    67
	const Colour c_black(0, 0, 0);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    68
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    69
	Material mat0a(Colour(0.7f, 0.7f, 0.7f));
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    70
	mat0a.setReflectivity(0.0f);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    71
	Box box(Vector(-12.0f, -1.2f, -20.0f), Vector(12.0f, -1.0f, 0.0f), &mat0a);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    72
	rt.addShape(&box);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    73
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    74
	Material mat0b(Colour(0.1f, 0.7f, 0.8f));
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    75
	mat0b.setReflectivity(0.7f);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    76
	Box box2(Vector(-12.0f, -1.2f, -10.0f), Vector(12.0f, 10.0f, -10.2f), &mat0b);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    77
	rt.addShape(&box2);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    78
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    79
	Float bounds[] = {0.3f, 0.6f, 1.1f};
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    80
	Colour colours[] = {c_black, c_white, c_black};
79
062b1c4143f7 material and texture classes moved to material.(cc,h)
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    81
	BoundColourMap cmap(bounds, colours);
062b1c4143f7 material and texture classes moved to material.(cc,h)
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    82
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    83
	// spheres
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    84
	Material mat1(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    85
	mat1.texture = new CheckersTexture(new PlanarMap(Vector(-4.5f, 2.0f, -7.0f), 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    86
	Sphere sphere1(Vector(-4.5f, 2.0f, -7.0f), 1, &mat1);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    87
	rt.addShape(&sphere1);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    88
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    89
	Material mat2(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    90
	mat2.texture = new CheckersTexture(new CubicMap(Vector(-1.5f, 2.0f, -7.0f), 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    91
	Sphere sphere2(Vector(-1.5f, 2.0f, -7.0f), 1, &mat2);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    92
	rt.addShape(&sphere2);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    93
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    94
	Material mat3(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    95
	mat3.texture = new CheckersTexture(new CylinderMap(Vector(1.5f, 2.0f, -7.0f), 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    96
	Sphere sphere3(Vector(1.5f, 2.0f, -7.0f), 1, &mat3);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
    97
	rt.addShape(&sphere3);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    98
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    99
	Material mat4(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   100
	mat4.texture = new CheckersTexture(new SphereMap(Vector(4.5f, 2.0f, -7.0f), 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   101
	Sphere sphere4(Vector(4.5f, 2.0f, -7.0f), 1, &mat4);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
   102
	rt.addShape(&sphere4);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   103
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   104
	// cubes
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   105
	Material mat5(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   106
	const Vector cube1_base(-4.5f, 0.0f, -7.0f);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   107
	mat5.texture = new CheckersTexture(new PlanarMap(cube1_base, 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   108
	Box cube1(cube1_base - 1.0f, cube1_base + 1.0f, &mat5);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
   109
	rt.addShape(&cube1);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   110
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   111
	Material mat6(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   112
	const Vector cube2_base(-1.5f, 0.0f, -7.0f);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   113
	mat6.texture = new CheckersTexture(new CubicMap(cube2_base, 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   114
	Box cube2(cube2_base - 1.0f, cube2_base + 1.0f, &mat6);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
   115
	rt.addShape(&cube2);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   116
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   117
	Material mat7(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   118
	const Vector cube3_base(1.5f, 0.0f, -7.0f);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   119
	mat7.texture = new CheckersTexture(new CylinderMap(cube3_base, 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   120
	Box cube3(cube3_base - 1.0f, cube3_base + 1.0f, &mat7);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
   121
	rt.addShape(&cube3);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   122
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   123
	Material mat8(c_white);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   124
	const Vector cube4_base(4.5f, 0.0f, -7.0f);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   125
	mat8.texture = new CheckersTexture(new SphereMap(cube4_base, 0.48f), &cmap);
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   126
	Box cube4(cube4_base - 1.0f, cube4_base + 1.0f, &mat8);
72
7c3f38dff082 kd-tree building - check all axes for best split, add additional shape-bbox check
Radek Brich <radek.brich@devl.cz>
parents: 60
diff changeset
   127
	rt.addShape(&cube4);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   128
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   129
	mat1.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   130
	mat2.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   131
	mat3.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   132
	mat4.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   133
	mat5.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   134
	mat6.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   135
	mat7.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   136
	mat8.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   137
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   138
	top.optimize();
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   139
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   140
	w = 1024;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   141
	h = 600;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   142
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   143
	/* run interactive mode */
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   144
	loop_sdl(rt, cam, update_callback, key_callback);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   145
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   146
	/* render image */
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   147
	if (argc == 2 && !strcmp(argv[1], "-r"))
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   148
	{
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   149
		pyrit_verbosity = 2;
93
96d65f841791 more build script tuning
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
   150
		rt.ambientOcclusion(300, 5.0f, 0.5f);
88
f7edb3b90816 merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
   151
		DefaultSampler sampler(w, h);
48
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
   152
		sampler.setOversample(2);
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
   153
		sampler.setSubsample(1);
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents: 43
diff changeset
   154
		rt.setSampler(&sampler);
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents: 43
diff changeset
   155
		rt.render();
88
f7edb3b90816 merge pixmap handling from sampler, material.h and ccdemos's image module to new Pixmap class
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
   156
		sampler.getPixmap().writePNG("textures.png");
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   157
	}
92
9af5c039b678 add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents: 91
diff changeset
   158
	
9af5c039b678 add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents: 91
diff changeset
   159
	return 0;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   160
}