OpenClonk
C4ValueProviderSinV Class Reference

#include <C4MeshAnimation.h>

Inheritance diagram for C4ValueProviderSinV:
[legend]
Collaboration diagram for C4ValueProviderSinV:
[legend]

Public Member Functions

 C4ValueProviderSinV ()
 
 C4ValueProviderSinV (C4Object *object, C4Real begin, C4Real end, C4Real offset)
 
bool Execute () override
 
void CompileFunc (StdCompiler *pComp) override
 
void DenumeratePointers () override
 
void ClearPointers (C4Object *pObj) override
 

Static Public Member Functions

static const IDBaseLookup (const char *name)
 
static const IDBaseLookup (const std::type_info &type)
 

Public Attributes

C4Real Value
 

Detailed Description

Definition at line 302 of file C4MeshAnimation.h.

Constructor & Destructor Documentation

◆ C4ValueProviderSinV() [1/2]

C4ValueProviderSinV::C4ValueProviderSinV ( )
inline

Definition at line 305 of file C4MeshAnimation.h.

305 : Object(nullptr), Begin(Fix0), End(Fix0), Offset(Fix0) {}
const C4Real Fix0
Definition: C4Real.h:312

◆ C4ValueProviderSinV() [2/2]

C4ValueProviderSinV::C4ValueProviderSinV ( C4Object object,
C4Real  begin,
C4Real  end,
C4Real  offset 
)

Definition at line 655 of file C4MeshAnimation.cpp.

655  :
656  Object(object), Begin(begin), End(end), Offset(offset)
657 {
658  Execute();
659 }
bool Execute() override

References Execute().

Here is the call graph for this function:

Member Function Documentation

◆ ClearPointers()

void C4ValueProviderSinV::ClearPointers ( C4Object pObj)
inlineoverridevirtual

Reimplemented from StdMeshInstance::SerializableValueProvider.

Definition at line 311 of file C4MeshAnimation.h.

311 { if(Object == pObj) Object = nullptr; }

◆ CompileFunc()

void C4ValueProviderSinV::CompileFunc ( StdCompiler pComp)
overridevirtual

Reimplemented from StdMeshInstance::SerializableValueProvider.

Definition at line 674 of file C4MeshAnimation.cpp.

675 {
677  pComp->Separator();
678  pComp->Value(Object);
679  pComp->Separator();
680  pComp->Value(Begin);
681  pComp->Separator();
682  pComp->Value(End);
683  pComp->Separator();
684  pComp->Value(Offset);
685 }
void CompileFunc(C4Real &rValue, StdCompiler *pComp)
Definition: C4Real.cpp:9033
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:119
void Value(const T &rStruct)
Definition: StdCompiler.h:161

References CompileFunc(), StdCompiler::Separator(), and StdCompiler::Value().

Here is the call graph for this function:

◆ DenumeratePointers()

void C4ValueProviderSinV::DenumeratePointers ( )
inlineoverridevirtual

Reimplemented from StdMeshInstance::SerializableValueProvider.

Definition at line 310 of file C4MeshAnimation.h.

310 { Object.DenumeratePointers(); }
void DenumeratePointers()
Definition: C4ObjectPtr.cpp:49

References C4ObjectPtr::DenumeratePointers().

Here is the call graph for this function:

◆ Execute()

bool C4ValueProviderSinV::Execute ( )
overridevirtual

Implements StdMeshInstanceValueProvider.

Definition at line 661 of file C4MeshAnimation.cpp.

662 {
663  // Object might have been removed
664  if(!Object) return false;
665 
666  // TODO: Maybe we can optimize this by using cos(r) = x/sqrt(x*x+y*y), sin(r)=y/sqrt(x*x+y*y),
667  // plus addition theorems for sin or cos.
668 
669  int angle = Angle(0, 0, fixtoi(Object->xdir, 256), fixtoi(Object->ydir, 256));
670  Value = Begin + (End - Begin) * Sin(itofix(angle) + Offset);
671  return true;
672 }
C4Fixed itofix(int32_t x)
Definition: C4Real.h:261
int fixtoi(const C4Fixed &x)
Definition: C4Real.h:259
C4Real Sin(const C4Real &fAngle)
Definition: C4Real.h:265
int32_t Angle(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iPrec)
Definition: Standard.cpp:37
C4Real ydir
Definition: C4Object.h:124
C4Real xdir
Definition: C4Object.h:124

References Angle(), fixtoi(), itofix(), Sin(), StdMeshInstanceValueProvider::Value, C4Object::xdir, and C4Object::ydir.

Referenced by C4ValueProviderSinV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lookup() [1/2]

static const IDBase* StdMeshInstance::SerializableValueProvider::Lookup ( const char *  name)
inlinestaticinherited

Definition at line 460 of file StdMesh.h.

461  {
462  if(!IDs) return nullptr;
463  for(auto & ID : *IDs)
464  if(strcmp(ID->name, name) == 0)
465  return ID;
466  return nullptr;
467  }

References StdMeshInstance::SerializableValueProvider::IDBase::name.

◆ Lookup() [2/2]

static const IDBase* StdMeshInstance::SerializableValueProvider::Lookup ( const std::type_info &  type)
inlinestaticinherited

Definition at line 469 of file StdMesh.h.

470  {
471  if(!IDs) return nullptr;
472  for(auto & ID : *IDs)
473  if(ID->type == type)
474  return ID;
475  return nullptr;
476  }

References StdMeshInstance::SerializableValueProvider::IDBase::type.

Member Data Documentation

◆ Value


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