ccdemos/textures.cc
author Radek Brich <radek.brich@devl.cz>
Mon, 05 May 2008 15:31:14 +0200
branchpyrit
changeset 92 9af5c039b678
parent 91 9d66d323c354
child 93 96d65f841791
permissions -rw-r--r--
add MSVC compiler support, make it default for Windows new header file simd.h for SSE abstraction and helpers add mselect pseudo instruction for common or(and(...), andnot(...)) replace many SSE intrinsics with new names new MemoryPool class (mempool.h) for faster KdNode allocation remove setMaxDepth() from Octree and KdTree, make max_depth const, it should be defined in constructor and never changed, change after building tree would cause error in traversal modify DefaultSampler to generate nice 2x2 packets of samples for packet tracing optimize Box and BBox::intersect_packet add precomputed invdir attribute to RayPacket scons build system: check for pthread library on Windows check for SDL generate include/config.h with variables detected by scons configuration move auxiliary files to build/ add sanity checks add writable operator[] to Vector
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
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
     6
Camera cam(Vector(0.,6.,6.), Vector(0.,2.,-7.), Vector(0.,0.,-1.));
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
     7
Light light(Vector(-2.0, 10.0, -2.0), Colour(0.9, 0.9, 0.9));
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    28
			lx = -0.1 * down;
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    31
			lx = +0.1 * down;
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    34
			ly = -0.1 * down;
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    37
			ly = +0.1 * down;
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    40
			lz = -0.1 * down;
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    43
			lz = +0.1 * down;
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    47
			cf = -0.02 * down;
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:
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    50
			cf = +0.02 * down;
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
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    66
	Material mat0a(Colour(0.7, 0.7, 0.7));
79
062b1c4143f7 material and texture classes moved to material.(cc,h)
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    67
	mat0a.setReflectivity(0.0);
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    68
	Box box(Vector(-12.0, -1.2, -20.0), Vector(12.0, -1.0, 0.0), &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
    69
	rt.addShape(&box);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    70
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    71
	Material mat0b(Colour(0.1, 0.7, 0.8));
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    72
	mat0b.setReflectivity(0.7);
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    73
	Box box2(Vector(-12.0, -1.2, -10.0), Vector(12.0, 10.0, -10.2), &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
    74
	rt.addShape(&box2);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    75
79
062b1c4143f7 material and texture classes moved to material.(cc,h)
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    76
	Float bounds[] = {0.3, 0.6, 1.1};
062b1c4143f7 material and texture classes moved to material.(cc,h)
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    77
	Colour colours[] = {Colour(0,0,0), Colour(1,1,1), Colour(0,0,0)};
062b1c4143f7 material and texture classes moved to material.(cc,h)
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    78
	BoundColourMap cmap(bounds, colours);
062b1c4143f7 material and texture classes moved to material.(cc,h)
Radek Brich <radek.brich@devl.cz>
parents: 75
diff changeset
    79
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    80
	// spheres
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    81
	Material mat1(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    82
	mat1.texture = new CheckersTexture(new PlanarMap(Vector(-4.5, 2.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    83
	Sphere sphere1(Vector(-4.5, 2.0, -7.0), 1.0, &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
    84
	rt.addShape(&sphere1);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    85
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    86
	Material mat2(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    87
	mat2.texture = new CheckersTexture(new CubicMap(Vector(-1.5, 2.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    88
	Sphere sphere2(Vector(-1.5, 2.0, -7.0), 1.0, &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
    89
	rt.addShape(&sphere2);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    90
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    91
	Material mat3(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    92
	mat3.texture = new CheckersTexture(new CylinderMap(Vector(1.5, 2.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    93
	Sphere sphere3(Vector(1.5, 2.0, -7.0), 1.0, &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
    94
	rt.addShape(&sphere3);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    95
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    96
	Material mat4(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    97
	mat4.texture = new CheckersTexture(new SphereMap(Vector(4.5, 2.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
    98
	Sphere sphere4(Vector(4.5, 2.0, -7.0), 1.0, &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
    99
	rt.addShape(&sphere4);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   100
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   101
	// cubes
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   102
	Material mat5(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   103
	mat5.texture = new CheckersTexture(new PlanarMap(Vector(-4.5, 0.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   104
	Box cube1(Vector(-4.5, 0.0, -7.0)-1.0, Vector(-4.5, 0.0, -7.0)+1.0, &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
   105
	rt.addShape(&cube1);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   106
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   107
	Material mat6(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   108
	mat6.texture = new CheckersTexture(new CubicMap(Vector(-1.5, 0.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   109
	Box cube2(Vector(-1.5, 0.0, -7.0)-1.0, Vector(-1.5, 0.0, -7.0)+1.0, &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
   110
	rt.addShape(&cube2);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   111
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   112
	Material mat7(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   113
	mat7.texture = new CheckersTexture(new CylinderMap(Vector(1.5, 0.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   114
	Box cube3(Vector(1.5, 0.0, -7.0)-1.0, Vector(1.5, 0.0, -7.0)+1.0, &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
   115
	rt.addShape(&cube3);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   116
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   117
	Material mat8(Colour(1.0, 1.0, 1.0));
91
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   118
	mat8.texture = new CheckersTexture(new SphereMap(Vector(4.5, 0.0, -7.0), 0.48), &cmap);
9d66d323c354 packetize Phong shader
Radek Brich <radek.brich@devl.cz>
parents: 88
diff changeset
   119
	Box cube4(Vector(4.5, 0.0, -7.0)-1.0, Vector(4.5, 0.0, -7.0)+1.0, &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
   120
	rt.addShape(&cube4);
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   121
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   122
	mat1.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   123
	mat2.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   124
	mat3.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   125
	mat4.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   126
	mat5.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   127
	mat6.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   128
	mat7.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   129
	mat8.setReflectivity(0);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   130
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   131
	top.optimize();
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   132
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   133
	w = 1024;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   134
	h = 600;
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   135
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   136
	/* run interactive mode */
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   137
	loop_sdl(rt, cam, update_callback, key_callback);
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   138
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   139
	/* render image */
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   140
	if (argc == 2 && !strcmp(argv[1], "-r"))
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   141
	{
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   142
		pyrit_verbosity = 2;
75
20dee9819b17 unify capitalization of method names in C++ and Python
Radek Brich <radek.brich@devl.cz>
parents: 72
diff changeset
   143
		rt.ambientOcclusion(300, 5.0, 0.5);
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
   144
		DefaultSampler sampler(w, h);
48
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
   145
		sampler.setOversample(2);
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
   146
		sampler.setSubsample(1);
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents: 43
diff changeset
   147
		rt.setSampler(&sampler);
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents: 43
diff changeset
   148
		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
   149
		sampler.getPixmap().writePNG("textures.png");
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   150
	}
92
9af5c039b678 add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents: 91
diff changeset
   151
	
9af5c039b678 add MSVC compiler support, make it default for Windows
Radek Brich <radek.brich@devl.cz>
parents: 91
diff changeset
   152
	return 0;
42
fbdeb3e04543 cleaned Texture interface
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   153
}