|
Purpose:
|
Provides the mechanism for getting and setting shader parameters.
|
|
|
Derivation:
|
Render_Arg : -
|
|
|
Filename:
|
rbase/rnd_husk/include/rh_args.hxx
|
|
|
Description:
|
Render_Arg objects are used for setting and getting shader parameters. Shader parameters are identified by an enumerated type, and are accessed by a name in the form of a string. Because the parameter types are not known at compile time it is necessary to be able to set the parameters at run time according to their types.
Render_Arg types include:
|
|
|
ARG_UNDEF
|
Undefined argument
|
|
ARG_INT
|
Integer argument
|
|
ARG_REAL
|
Real argument
|
|
ARG_STRING
|
String argument
|
|
ARG_COLOR
|
Three real values specifying the RGB color
|
|
ARG_VECTOR
|
Three real values for
x,
y, and
z
|
|
ARG_ON_OFF
|
ON or
OFF
|
|
ARG_FALL_OFF
|
One of the values:
FALL_OFF_CONSTANT,
FALL_OFF_INVERSE,
FALL_OFF_ISL,
FALL_OFF_INVERSE_CLAMP, or
FALL_OFF_ISL_CLAMP
|
|
|
Constructor:
|
public: Render_Arg::Render_Arg
();
|
|
|
C++ allocation constructor requests memory for this object but does not populate it.
|
|
|
|
|
|
|
public: Render_Arg::Render_Arg
(
|
|
|
const char* val
|
// string
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments, creating a
Render_Arg of type
ARG_STRING.
|
|
|
|
|
|
|
public: Render_Arg::Render_Arg
(
|
|
|
const Fall_Off_Type& val
|
|
// value
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments, creating a
Render_Arg of type
ARG_FALL_OFF.
|
|
|
|
|
|
|
public: Render_Arg::Render_Arg
(
|
|
|
const int& val
|
// integer
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments, creating a
Render_Arg of type
ARG_STRING.
|
|
|
|
|
|
|
public: Render_Arg::Render_Arg
(
|
|
|
const On_Off_Type& val
|
// on or off
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments, creating a
Render_Arg of type
ARG_ON_OFF.
|
|
|
|
|
|
|
public: Render_Arg::Render_Arg
(
|
|
|
const double& val
|
// double
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments, creating a
Render_Arg of type
ARG_STRING.
|
|
|
|
|
|
|
public: Render_Arg::Render_Arg
(
|
|
|
const double* val
|
// vector
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments, creating a
Render_Arg of type
ARG_VECTOR.
|
|
|
|
|
|
|
public: Render_Arg::Render_Arg
(
|
|
|
const Render_Color& val
|
// color
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments, creating a
Render_Arg of type
ARG_COLOR. This value is composed of three doubles, corresponding to red, green, and blue.
|
|
|
|
|
Methods:
|
public: operator const Render_Arg::char*
() const;
|
|
|
Returns the
Render_Arg's string value. If the value is not a string value, the result is undefined.
|
|
|
|
|
|
|
public: void Render_Arg::debug
(
|
|
|
FILE* fp
|
// debug file
|
|
|
);
|
|
|
Supports debugging.
|
|
|
|
|
|
|
public: operator Render_Arg::double
() const;
|
|
|
Returns the
Render_Arg's real value. If the value is not a real value, the result is undefined.
|
|
|
|
|
|
|
public: operator Render_Arg::double*
() const;
|
|
|
Returns the
Render_Arg's vector value. If the value is not a vector value, the result is undefined.
|
|
|
|
|
|
|
public: operator Render_Arg::Fall_Off_Type
() const;
|
|
|
Returns the
Render_Arg's
Fall_Off_Type value. If the value is not a
Fall_Off_Type value, the result is undefined.
|
|
|
|
|
|
|
public: void Render_Arg::free_string
();
|
|
|
Frees the string memory pointed to by a
Render_Arg of type
ARG_STRING. Use this method to free the memory when completed, such as when the
Render_Arg is destroyed and no other objects reference the string.
|
|
|
|
|
|
|
public: operator Render_Arg::int
() const;
|
|
|
Returns the
Render_Arg's integer value. If the value is not an integer value, the result is undefined.
|
|
|
|
|
|
|
public: operator Render_Arg::On_Off_Type
() const;
|
|
|
Returns the
Render_Arg's
On_Off_Type value. If the value is not a
On_Off_Type value, the result is undefined.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const char* val
|
// string value
|
|
|
);
|
|
|
Returns the
Render_Arg's string value.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const Fall_Off_Type& val
|
// fall off type
|
|
|
);
|
|
|
Returns the
Render_Arg's
Fall_Off_Type value.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const int& val
|
// integer value
|
|
|
);
|
|
|
Returns the
Render_Arg's integer value.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const On_Off_Type & val
|
// on off type
|
|
|
);
|
|
|
Returns the
Render_Arg's
Fall_Off_Type value.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const double& val
|
// double value
|
|
|
);
|
|
|
Returns the
Render_Arg's double value.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const double* val
|
// vector value
|
|
|
);
|
|
|
Returns the
Render_Arg's vector value.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const Render_Arg& rarg
|
// render argument
|
|
|
);
|
|
|
Returns the
Render_Arg's value.
|
|
|
|
|
|
|
public: Render_Arg Render_Arg::operator=
(
|
|
|
const Render_Color& val
|
// render color
|
|
|
);
|
|
|
Returns the
Render_Arg's
Render_Color value.
|
|
|
|
|
|
|
public: operator Render_Arg::Render_Color
() const;
|
|
|
Returns the
Render_Arg's
Render_Color value. If the value is not a
Render_Color value, the result is undefined.
|
|
|
|
|
|
|
public: logical Render_Arg::restore
();
|
|
|
Restores the
Render_Arg. The restore function does the actual work. It calls the base class, then reads the selector, if the save file is new enough.
|
|
|
read_int
|
Argument Type
|
|
switch( arg_type )
|
|
case ARG_INT:
|
|
|
read_int
|
integer value
|
|
|
break
|
|
case ARG_REAL:
|
|
|
read_real
|
real value
|
|
|
break
|
|
case ARG_STRING:
|
|
|
rh_restore_string
|
string to read in
|
|
|
break
|
|
case ARG_COLOR:
|
|
|
read_real
|
First color value
|
|
|
read_real
|
Second color value
|
|
|
read_real
|
Third color value
|
|
|
break
|
|
case ARG_VECTOR:
|
|
|
read_real
|
x value
|
|
|
read_real
|
y value
|
|
|
read_real
|
z value
|
|
|
break
|
|
case ARG_ON_OFF:
|
|
|
read_int
|
on or off value
|
|
|
break
|
|
case ARG_FALL_OFF:
|
|
|
read_int
|
fall off value
|
|
|
break
|
|
case ARG_UNDEF:
|
|
|
|
|
break
|
|
|
|
|
|
|
public: void Render_Arg::save
() const;
|
|
|
Saves the arg type, followed by the arg value, which can vary by type.
|
|
|
|
|
|
|
public: Arg_Type Render_Arg::type
() const;
|
|
|
Returns the type of
Render_Arg. If the value is not a
Render_Arg type value, the result is undefined.
|