forked from hitmen047/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradial.h
76 lines (61 loc) · 2.64 KB
/
radial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#ifndef RADIAL_H
#define RADIAL_H
#pragma once
#include "mathlib/bumpvects.h"
#include "mathlib/ssemath.h"
#include "lightmap.h"
#define RADIALDIST2 2 // (1.25*1.25+1.25*1.25)
#define RADIALDIST 1.42 // 1.77 // sqrt( RADIALDIST2 )
#define WEIGHT_EPS 0.00001f
//-----------------------------------------------------------------------------
// The radial_t data structure is used to accumulate irregularly spaced and irregularly
// shaped direct and indirect lighting samples into a uniformly spaced and shaped luxel grid.
//
// The name "radial" is more historical than discriptive; it stems from the filtering method,
// one of several methods initially tried. Since all the other methods have since been deleted,
// it would probably be more accurate to rename it something like "LuxelAccumulationBucket" or
// something similar, but since "radial" is fairly meaningless it's not like it's actually confusing
// the issue.
//-----------------------------------------------------------------------------
typedef struct radial_s
{
int facenum;
lightinfo_t l;
int w, h;
float weight[SINGLEMAP];
LightingValue_t light[NUM_BUMP_VECTS + 1][SINGLEMAP];
} radial_t;
void WorldToLuxelSpace( lightinfo_t const *l, Vector const &world, Vector2D &coord );
void LuxelSpaceToWorld( lightinfo_t const *l, float s, float t, Vector &world );
void WorldToLuxelSpace( lightinfo_t const *l, FourVectors const &world, FourVectors &coord );
void LuxelSpaceToWorld( lightinfo_t const *l, fltx4 s, fltx4 t, FourVectors &world );
void AddDirectToRadial( radial_t *rad,
Vector const &pnt,
Vector2D const &coordmins, Vector2D const &coordmaxs,
Vector const light[NUM_BUMP_VECTS+1],
bool hasBumpmap, bool neighborHasBumpmap );
void AddBounceToRadial( radial_t *rad,
Vector const &pnt,
Vector2D const &coordmins, Vector2D const &coordmaxs,
Vector const light[NUM_BUMP_VECTS+1],
bool hasBumpmap, bool neighborHasBumpmap );
bool SampleRadial( radial_t *rad, Vector& pnt, Vector light[NUM_BUMP_VECTS+1], int bumpSampleCount );
radial_t *AllocateRadial( int facenum );
void FreeRadial( radial_t *rad );
bool SampleRadial( radial_t *rad, Vector& pnt, Vector light[NUM_BUMP_VECTS + 1], int bumpSampleCount );
radial_t *BuildPatchRadial( int facenum );
// utilities
bool FloatLess( float const& src1, float const& src2 );
#endif