[2269] | 1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | //
|
---|
| 3 | // ## ######
|
---|
| 4 | // ###### ###
|
---|
| 5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
| 6 | // ########## # # #
|
---|
| 7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
| 8 | // ######### # # # All rights reserved.
|
---|
| 9 | // ## ##########
|
---|
| 10 | // ##
|
---|
| 11 | //
|
---|
| 12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 13 |
|
---|
| 14 | //@cpp
|
---|
| 15 |
|
---|
| 16 | #ifndef GTP_SHADER_CAUSTICCUBE_H
|
---|
| 17 | #define GTP_SHADER_CAUSTICCUBE_H
|
---|
| 18 |
|
---|
| 19 | #include "../../interf/eng_gfxvar.h"
|
---|
| 20 | #include "../../interf/eng_shader.h"
|
---|
| 21 | #include "../../interf/eng_shaderenv.h"
|
---|
| 22 | #include "../../util/eng_util_shaderdest.h"
|
---|
| 23 | #include "../../util/eng_util_shaderexec.h"
|
---|
| 24 | #include "../../../comp/core/comp_setup.h"
|
---|
| 25 | #include "../../../comp/util/comp_util_uniquebase.h"
|
---|
| 26 | #include "../../../util/mempool/util_mempool_array_types.h"
|
---|
| 27 |
|
---|
| 28 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 29 |
|
---|
| 30 | struct gtp_Shader_CausticCubeDestGfx
|
---|
| 31 | {
|
---|
| 32 | s3d_CDrvVarSlot m_FromVarSlot;
|
---|
| 33 | s3d_CDrvVarSlot m_ToVarSlot;
|
---|
| 34 | int m_TexProp;
|
---|
| 35 | };
|
---|
| 36 |
|
---|
| 37 | typedef s3d_CUtilArray<gtp_Shader_CausticCubeDestGfx>
|
---|
| 38 | gtp_Shader_CausticCubeDestGfxArray;
|
---|
| 39 |
|
---|
| 40 | typedef const gtp_Shader_CausticCubeDestGfxArray &
|
---|
| 41 | gtp_Shader_CausticCubeDestGfxArray_cr;
|
---|
| 42 |
|
---|
| 43 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 44 |
|
---|
| 45 | class gtp_Shader_CausticCubeGfx;
|
---|
| 46 |
|
---|
| 47 | //@
|
---|
| 48 | typedef s3d_CUtilKeyEntry<s3d_CEngGfxCtxPtr, gtp_Shader_CausticCubeGfx*>
|
---|
| 49 | gtp_Shader_CausticCubeGfxEntry;
|
---|
| 50 |
|
---|
| 51 | //@
|
---|
| 52 | typedef s3d_CUtilTree<gtp_Shader_CausticCubeGfxEntry>
|
---|
| 53 | gtp_Shader_CausticCubeGfxTree;
|
---|
| 54 |
|
---|
| 55 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 56 |
|
---|
| 57 | struct gtp_Shader_CausticCubeData: s3d_CUtilPtrBase
|
---|
| 58 | {
|
---|
| 59 | s3d_CUtilStr m_Info;
|
---|
| 60 | s3d_CUtilAtomArray m_MethodArray;
|
---|
| 61 | s3d_CUtilStr m_RankInfo;
|
---|
| 62 | int m_Rank;
|
---|
| 63 | int m_IterStart;
|
---|
| 64 | int m_IterEnd;
|
---|
| 65 | int m_IterStep;
|
---|
| 66 | float m_IterWidthScale;
|
---|
| 67 | float m_IterHeightScale;
|
---|
| 68 | int m_DestProp;
|
---|
| 69 | float m_WidthScale;
|
---|
| 70 | float m_HeightScale;
|
---|
| 71 | s3d_CUtilStr m_TaskInfoVarInfo;
|
---|
| 72 | s3d_CUtilAtomPtr m_TaskInfoVarAtom;
|
---|
| 73 | s3d_CUtilStr m_SrcVarInfo;
|
---|
| 74 | s3d_CUtilAtomArray m_SrcVarAtomArray;
|
---|
| 75 | s3d_CEngUtilShaderDest m_Dest;
|
---|
| 76 | s3d_CUtilStr m_ProgInfo;
|
---|
| 77 | s3d_CUtilStr m_ProgIdent;
|
---|
| 78 | s3d_CUtilStr m_ProgParamInfo;
|
---|
| 79 | s3d_CUtilAtomPairArray m_ProgParamMapArray;
|
---|
| 80 |
|
---|
| 81 | int m_UpdateInterval;
|
---|
| 82 | int m_StartFrame;
|
---|
| 83 | bool m_UpdateAllFace;
|
---|
| 84 | bool m_UsePoints;
|
---|
| 85 | int m_PhotonCount;
|
---|
| 86 | };
|
---|
| 87 |
|
---|
| 88 | typedef s3d_CUtilPtr<gtp_Shader_CausticCubeData>
|
---|
| 89 | gtp_Shader_CausticCubeDataPtr;
|
---|
| 90 |
|
---|
| 91 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 92 |
|
---|
| 93 | //@
|
---|
| 94 | class gtp_Shader_CausticCube
|
---|
| 95 | : public s3d_CEngShader,
|
---|
| 96 | public s3d_CCompUtilUniqueBase,
|
---|
| 97 | public s3d_CCompSetup
|
---|
| 98 | {
|
---|
| 99 | public:
|
---|
| 100 | S3D_UTIL_RTTI_TABLE_DECLARE
|
---|
| 101 |
|
---|
| 102 | //@
|
---|
| 103 | gtp_Shader_CausticCube();
|
---|
| 104 |
|
---|
| 105 | //@
|
---|
| 106 | void SetupInit(
|
---|
| 107 | s3d_CUtilMsgHandler *MsgHandler, s3d_CUtilStr_cr Info,
|
---|
| 108 | s3d_CCompSuppl *FetchSuppl, s3d_CUtilSnkChunk *Param);
|
---|
| 109 |
|
---|
| 110 | //@
|
---|
| 111 | void SetupDone();
|
---|
| 112 |
|
---|
| 113 | //@
|
---|
| 114 | s3d_CUtilStr GetInfo();
|
---|
| 115 |
|
---|
| 116 | //@
|
---|
| 117 | void RegisterNotif(s3d_CUtilNotifRecip *Recip);
|
---|
| 118 |
|
---|
| 119 | //@
|
---|
| 120 | s3d_CEngShaderGfxPtr FindShaderGfx(
|
---|
| 121 | s3d_CUtilNotifGather *NotifGather, s3d_CEngGfxCtx *GfxCtx);
|
---|
| 122 |
|
---|
| 123 | private:
|
---|
| 124 | s3d_CEngShaderEnvPtr m_ShaderEnv;
|
---|
| 125 | gtp_Shader_CausticCubeGfxTree m_ShaderGfxTree;
|
---|
| 126 | gtp_Shader_CausticCubeDataPtr m_Data;
|
---|
| 127 |
|
---|
| 128 | friend class gtp_Shader_CausticCubeGfx;
|
---|
| 129 | friend class gtp_Shader_CausticCubeInst;
|
---|
| 130 | };
|
---|
| 131 |
|
---|
| 132 | //@
|
---|
| 133 | typedef s3d_CUtilPtr<gtp_Shader_CausticCube>
|
---|
| 134 | gtp_Shader_CausticCubePtr;
|
---|
| 135 |
|
---|
| 136 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 137 |
|
---|
| 138 | //@
|
---|
| 139 | class gtp_Shader_CausticCubeGfx: public s3d_CEngShaderGfx
|
---|
| 140 | {
|
---|
| 141 | public:
|
---|
| 142 | //@
|
---|
| 143 | gtp_Shader_CausticCubeGfx(
|
---|
| 144 | s3d_CEngShaderEnv *ShaderEnv,
|
---|
| 145 | s3d_CUtilNotifGather *NotifGather,
|
---|
| 146 | s3d_CEngGfxCtx *GfxCtx,
|
---|
| 147 | gtp_Shader_CausticCubeData *Data);
|
---|
| 148 |
|
---|
| 149 | //@
|
---|
| 150 | gtp_Shader_CausticCubeGfxTree::CNode *GetNode();
|
---|
| 151 |
|
---|
| 152 | //@
|
---|
| 153 | void RegisterNotif(s3d_CUtilNotifRecip *Recip);
|
---|
| 154 |
|
---|
| 155 | //@
|
---|
| 156 | void ExtractGfx();
|
---|
| 157 |
|
---|
| 158 | //@
|
---|
| 159 | bool IsValid();
|
---|
| 160 |
|
---|
| 161 | //@
|
---|
| 162 | void LinkCollect(s3d_CUtilAtomSet &VarAtomSet);
|
---|
| 163 |
|
---|
| 164 | //@
|
---|
| 165 | void LinkAppoint(s3d_CDrvVarDecl *VarDecl);
|
---|
| 166 |
|
---|
| 167 | //@
|
---|
| 168 | s3d_CEngShaderInstPtr CreateShaderInst(
|
---|
| 169 | s3d_CEngShaderHead *Head);
|
---|
| 170 |
|
---|
| 171 | private:
|
---|
| 172 | gtp_Shader_CausticCubeGfxTree::CNode m_Node;
|
---|
| 173 | s3d_CEngShaderEnvPtr m_ShaderEnv;
|
---|
| 174 | gtp_Shader_CausticCubeDataPtr m_Data;
|
---|
| 175 |
|
---|
| 176 | // ShaderGfx-Data Variables:
|
---|
| 177 | s3d_CEngGfxProgPtr m_GfxProg;
|
---|
| 178 | s3d_CDrvVarSlotArray m_SrcVarSlotArray;
|
---|
| 179 | s3d_CEngUtilShaderDestGfx m_FilterDestGfx;
|
---|
| 180 | s3d_CDrvVarSlotInit m_TaskInfoVarSlot;
|
---|
| 181 | s3d_CDrvVarDeclPtr m_ProgParamDecl;
|
---|
| 182 |
|
---|
| 183 | friend class gtp_Shader_CausticCubeInst;
|
---|
| 184 | };
|
---|
| 185 |
|
---|
| 186 | //@
|
---|
| 187 | typedef s3d_CUtilPtr<gtp_Shader_CausticCubeGfx>
|
---|
| 188 | gtp_Shader_CausticCubeGfxPtr;
|
---|
| 189 |
|
---|
| 190 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 191 |
|
---|
| 192 | //@
|
---|
| 193 |
|
---|
| 194 | class gtp_Shader_CausticCubeInst
|
---|
| 195 | : public s3d_CEngShaderInst,
|
---|
| 196 | public s3d_CEngShaderExec
|
---|
| 197 | {
|
---|
| 198 | public:
|
---|
| 199 | //@
|
---|
| 200 | gtp_Shader_CausticCubeInst(
|
---|
| 201 | s3d_CEngShaderEnv *ShaderEnv,
|
---|
| 202 | s3d_CEngGfxCtx *GfxCtx,
|
---|
| 203 | gtp_Shader_CausticCubeGfx *ShaderGfx,
|
---|
| 204 | s3d_CEngGfxProg *GfxProg);
|
---|
| 205 |
|
---|
| 206 | //@
|
---|
| 207 | void RegisterNotif(s3d_CUtilNotifRecip *Recip);
|
---|
| 208 |
|
---|
| 209 | //@
|
---|
| 210 | void SetShaderCtx(s3d_CEngShaderCtx *ShaderCtx);
|
---|
| 211 |
|
---|
| 212 | //@
|
---|
| 213 | void SetGfxState(s3d_CEngGfxState *GfxState);
|
---|
| 214 |
|
---|
| 215 | //@
|
---|
| 216 | void SetPos(s3d_CEngPos *Pos);
|
---|
| 217 |
|
---|
| 218 | //@
|
---|
| 219 | void SetModel(s3d_CEngModel *Model);
|
---|
| 220 |
|
---|
| 221 | //@
|
---|
| 222 | void ArrangeCollect(
|
---|
| 223 | s3d_CUtilMemPool *MemPool,
|
---|
| 224 | s3d_CEngShaderScopeArray &ScopeArray);
|
---|
| 225 |
|
---|
| 226 | //@
|
---|
| 227 | void ArrangeInit(
|
---|
| 228 | s3d_CUtilMemPool *MemPool,
|
---|
| 229 | s3d_CEngShaderScopeArray_cr ScopeArray);
|
---|
| 230 |
|
---|
| 231 | //@
|
---|
| 232 | void ArrangePerform(
|
---|
| 233 | s3d_CUtilMemPool *MemPool,
|
---|
| 234 | s3d_CEngShaderScopeArray_cr ScopeArray);
|
---|
| 235 |
|
---|
| 236 | //@
|
---|
| 237 | void ArrangeFeedback(
|
---|
| 238 | s3d_CUtilMemPool *MemPool,
|
---|
| 239 | s3d_CEngShaderScopeArray_cr ScopeArray);
|
---|
| 240 |
|
---|
| 241 | //@
|
---|
| 242 | void ArrangeGather(
|
---|
| 243 | s3d_CEngShaderExecArray &ExecArray);
|
---|
| 244 |
|
---|
| 245 | //@
|
---|
| 246 | void ShaderExecPerform(
|
---|
| 247 | s3d_CEngShaderScope *Scope,
|
---|
| 248 | s3d_CUtilAtom *Method,
|
---|
| 249 | s3d_CEngGfxTaskArray &TaskArray);
|
---|
| 250 |
|
---|
| 251 | //@
|
---|
| 252 | void *GfxElemJobExec(
|
---|
| 253 | s3d_CEngShaderScope *Scope,
|
---|
| 254 | void *GfxMark);
|
---|
| 255 |
|
---|
| 256 | private:
|
---|
| 257 | int m_FrameCount;
|
---|
| 258 | int m_CurrentFace;
|
---|
| 259 |
|
---|
| 260 | s3d_CEngShaderEnvPtr m_ShaderEnv;
|
---|
| 261 | s3d_CEngGfxCtxPtr m_GfxCtx;
|
---|
| 262 | gtp_Shader_CausticCubeGfxPtr m_ShaderGfx;
|
---|
| 263 | s3d_CEngGfxProgPtr m_GfxProg;
|
---|
| 264 |
|
---|
| 265 | void Iteration(
|
---|
| 266 | s3d_CEngShaderScope *Scope, int Iter,
|
---|
| 267 | int DestProp, float WantWidth, float WantHeight);
|
---|
| 268 |
|
---|
| 269 |
|
---|
| 270 | void FetchSrcArray(
|
---|
| 271 | s3d_CUtilMemPool *MemPool, s3d_CEngShaderScope *Scope,
|
---|
| 272 | const s3d_CSysChar *Info,
|
---|
| 273 | s3d_CEngGfxVarTexChanArray &FilterSrcTexArray,
|
---|
| 274 | s3d_CDrvVarSlotArray &SrcVarSlotArray);
|
---|
| 275 |
|
---|
| 276 | void CalcSrcTexSize(
|
---|
| 277 | s3d_CUtilMemPool *MemPool, s3d_CEngShaderScope *Scope,
|
---|
| 278 | s3d_CDrvGfxEng *GfxEng, int &Width, int &Height,
|
---|
| 279 | s3d_CEngGfxVarTexChanArray &FilterSrcTexArray);
|
---|
| 280 | };
|
---|
| 281 |
|
---|
| 282 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 283 |
|
---|
| 284 | #endif
|
---|