src/sampler.cc
author Radek Brich <radek.brich@devl.cz>
Thu, 10 Apr 2008 23:20:36 +0200
branchpyrit
changeset 65 242839c6d27d
parent 53 228cb8bfdd54
child 77 dbe8438d5dca
permissions -rw-r--r--
basic detection of compiler (GCC or ICC) and CPU capabilities try to detect Python path in Windows and allow direct specification through build option plus other build system fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
/*
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
 * scene.cc: screen sample generation and image reconstruction
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
 *
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
 * This file is part of Pyrit Ray Tracer.
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
 *
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
 * Copyright 2008  Radek Brich
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
 *
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
 * Permission is hereby granted, free of charge, to any person obtaining a copy
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     9
 * of this software and associated documentation files (the "Software"), to deal
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    10
 * in the Software without restriction, including without limitation the rights
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    11
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    12
 * copies of the Software, and to permit persons to whom the Software is
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    13
 * furnished to do so, subject to the following conditions:
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
 *
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    15
 * The above copyright notice and this permission notice shall be included in
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    16
 * all copies or substantial portions of the Software.
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    17
 *
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    20
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
 * THE SOFTWARE.
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25
 */
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    26
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    27
#include <math.h>
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    28
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
#include "common.h"
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    30
#include "scene.h"
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    31
48
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
    32
void DefaultSampler::init()
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
    33
{
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
    34
	phase = 0;
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
    35
}
a4913301c626 begin moving subsampling and oversampling to Sampler
Radek Brich <radek.brich@devl.cz>
parents: 47
diff changeset
    36
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    37
int DefaultSampler::initSampleSet()
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    38
{
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    39
	static const int gridsamples[] = {1,5,9,16};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    40
	const int samples = gridsamples[oversample];
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    41
	if ( phase == 0 )
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    42
	{
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    43
		phase++;
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    44
		sx = -1;
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    45
		return w*h*samples;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    46
	}
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    47
	else if ( phase == 1 && oversample )
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    48
	{
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    49
		phase = -1;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    50
		Float *buf;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    51
		for (buf = buffer; buf != buffer + w*h*3; buf++)
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    52
			*buf = *buf * (1.0/samples);
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    53
		return 0;
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    54
	}
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    55
	else
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    56
	{
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    57
		phase = -1;
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    58
		return 0;
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    59
	}
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    60
}
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    61
53
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
    62
bool DefaultSampler::nextSample(Sample* s)
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    63
{
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    64
	/* grid oversampling */
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    65
	static const int gridsamples[] = {1,5,9,16};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    66
	static const Float osa5x[] = {0.0, -0.4, +0.4, +0.4, -0.4};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    67
	static const Float osa5y[] = {0.0, -0.4, -0.4, +0.4, +0.4};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    68
	static const Float osa9x[] = {-0.34,  0.00, +0.34,
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    69
		-0.34,  0.00, +0.34, -0.34,  0.00, +0.34};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    70
	static const Float osa9y[] = {-0.34, -0.34, -0.34,
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    71
			0.00,  0.00,  0.00, +0.34, +0.34, +0.34};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    72
	static const Float osa16x[] = {-0.375, -0.125, +0.125, +0.375,
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    73
		-0.375, -0.125, +0.125, +0.375, -0.375, -0.125, +0.125, +0.375,
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    74
		-0.375, -0.125, +0.125, +0.375};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    75
	static const Float osa16y[] = {-0.375, -0.375, -0.375, -0.375,
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    76
		-0.125, -0.125, -0.125, -0.125, +0.125, +0.125, +0.125, +0.125,
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    77
		+0.375, +0.375, +0.375, +0.375};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    78
	static const Float *osaSx[] = {NULL, osa5x, osa9x, osa16x};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    79
	static const Float *osaSy[] = {NULL, osa5y, osa9y, osa16y};
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    80
	const int samples = gridsamples[oversample];
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    81
	const Float *osax = osaSx[oversample];
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    82
	const Float *osay = osaSy[oversample];
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    83
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    84
	if (sx < 0)
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    85
	{
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    86
		// first sample
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    87
		s->x = -(Float)w/h/2.0;
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    88
		s->y = -0.5;
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    89
		sx = 0;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    90
		sy = 0;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    91
		osa_samp = 0;
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    92
	}
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    93
	else
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    94
	{
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    95
		osa_samp++;
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    96
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    97
		if (oversample && oversample <= 3 && osa_samp < samples)
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
    98
		{
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
    99
			s->x = osax[osa_samp]/h + (Float)sx/h - (Float)w/h/2.0;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   100
			s->y = osay[osa_samp]/h + (Float)sy/h - 0.5;
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   101
		}
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   102
		else
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   103
		{
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   104
			sx++;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   105
			if (sx >= w)
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   106
			{
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   107
				sx = 0;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   108
				sy++;
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   109
			}
53
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
   110
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   111
			if (sy >= h)
53
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
   112
				return false;
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
   113
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   114
			s->x = (Float)sx/h - (Float)w/h/2.0;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   115
			s->y = (Float)sy/h - 0.5;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   116
			osa_samp = 0;
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   117
		}
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   118
	}
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   119
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   120
	if (osa_samp == 0 && oversample && oversample <= 3)
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   121
	{
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   122
		s->x += osax[0]/h;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   123
		s->y += osay[0]/h;
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   124
		Float *buf = buffer + 3*(sy*w + sx);
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   125
		*(buf++) = 0;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   126
		*(buf++) = 0;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   127
		*(buf++) = 0;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   128
	}
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   129
50
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   130
	s->sx = sx;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   131
	s->sy = sy;
14a727b70d07 rewritten threads with heavy debug information
Radek Brich <radek.brich@devl.cz>
parents: 49
diff changeset
   132
	s->osa_samp = osa_samp;
53
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
   133
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
   134
	return true;
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   135
}
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   136
53
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
   137
void DefaultSampler::saveSample(Sample &samp, Colour &col)
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   138
{
53
228cb8bfdd54 slighly optimized raytrace_worker
Radek Brich <radek.brich@devl.cz>
parents: 51
diff changeset
   139
	Float *buf = buffer + 3*(samp.sy * w + samp.sx);
49
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   140
	if (oversample)
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   141
	{
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   142
		*(buf+0) += col.r;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   143
		*(buf+1) += col.g;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   144
		*(buf+2) += col.b;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   145
	}
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   146
	else
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   147
	{
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   148
		*(buf++) = col.r;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   149
		*(buf++) = col.g;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   150
		*(buf++) = col.b;
558fde7da82a workaround for divide by zero bug in octree
Radek Brich <radek.brich@devl.cz>
parents: 48
diff changeset
   151
	}
47
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   152
}
320d5d466864 move Sampler classes to sampler.cc
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
   153