radial.h

来自「hl2 source code. Do not use it illegal.」· C头文件 代码 · 共 79 行

H
79
字号
//=========== (C) Copyright 2000 Valve, L.L.C. All rights reserved. ===========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose: 
//
// $Workfile:     $
// $Date:         $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================

#ifndef RADIAL_H
#define RADIAL_H
#pragma once

#include "bumpvects.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];
	Vector 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 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 );
int CalcExponent( float in );
void Vec3toColorRGBExp32( Vector& v, colorRGBExp32 *c );

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?