This commit is contained in:
nephacks
2025-06-04 03:22:50 +02:00
parent f234f23848
commit f12416cffd
14243 changed files with 6446499 additions and 26 deletions

View File

@@ -0,0 +1,48 @@
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =======
//
// The expression operator class - scalar math calculator
// for a good list of operators and simple functions, see:
// \\fileserver\user\MarcS\boxweb\aliveDistLite\v4.2.0\doc\alive\functions.txt
// (although we'll want to implement elerp as the standard 3x^2 - 2x^3 with rescale)
//
//=============================================================================
#ifndef DMEEXPRESSIONOPERATOR_H
#define DMEEXPRESSIONOPERATOR_H
#ifdef _WIN32
#pragma once
#endif
#include "movieobjects/dmeoperator.h"
#include "mathlib/expressioncalculator.h"
//-----------------------------------------------------------------------------
// An operator which computes the value of expressions
//-----------------------------------------------------------------------------
class CDmeExpressionOperator : public CDmeOperator
{
DEFINE_ELEMENT( CDmeExpressionOperator, CDmeOperator );
public:
virtual void Operate();
virtual void GetInputAttributes ( CUtlVector< CDmAttribute * > &attrs );
virtual void GetOutputAttributes( CUtlVector< CDmAttribute * > &attrs );
void SetSpewResult( bool state );
protected:
bool Parse( const char *expr );
bool IsInputAttribute( CDmAttribute *pAttribute );
CExpressionCalculator m_calc;
CDmaVar< float > m_result;
CDmaString m_expr;
CDmaVar< bool > m_bSpewResult;
};
#endif // DMEEXPRESSIONOPERATOR_H