00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /*************************************************************************** 00003 * parameter.h 00004 * 00005 * Sun Jan 2 17:13:36 CET 2005 00006 * Copyright 2004 Jesper Fruergaard and Bent Bisballe 00007 * {deva,jesper}@daimi.au.dk 00008 ****************************************************************************/ 00009 00010 /* 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef __LIBGPU_PARAMETER_H__ 00027 #define __LIBGPU_PARAMETER_H__ 00028 00029 #include "cgstuff.h" 00030 #include "types.h" 00031 00032 #include "texture.h" 00033 class Texture; 00034 00035 typedef union { 00036 float1 f1; 00037 float2 f2; 00038 float3 f3; 00039 float4 f4; 00040 00041 float1x1* f1x1; 00042 float2x1* f2x1; 00043 float3x1* f3x1; 00044 float4x1* f4x1; 00045 00046 float1x2* f1x2; 00047 float2x2* f2x2; 00048 float3x2* f3x2; 00049 float4x2* f4x2; 00050 00051 float1x3* f1x3; 00052 float2x3* f2x3; 00053 float3x3* f3x3; 00054 float4x3* f4x3; 00055 00056 float1x4* f1x4; 00057 float2x4* f2x4; 00058 float3x4* f3x4; 00059 float4x4* f4x4; 00060 00061 float1* f1v; 00062 float2* f2v; 00063 float3* f3v; 00064 float4* f4v; 00065 00066 Texture *t; 00067 } parameterValue; 00068 00071 class Parameter { 00072 friend class Program; 00073 public: 00077 void set(float x); 00078 00083 void set(float x, float y); 00084 00087 void set(float x, float y, float z); 00090 void set(float x, float y, float z, float w); 00091 00094 void set(float1* x); 00097 void set(float2* x); 00100 void set(float3* x); 00103 void set(float4* x); 00104 00107 void set(float1x1* x); 00110 void set(float2x1* x); 00113 void set(float3x1* x); 00116 void set(float4x1* x); 00117 00120 void set(float1x2* x); 00123 void set(float2x2* x); 00126 void set(float3x2* x); 00129 void set(float4x2* x); 00130 00133 void set(float1x3* x); 00136 void set(float2x3* x); 00139 void set(float3x3* x); 00142 void set(float4x3* x); 00143 00146 void set(float1x4* x); 00149 void set(float2x4* x); 00152 void set(float3x4* x); 00155 void set(float4x4* x); 00156 00160 void set(Texture* t); 00161 00162 private: 00163 Parameter(CGparameter _param); 00164 ~Parameter(); 00165 00166 void load(); 00167 00168 const char* getName(); 00169 00170 parameterValue value; 00171 CGparameter param; 00172 }; 00173 00174 #endif/*__LIBGPU_PARAMETER_H__*/