#include <valfunc.h>
Inheritance diagram for ValueFunction:
Public Member Functions | |
virtual double | GetValue (double Position)=0 |
virtual ValueFunction * | Clone (void)=0 |
virtual BOOL | IsDifferent (ValueFunction *pOther) |
Comparator. Determines if 2 different ValueFunction objects are considered different. | |
virtual CamelotFileRecord * | WriteFileRecord (INT32 RecordTag, INT32 ExtraBytes, BaseCamelotFilter *pFilter)=0 |
virtual ValueFunctionID | GetUniqueID (void)=0 |
virtual INT32 | GetMinimumRecursionDepth () |
Static Public Member Functions | |
static BOOL | Init (void) |
Initialises all valueFunction classes defined in valfunc.cpp. | |
static void | DeInit (void) |
Initialises all valueFunction classes defined in valfunc.cpp. | |
static ValueFunction * | ReadFileRecord (CXaraFileRecord *pInputRecord) |
Main entry point for loading ValueFunctions from files. The caller record handler passes the record in to this static function, and the saved VF is re-constituted from the saved information. On return the caller can read any extra values that they saved in the record. | |
Protected Member Functions | |
CamelotFileRecord * | CreateAndWriteFileRecord (INT32 RecordTag, INT32 DerivedBytes, INT32 ExtraBytes, BaseCamelotFilter *pFilter) |
Creates an output record containing an embedded ValueFunction description. | |
virtual ValueFunction * | CreateAndReadFileRecord (CXaraFileRecord *pInputRecord)=0 |
Static Protected Attributes | |
static List | RegisteredFunctions |
Private Member Functions | |
CC_DECLARE_DYNAMIC (ValueFunction) |
This is quite a generic class, but it is mainly used by the stroke provider system for handling variable line width functions.
Notes: Positions passed into these functions will always be within the range 0.0 to 1.0.
Generally, outputs from these functions will lie between -1.0 and 1.0, although there is no reason why the derived classes cannot be passed ranges (e.g. see the Ramp classes below)
Definition at line 196 of file valfunc.h.
|
|
|
|
|
Creates an output record containing an embedded ValueFunction description.
ExtraBytes - The number of extra bytes of information the caller will write into the record after caling this function (Space for this many extra bytes will be reserved by this function when it creates the new file record) This may be 0 or more bytes. pFilter - The filter to write to
The record will be (4 + DerivedBytes + ExtraBytes) bytes in length, and on return from this function, the first 4 bytes (only) will have been written. The caller(s) must fill in the remainder. All ValueFunction record data has 3 sections, whiich are recorded as follows: 1. ValueFunction header, identifying which type of VF is being saved. This is written by the base class CreateAndWriteFileRecord INT32 ValueFunctionUniqueID (4 bytes) 2. Derived-class-data (0 or more bytes). This is written by the derived class WriteFileRecord function, into the record returned from here. This data must be DerivedBytes (0 or more) bytes in length. 3. Caller data. This is written by the caller of the derived function. This data must be ExtraBytes (0 or more) bytes in length.
Definition at line 416 of file valfunc.cpp. 00419 { 00420 ERROR3IF(pFilter == NULL, "Illegal NULL param"); 00421 ERROR3IF(ExtraBytes < 0, "Stupid ExtraBytes request in ValueFunction::CreateAndWriteFileRecord"); 00422 00423 // Calculate how many bytes of information this VF will write. 00424 // We write a 4-byte "header", followed by the derived class data and the caller data 00425 const INT32 RecordSize = 4 + DerivedBytes + ExtraBytes; 00426 00427 // Create an appropriate record, and write the header info to it 00428 CamelotFileRecord *pRec = new CamelotFileRecord(pFilter, RecordTag, RecordSize); 00429 00430 // If that worked, then we now init & add our own data to the record 00431 if (pRec != NULL) 00432 { 00433 BOOL ok = pRec->Init(); 00434 if (ok) ok = pRec->WriteUINT32(GetUniqueID()); 00435 00436 if (!ok) // If we failed, then clean up & return NULL 00437 { 00438 delete pRec; 00439 pRec = NULL; 00440 } 00441 } 00442 00443 return(pRec); 00444 }
|
|
Initialises all valueFunction classes defined in valfunc.cpp.
Definition at line 281 of file valfunc.cpp. 00282 { 00283 RegisteredFunctions.DeleteAll(); 00284 }
|
|
Reimplemented in ValueFunctionRampS, ValueFunctionRampS2, ValueFunctionRampL, ValueFunctionRampL2, ValueFunctionSawTooth, ValueFunctionPropeller, ValueFunctionDoubleRampS, ValueFunctionBevelEnds, ValueFunctionIntestine, ValueFunctionDecay, ValueFunctionTeardropCurvedEnd, and ValueFunctionSmoothStroke. Definition at line 230 of file valfunc.h.
|
|
|
|
|
Comparator. Determines if 2 different ValueFunction objects are considered different.
Reimplemented in ValueFunctionConstant, ValueFunctionRandom, ValueFunctionRamp, ValueFunctionBlip, ValueFunctionPressure, and ValueFunctionSmoothStroke. Definition at line 310 of file valfunc.cpp. 00311 { 00312 ERROR3IF(pOther == NULL, "Illegal NULL param"); 00313 return(GetRuntimeClass() != pOther->GetRuntimeClass()); 00314 }
|
|
Main entry point for loading ValueFunctions from files. The caller record handler passes the record in to this static function, and the saved VF is re-constituted from the saved information. On return the caller can read any extra values that they saved in the record.
Definition at line 342 of file valfunc.cpp. 00343 { 00344 ERROR3IF(pInputRecord == NULL, "Illegal NULL params"); 00345 00346 INT32 ID; 00347 pInputRecord->ReadINT32(&ID); 00348 00349 ValueFunction *pFunc = (ValueFunction *) RegisteredFunctions.GetHead(); 00350 while (pFunc != NULL) 00351 { 00352 if (pFunc->GetUniqueID() == ID) 00353 return(pFunc->CreateAndReadFileRecord(pInputRecord)); 00354 00355 pFunc = (ValueFunction *) RegisteredFunctions.GetNext(pFunc); 00356 } 00357 00358 return(NULL); 00359 }
|
|
Implemented in ValueFunctionConstant, ValueFunctionRandom, ValueFunctionRamp, ValueFunctionBlip, ValueFunctionPressure, and ValueFunctionSmoothStroke. |
|
|