⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 light.h

📁 Ray tracing on PS3, using the acceleration of PPU, No SPE acceleration is used. The code must be com
💻 H
字号:
/* Copyright (c) 2007 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *//** * light.h - blue-steel Light class * @author Russel Ryan * * Contains the definition of the light structure for storing information about light sources, as well * as numerical constants for specifying the type of light that a specific light object represents.  * As this single class holds information for all types of lights (directional, point, and spot), some * information has different meanings depending on the type declared, and some data is not even used for * some types. * The parameters that are defined for each of the lights is as follows: *   directional lights : direction, color *   point lights : position, color, 3 attenuation factors (attn_x, attn_y, and attn_z) *   spotlight :  position, direction, color, alpha/phi, powerfactor/fallof *     arg1 = chphi, arg2 = chalpha, arg3=power *  * In order to use a light of a specific type, all defined information must be filled in before passing the light * into the ray tracing engine. */#ifndef _LIGHT_H_#define _LIGHT_H_#include "rgbpacket.h"#define LIGHT_DIRECTIONAL 0#define LIGHT_POINT 1#define LIGHT_SPOT 2#define LIGHT_TYPES 3struct light {  unsigned char type;    union {    vector float CPDA_x;    struct {      float color_x;      float position_x;      float direction_x;      float attn_x;    };  };  union {    vector float CPDA_y;    struct {      float color_y;      float position_y;      float direction_y;      float attn_y;    };  };  union {    vector float CPDA_z;    struct {      float color_z;      float position_z;      float direction_z;      float attn_z;    };  };  union {    vector float args_v;    struct {      float arg1;      float arg2;      float arg3;      float arg4;    };  };} __attribute__((aligned(16)));#define LIGHT_ILLUMINATION(name) \  void name(light &source, RGBPacket &rgbp, vector float &dirToLight_x, vector float &dirToLight_y, vector float &dirToLight_z, \	    vector float &distanceToLight, const vector float &p_x, const vector float &p_y, const vector float &p_z)#define LIGHT_ILLUMINATION_FP(name) LIGHT_ILLUMINATION((*name))LIGHT_ILLUMINATION(light_getIllumination);LIGHT_ILLUMINATION(light_getPointIllumination);LIGHT_ILLUMINATION(light_getDirectionalIllumination);LIGHT_ILLUMINATION(light_getSpotIllumination);typedef LIGHT_ILLUMINATION_FP(light_illumination);#endif 

⌨️ 快捷键说明

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