105 tex_matrix[0].X =
Scale.U;
106 tex_matrix[1].Y =
Scale.V;
129 float u_offset_per_sec = ini.
Get_Float(section,
"UPerSec", 0.0f);
130 float v_offset_per_sec = ini.
Get_Float(section,
"VPerSec", 0.0f);
133 float u_start_offset = ini.
Get_Float(section,
"UOffset", 0.0f);
134 float v_start_offset = ini.
Get_Float(section,
"VOffset", 0.0f);
160 float del = (float)delta;
183 tex_matrix[0].Z=offset_u;
184 tex_matrix[0].X=
Scale.X;
185 tex_matrix[1].Z=offset_v;
186 tex_matrix[1].Y=
Scale.Y;
207 float fps = ini.
Get_Float(section,
"FPS", 1.0f);
208 unsigned int gridwidth_log2 = ini.
Get_Int(section,
"Log2Width", 1);
255 float u_offset, v_offset;
263 tex_matrix[0].Z = u_offset;
264 tex_matrix[1].Z = v_offset;
274 unsigned int grid_width = (1 << gridwidth_log2);
287 }
else if (fps < 0.0f) {
289 MSPerFrame = (
unsigned int)(1000.0f / fabs(fps));
293 MSPerFrame = (
unsigned int)(1000.0f / fabs(fps));
331 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
333 RadiansPerMilliSec(rad_per_sec/1000.0f),
340 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
344 Center.U=ini.
Get_Float(section,
"UCenter",0.0f);
345 Center.V=ini.
Get_Float(section,
"VCenter",0.0f);
350 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
351 RadiansPerMilliSec(src.RadiansPerMilliSec),
366 unsigned int delta = now - LastUsedSyncTime;
367 LastUsedSyncTime=now;
369 CurrentAngle+=RadiansPerMilliSec * delta;
370 CurrentAngle=fmodf(CurrentAngle,2*
WWMATH_PI);
371 if (CurrentAngle<0.0f) CurrentAngle+=2*
WWMATH_PI;
383 tex_matrix[0].Set(
Scale.X * c, -
Scale.X * s, -
Scale.X * (c * Center.U - s * Center.V - Center.U), 0.0f);
384 tex_matrix[1].Set(
Scale.Y * s,
Scale.Y * c, -
Scale.Y * (s * Center.U + c * Center.V - Center.V), 0.0f);
391 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
400 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
403 UAFP.X = ini.
Get_Float(section,
"UAmp", 1.0f);
404 UAFP.Y = ini.
Get_Float(section,
"UFreq", 1.0f);
405 UAFP.Z = ini.
Get_Float(section,
"UPhase", 0.0f);
407 VAFP.X = ini.
Get_Float(section,
"VAmp", 1.0f);
408 VAFP.Y = ini.
Get_Float(section,
"VFreq", 1.0f);
409 VAFP.Z = ini.
Get_Float(section,
"VPhase", 0.0f);
414 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
430 unsigned int delta = now - LastUsedSyncTime;
431 LastUsedSyncTime=now;
433 const float ms_to_radians=2*
WWMATH_PI/1000.0f;
435 CurrentAngle+=delta*ms_to_radians;
437 float offset_u=UAFP.X*sin(UAFP.Y*CurrentAngle+UAFP.Z*
WWMATH_PI);
438 float offset_v=VAFP.X*sin(VAFP.Y*CurrentAngle+VAFP.Z*
WWMATH_PI);
445 tex_matrix[0].Z = offset_u;
446 tex_matrix[0].X =
Scale.X;
447 tex_matrix[1].Z = offset_v;
448 tex_matrix[1].Y =
Scale.Y;
454 float steps_per_sec,
bool clamp_fix,
const Vector2 &
scale,
unsigned int stage) :
456 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
458 StepsPerMilliSec(steps_per_sec/1000.0f),
459 CurrentStep(0.0f,0.0f),
467 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
468 CurrentStep(0.0f,0.0f),
471 Step.U = ini.
Get_Float(section,
"UStep", 0.0f);
472 Step.V = ini.
Get_Float(section,
"VStep", 0.0f);
473 StepsPerMilliSec = ini.
Get_Float(section,
"SPS", 0.0f)/1000.0f;
474 ClampFix = ini.
Get_Bool(section,
"ClampFix",
false);
479 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
481 StepsPerMilliSec(src.StepsPerMilliSec),
482 CurrentStep(0.0f,0.0f),
484 ClampFix(src.ClampFix)
491 CurrentStep.Set(0.0f,0.0f);
498 unsigned int delta = now - LastUsedSyncTime;
499 LastUsedSyncTime=now;
502 int num_steps=(int) (StepsPerMilliSec*Remainder);
506 CurrentStep+=Step*num_steps;
507 Remainder-=num_steps/(float)StepsPerMilliSec;
529 tex_matrix[0].Z = CurrentStep.U;
530 tex_matrix[0].X =
Scale.X;
531 tex_matrix[1].Z = CurrentStep.V;
532 tex_matrix[1].Y =
Scale.Y;
539 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
540 Speed(speed/1000.0f),
541 Period(period*1000.0f),
545 if (Period<0.0f) Period=-Period;
546 Half_Period=0.5f*Period;
551 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
554 Speed.U = ini.
Get_Float(section,
"UPerSec", 0.0f)/1000.0f;
555 Speed.V = ini.
Get_Float(section,
"VPerSec", 0.0f)/1000.0f;
556 Period = ini.
Get_Float(section,
"Period", 0.0f)*1000.0f;
557 if (Period<0.0f) Period=-Period;
558 Half_Period=0.5f*Period;
563 LastUsedSyncTime(
WW3D::Get_Sync_Time()),
566 Half_Period(src.Half_Period),
580 unsigned int delta = now - LastUsedSyncTime;
581 LastUsedSyncTime=now;
590 int num_periods=(int) (Remainder/Period);
591 Remainder-=num_periods*Period;
594 if (Remainder>Half_Period) {
595 time=Period-Remainder;
599 offset_u=Speed.U * time;
600 offset_v=Speed.V * time;
608 tex_matrix[0].Z = offset_u;
609 tex_matrix[0].X =
Scale.X;
610 tex_matrix[1].Z = offset_v;
611 tex_matrix[1].Y =
Scale.Y;
641 tex_matrix.
Init( 0.5f, 0.0f, 0.0f, 0.5f,
642 0.0f, 0.5f, 0.0f, 0.5f,
643 0.0f, 0.0f, 1.0f, 0.0f,
644 0.0f, 0.0f, 0.0f, 1.0f);
666 tex_matrix.
Init( 0.5f, 0.0f, 0.0f, 0.5f,
667 0.0f, 0.5f, 0.0f, 0.5f,
668 0.0f, 0.0f, 1.0f, 0.0f,
669 0.0f, 0.0f, 0.0f, 1.0f );
739 tex_matrix.
Init( 0.0f, 0.0f, 0.5f, 0.5f,
741 0.0f, 0.0f, 1.0f, 0.0f,
742 0.0f, 0.0f, 0.0f, 1.0f );
750 ini.
Get_String(section,
"Axis",
"Z", &temp[0], 2);
776 tex_matrix.
Init( 0.0f, 0.5f, 0.0f, 0.5f,
777 0.0f, 0.0f, 0.5f, 0.5f,
778 0.0f, 0.0f, 1.0f, 0.0f,
779 0.0f, 0.0f, 0.0f, 1.0f );
782 tex_matrix.
Init( 0.5f, 0.0f, 0.0f, 0.5f,
783 0.0f, 0.0f, 0.5f, 0.5f,
784 0.0f, 0.0f, 1.0f, 0.0f,
785 0.0f, 0.0f, 0.0f, 1.0f );
789 tex_matrix.
Init( 0.5f, 0.0f, 0.0f, 0.5f,
790 0.0f, 0.5f, 0.0f, 0.5f,
791 0.0f, 0.0f, 1.0f, 0.0f,
792 0.0f, 0.0f, 0.0f, 1.0f );
798 Matrix4x4 mat2( mat[0].X, mat[1].X, mat[2].X, 0.0f,
799 mat[0].Y, mat[1].Y, mat[2].Y, 0.0f,
800 mat[0].Z, mat[1].Z, mat[2].Z, 0.0f,
801 0.0f, 0.0f, 0.0f, 1.0f );
802 tex_matrix = tex_matrix * mat2;
853 float u_offset, v_offset;
858 tex_matrix.
Init( del, 0.0f, 0.0f, u_offset + del,
859 0.0f, del, 0.0f, v_offset + del,
860 0.0f, 0.0f, 1.0f, 0.0f,
861 0.0f, 0.0f, 0.0f, 1.0f );
882 float u_offset, v_offset;
887 tex_matrix.
Init( del, 0.0f, 0.0f, u_offset + del,
888 0.0f, del, 0.0f, v_offset + del,
889 0.0f, 0.0f, 1.0f, 0.0f,
890 0.0f, 0.0f, 0.0f, 1.0f );
910 float del = (float)delta;
931 tex_matrix[0] *=
Scale.X;
932 tex_matrix[1] *=
Scale.Y;
935 tex_matrix[0] += last;
936 last = tex_matrix[3];
938 tex_matrix[1] += last;
1001 if (num_frames!=0) {
1016 tex_matrix[0][0] = c *
Scale.X;
1017 tex_matrix[0][1] = -s *
Scale.Y;
1018 tex_matrix[1][0] = s *
Scale.X;
1019 tex_matrix[1][1] = c *
Scale.Y;
1024 uoff = fmodf(uoff, 1.0f);
1025 voff = fmodf(voff, 1.0f);
1026 tex_matrix[0].Z = uoff;
1027 tex_matrix[1].Z = voff;
1033 const Vector2 & offset_per_sec,
const Vector2 & start_offset,
bool clamp_fix,
1105 for (
int i = 0; i < num_obj; i++) {
1133 ini.
Get_String(section,
"Axis",
"Z", &temp[0], 2);
1158 Matrix4x4 mv ( mat[0].X, mat[1].X, mat[2].X, 0.0f,
1159 mat[0].Y, mat[1].Y, mat[2].Y, 0.0f,
1160 mat[0].Z, mat[1].Z, mat[2].Z, 0.0f,
1161 0.0f, 0.0f, 0.0f, 1.0f );
1165 float u_offset, v_offset;
1174 md.
Init( 0.0f, del, 0.0f, u_offset + del,
1175 0.0f, 0.0f, del, v_offset + del,
1176 0.0f, 0.0f, 1.0f, 0.0f,
1177 0.0f, 0.0f, 0.0f, 1.0f );
1180 md.
Init( del, 0.0f, 0.0f, u_offset + del,
1181 0.0f, 0.0f, del, v_offset + del,
1182 0.0f, 0.0f, 1.0f, 0.0f,
1183 0.0f, 0.0f, 0.0f, 1.0f );
1187 md.
Init( del, 0.0f, 0.0f, u_offset + del,
1188 0.0f, del, 0.0f, v_offset + del,
1189 0.0f, 0.0f, 1.0f, 0.0f,
1190 0.0f, 0.0f, 0.0f, 1.0f );
1197 tex_matrix = md * mv;
Color scale(const Color &a, const Color &b)
BumpEnvTextureMapperClass(float rad_per_sec, float scale_factor, const Vector2 &offset_per_sec, const Vector2 &start_offset, bool clamp_fix, const Vector2 &scale, unsigned int stage)
unsigned int LastUsedSyncTime
virtual void Apply(int uv_array_index)
virtual void Apply(int uv_array_index)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
static void Set_DX8_Texture_Stage_State(unsigned stage, D3DTEXTURESTAGESTATETYPE state, unsigned value)
static void Get_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4 &m)
static void Set_Transform(D3DTRANSFORMSTATETYPE transform, const Matrix4x4 &m)
unsigned int LastUsedSyncTime
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)
EdgeMapperClass(unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)
virtual void Apply(int uv_array_index)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)
void update_temporal_state(void)
virtual void Apply(int uv_array_index)
void initialize(float fps, unsigned int gridwidth_log2)
void calculate_uv_offset(float *u_offset, float *v_offset)
unsigned int GridWidthLog2
void Set_Frame_Per_Second(float fps)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
unsigned int CurrentFrame
unsigned int LastUsedSyncTime
GridTextureMapperClass(float fps, unsigned int gridwidth_log2, unsigned int last_frame, unsigned int offset, unsigned int stage)
virtual void Apply(int uv_array_index)
GridWSClassicEnvironmentMapperClass(float fps, unsigned int gridwidth_log2, unsigned int last_frame, unsigned int offset, AxisType axis, unsigned int stage)
GridWSEnvMapperClass(float fps, unsigned int gridwidth_log2, unsigned int last_frame, unsigned int offset, AxisType axis, unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)
GridWSEnvironmentMapperClass(float fps, unsigned int gridwidth_log2, unsigned int last_frame, unsigned int offset, AxisType axis, unsigned int stage)
float Get_Float(char const *section, char const *entry, float defvalue=0.0f) const
bool Get_Bool(char const *section, char const *entry, bool defvalue=false) const
int Get_Int(char const *section, char const *entry, int defvalue=0) const
int Get_String(char const *section, char const *entry, char const *defvalue, char *buffer, int size) const
Vector2 UVOffsetDeltaPerMS
void Set_Current_UV_Offset(const Vector2 &cur)
LinearOffsetTextureMapperClass(const Vector2 &offset_per_sec, const Vector2 &start_offset, bool clamp_fix, const Vector2 &scale, unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
unsigned int LastUsedSyncTime
bool Has_Time_Variant_Texture_Mappers(void)
void Make_Vertex_Materials_Unique(void)
void Reset_Texture_Mappers(void)
WWINLINE void Init(const Matrix3D &m)
WWINLINE void Make_Identity(void)
void Make_Unique(bool force_meshmdl_clone=false)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
unsigned int LastUsedSyncTime
RandomTextureMapperClass(float fps, const Vector2 &scale, unsigned int stage)
WWINLINE void Release_Ref(void) const
virtual int Class_ID(void) const
virtual int Get_Num_Sub_Objects(void) const
virtual MaterialInfoClass * Get_Material_Info(void)
virtual RenderObjClass * Get_Sub_Object(int index) const
RotateTextureMapperClass(float rad_per_sec, const Vector2 ¢er, const Vector2 &scale, unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
ScaleTextureMapperClass(const Vector2 &scale, unsigned int stage)
virtual void Apply(int uv_array_index)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)
SineLinearOffsetTextureMapperClass(const Vector3 &uafp, const Vector3 &vafp, const Vector2 &scale, unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
StepLinearOffsetTextureMapperClass(const Vector2 &step, float steps_per_sec, bool clamp_fix, const Vector2 &scale, unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)=0
TextureMapperClass(unsigned int stage=0)
virtual void Apply(int uv_array_index)
WSEnvMapperClass(AxisType axis, unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
virtual void Apply(int uv_array_index)
static unsigned int Get_Sync_Time(void)
static WWINLINE float Fast_Sin(float val)
static float Clamp(float val, float min=0.0f, float max=1.0f)
static WWINLINE float Fast_Cos(float val)
static float Sin(float val)
static float Floor(float val)
static float Cos(float val)
ZigZagLinearOffsetTextureMapperClass(const Vector2 &speed, float period, const Vector2 &scale, unsigned int stage)
virtual void Calculate_Texture_Matrix(Matrix4x4 &tex_matrix)
void Reset_All_Texture_Mappers(RenderObjClass *robj, bool make_unique)