mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-29 21:25:54 +01:00
24cb244d43
This was a _ton_ of changes, made 15 years ago, so there are probably some problems to work out still. Among others: Engine/Base/Stream.* was mostly abandoned and will need to be re-ported. Still, this is a pretty good start, and probably holds a world record for lines of changes or something. :)
114 lines
3.6 KiB
C++
114 lines
3.6 KiB
C++
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
|
|
|
|
#ifndef SE_INCL_TEXTUREEFFECTS_H
|
|
#define SE_INCL_TEXTUREEFFECTS_H
|
|
#ifdef PRAGMA_ONCE
|
|
#pragma once
|
|
#endif
|
|
|
|
#include <Engine/Templates/StaticArray.h>
|
|
#include <Engine/Templates/DynamicArray.h>
|
|
#include <Engine/Base/Updateable.h>
|
|
#include <Engine/Base/Stream.h>
|
|
|
|
struct TextureEffectPixel {
|
|
char tepp_achDummy[8];
|
|
};
|
|
|
|
static __forceinline CTStream &operator>>(CTStream &strm, TextureEffectPixel &t) {
|
|
strm.Read_t(t.tepp_achDummy, sizeof (t.tepp_achDummy)); // char[8]
|
|
return(strm);
|
|
}
|
|
|
|
static __forceinline CTStream &operator<<(CTStream &strm, const TextureEffectPixel &t) {
|
|
strm.Write_t(t.tepp_achDummy, sizeof (t.tepp_achDummy)); // char[8]
|
|
return(strm);
|
|
}
|
|
|
|
|
|
struct TextureEffectSourceProperties {
|
|
char tesp_achDummy[64];
|
|
};
|
|
|
|
static __forceinline CTStream &operator>>(CTStream &strm, TextureEffectSourceProperties &t) {
|
|
strm.Read_t(t.tesp_achDummy, sizeof (t.tesp_achDummy)); // char[64]
|
|
return(strm);
|
|
}
|
|
|
|
static __forceinline CTStream &operator<<(CTStream &strm, const TextureEffectSourceProperties &t) {
|
|
strm.Write_t(t.tesp_achDummy, sizeof (t.tesp_achDummy)); // char[64]
|
|
return(strm);
|
|
}
|
|
|
|
class CTextureEffectSource {
|
|
public:
|
|
class CTextureEffectGlobal *tes_ptegGlobalEffect; // global effect of this effect source
|
|
inline void Clear(void) {};
|
|
ULONG tes_ulEffectSourceType; // effect source type
|
|
struct TextureEffectSourceProperties tes_tespEffectSourceProperties;
|
|
CStaticArray<struct TextureEffectPixel> tes_atepPixels;
|
|
|
|
// Initialize the texture effect source.
|
|
void Initialize(
|
|
class CTextureEffectGlobal *ptegGlobalEffect,ULONG ulEffectSourceType,
|
|
PIX pixU0, PIX pixV0, PIX pixU1, PIX pixV1);
|
|
// Animate the texture effect source.
|
|
void Animate(void);
|
|
};
|
|
|
|
class CTextureEffectGlobal {
|
|
public:
|
|
CTextureData *teg_ptdTexture; // texture of this global effect
|
|
ULONG teg_ulEffectType;
|
|
CUpdateable teg_updTexture; // when the texture was last updated
|
|
CDynamicArray<CTextureEffectSource> teg_atesEffectSources;
|
|
|
|
// Constructor.
|
|
CTextureEffectGlobal(CTextureData *ptdTexture, ULONG ulGlobalEffect);
|
|
|
|
// Add a new effect source.
|
|
ENGINE_API void AddEffectSource( ULONG ulEffectSourceType, PIX pixU0, PIX pixV0,
|
|
PIX pixU1, PIX pixV1);
|
|
// animate effect texture
|
|
void Animate(void);
|
|
// render effect texture in required mip level
|
|
void Render( INDEX iWantedMipLevel, PIX pixTexWidth, PIX pixTexHeight);
|
|
|
|
// get effect type (true if water type effect, false if plasma or fire effect)
|
|
BOOL IsWater(void);
|
|
// returns number of second it took to render effect texture
|
|
ENGINE_API DOUBLE GetRenderingTime(void);
|
|
};
|
|
|
|
struct TextureEffectSourceType {
|
|
char *test_strName; // name used for browsing
|
|
void (*test_Initialize)(CTextureEffectSource *ptes,
|
|
PIX pixU0, PIX pixV0, PIX pixU1, PIX pixV1); // function for initalization of a new effect source
|
|
void (*test_Animate)(CTextureEffectSource *ptes); // function for animation of one effect source
|
|
};
|
|
|
|
struct TextureEffectGlobalType {
|
|
char *tegt_strName; // name used for browsing
|
|
void (*tegt_Initialize)(void);
|
|
void (*tegt_Animate)(void);
|
|
|
|
// all types of effect sources
|
|
INDEX tet_ctEffectSourceTypes;
|
|
struct TextureEffectSourceType *tet_atestEffectSourceTypes;
|
|
};
|
|
|
|
struct TextureEffectGlobalProperties_Water {
|
|
UBYTE tegpw_ubPhong; // 0 for no phong
|
|
};
|
|
|
|
struct TextureEffectGlobalProperties_Fire {
|
|
UBYTE tegpw_ubRising; // 0 for no rising
|
|
};
|
|
|
|
ENGINE_API extern INDEX _ctTextureEffectGlobalPresets;
|
|
ENGINE_API extern struct TextureEffectGlobalType _ategtTextureEffectGlobalPresets[];
|
|
|
|
|
|
#endif /* include-once check. */
|
|
|