OpenClonk
StdMeshMaterialTextureUnit::Transformation Struct Reference

#include <StdMeshMaterial.h>

Public Types

enum  Type {
  T_SCROLL, T_SCROLL_ANIM, T_ROTATE, T_ROTATE_ANIM,
  T_SCALE, T_TRANSFORM, T_WAVE_XFORM
}
 
enum  XFormType {
  XF_SCROLL_X, XF_SCROLL_Y, XF_ROTATE, XF_SCALE_X,
  XF_SCALE_Y
}
 
enum  WaveType {
  W_SINE, W_TRIANGLE, W_SQUARE, W_SAWTOOTH,
  W_INVERSE_SAWTOOTH
}
 

Public Member Functions

double GetScrollX (double t) const
 
double GetScrollY (double t) const
 
double GetRotate (double t) const
 
double GetWaveXForm (double t) const
 

Public Attributes

Type TransformType
 
union {
   struct {
float X
 
float Y
 
   } Scroll
 
   struct {
float XSpeed
 
float YSpeed
 
   } ScrollAnim
 
   struct {
float Angle
 
   } Rotate
 
   struct {
float RevsPerSec
 
   } RotateAnim
 
   struct {
float X
 
float Y
 
   } Scale
 
   struct {
float M [16]
 
   } Transform
 
   struct {
XFormType XForm
 
WaveType Wave
 
float Base
 
float Frequency
 
float Phase
 
float Amplitude
 
   } WaveXForm
 
}; 
 

Detailed Description

Definition at line 248 of file StdMeshMaterial.h.

Member Enumeration Documentation

◆ Type

◆ WaveType

◆ XFormType

Member Function Documentation

◆ GetRotate()

double StdMeshMaterialTextureUnit::Transformation::GetRotate ( double  t) const
inline

Definition at line 294 of file StdMeshMaterial.h.

◆ GetScrollX()

double StdMeshMaterialTextureUnit::Transformation::GetScrollX ( double  t) const
inline

◆ GetScrollY()

double StdMeshMaterialTextureUnit::Transformation::GetScrollY ( double  t) const
inline

◆ GetWaveXForm()

double StdMeshMaterialTextureUnit::Transformation::GetWaveXForm ( double  t) const

Definition at line 940 of file StdMeshMaterial.cpp.

941 {
942  assert(TransformType == T_WAVE_XFORM);
943  const double val = fmod(WaveXForm.Frequency * t + WaveXForm.Phase, 1.0);
944  switch (WaveXForm.Wave)
945  {
946  case W_SINE: return WaveXForm.Base + WaveXForm.Amplitude*0.5*(1.0 + sin(val * 2.0 * M_PI));
947  case W_TRIANGLE: if (val < 0.5) return WaveXForm.Base + WaveXForm.Amplitude*2.0*val; else return WaveXForm.Base + WaveXForm.Amplitude*2.0*(1.0 - val);
948  case W_SQUARE: if (val < 0.5) return WaveXForm.Base; else return WaveXForm.Base + WaveXForm.Amplitude;
949  case W_SAWTOOTH: return WaveXForm.Base + WaveXForm.Amplitude*val;
950  case W_INVERSE_SAWTOOTH: return WaveXForm.Base + WaveXForm.Amplitude*(1.0-val);
951  default: assert(false); return 0.0;
952  }
953 }

Member Data Documentation

◆ @53

union { ... }

◆ TransformType

Type StdMeshMaterialTextureUnit::Transformation::TransformType

Definition at line 279 of file StdMeshMaterial.h.

Referenced by StdMeshMaterialTextureUnit::Load().


The documentation for this struct was generated from the following files: