OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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 251 of file StdMeshMaterial.h.

Member Enumeration Documentation

Member Function Documentation

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

Definition at line 297 of file StdMeshMaterial.h.

References T_ROTATE_ANIM.

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

Definition at line 957 of file StdMeshMaterial.cpp.

References T_WAVE_XFORM, TransformType, W_INVERSE_SAWTOOTH, W_SAWTOOTH, W_SINE, W_SQUARE, and W_TRIANGLE.

958 {
959  assert(TransformType == T_WAVE_XFORM);
960  const double val = fmod(WaveXForm.Frequency * t + WaveXForm.Phase, 1.0);
961  switch (WaveXForm.Wave)
962  {
963  case W_SINE: return WaveXForm.Base + WaveXForm.Amplitude*0.5*(1.0 + sin(val * 2.0 * M_PI));
964  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);
965  case W_SQUARE: if (val < 0.5) return WaveXForm.Base; else return WaveXForm.Base + WaveXForm.Amplitude;
966  case W_SAWTOOTH: return WaveXForm.Base + WaveXForm.Amplitude*val;
967  case W_INVERSE_SAWTOOTH: return WaveXForm.Base + WaveXForm.Amplitude*(1.0-val);
968  default: assert(false); return 0.0;
969  }
970 }

Member Data Documentation

union { ... }
Type StdMeshMaterialTextureUnit::Transformation::TransformType

Definition at line 282 of file StdMeshMaterial.h.

Referenced by GetWaveXForm(), and StdMeshMaterialTextureUnit::Load().


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