|
Documentation (Version 0.1) Craig McNaughton Copyright 2000,2001,2002 Pandromeda Inc.
|
|
Development Environment The MojoWorld SDK is designed to allow plugin development on Windows and Macintosh. While it may be possible to develop plugins under different environments, the following are the recommended:
|
|
Library Layout
MojoWorld is spread across a number of shared libraries. These are:
|
|
Class Hierarchy
Most of the base classes for MojoWorld fit into the class hierarchy laid out below. See the next section for a brief description of each class.
Plugged
Renderer
ParamObj
Function
Atmosphere
Noise
Material
Backdrop
CloudLayer
ImageFileHandler
Object
PreviewObject
RenderObject
Camera
Light
HelperObject
Satellite
|
|
Overview of Base Classes
Plugged
Renderer
ParamObj
Function
Material
Atmosphere
Backdrop
Object
PreviewObject
Camera
Light
RenderObject
Noise
CloudLayer
Satellite
HelperObject
ImageFileHandler
|
|
Additional Classes (not in the hierarchy)
Param
SParam
FunContext
Plugin
SubPrimitive
Curve
CurveHolder
Core
|
|
Basic Types
In order to maintain platform independence, the following basic types are defined and should be used in place of standard C++ types. This ensures that sizeof() returns consistent values across all platforms.
int8, int16, int32 : signed 8, 16, and 32 bit integers The following classes are also available for more complex types
Vec2d, Vec3d, Vec4d : double precision floating point vectors To reduce memory use, the following single precision floating point types are also available.
fVec2d, fVec3d, fColor, fBBox2d
|
|
Plugin Types
The following constants are used to define what task a plugin performs and hence what class it is being derived from.
enum OTYPE {
objFunction,
objMaterial,
objPrimitive,
…,
objLight,
objCamera,
objHelper,
objAtmosphere,
objBackdrop,
…,
objRenderer,
…,
objImageFormat,
objNoise,
objSatellite,
…,
objCloudLayer,
objMarker,
objUndefined = 9999999
};
Other values in the OTYPE are reserved for either internal or future use.
objFunction : A plugin that derives from Function and provides a node in the function graph. E.g. MonoFractal, Add, Blend. objMaterial : A plugin that derives from Material and provides surface shading capabilities. E.g. Displacement Material, Blend Material. objPrimitive : A plugin that derives from RenderObject and provides a solid primitive to the renderer. E.g. Planet, sphere, polygon mesh. objLight : A plugin that derives from Light and provides an implementation of a light source. E.g. sunlight, Spot light. objCamera : A plugin that derives from Camera and provides an implementation of a viewing geometry. objHelper : A plugin that derives from PreviewObject and provides a tool for placement of other things. E.g. Parameter Bomb helper. objAtmosphere : A plugin that derives from Atmosphere and provides a global atmospheric effect. E.g. Cloudy Atmosphere. objBackdrop : A plugin that derives from Backdrop and provides a background texture behnd all geometry, atmosphere and volumes. objRenderer : A plugin that derives from Renderer and provides a photorealistic render of the scene. objImageFormat : Load/save for various image formats E.g. TIFF, PNG, JPEG. objNoise : A plugin that derives from Noise and provides a basis function for fractals. E.g. Gradient Noise, Voronoi. objSatellite : A plugin deriving from Satellite, providing control over an object and light source as a satellite of the planet. objCloudLayer : A plugin providing a simple layered cloud at a defined altitude. Note that the renderer does not handle cloud layers natively, but relies on the atmosphere to incorporate any cloud layers into its calculations. objMarker : Anything deriving from PreviewObject that just provides a simple visual indicator in the real time renderer. E.g. Marker Flags.
|
|
Parameter Types
A ParamObj can have multiple parameters (each represented by a Param class), which will have a user interface for them procedurally built from the parameter definition. The following types currently supported by the Param class:
enum PTYPE {
typeInt,
typeDouble,
typeVec2d,
typeVec3d,
typeVec4d,
typeQuaternion,
typeColor,
typeColorA,
typeString,
typeUndef=9999999
};
typeInt : A signed 32 bit integertypeDouble : A double precision floating point number typeVec2d : A 2D vector of double precision floating point typeVec3d : A 3D vector of double precision floating point typeVec4d : A 4D vector of double precision floating point typeQuaternion : A 4D vector representing a rotation as a quaternion, double precision floating point. typeColor : RGB color triple, stored as double precision floating point typeColorA : RGB and Alpha color value, stored as double precision floating point typeString : A variable length character string. typeUndef : In some cases, parameter types are not defined until the return value is defined. This type is used to indicate a currently undefined parameter type.
|
|
Plugin File Basics
Each plugin must provide two functions to allow the plugin objects to be registered by the system.
int32 NumPlugs()
Plugin *Plugin(int32 i)
|
|
Loading and Saving
Each plugin is responsible for loading and saving any local data that needs to persist across differing invocations of the file. In order to maintain the hierarchy of the scene graph, each plugin in the scene is given a unique ID prior to saving and that ID is written to the file as part of the save data for each plugin. A plugin that requires a pointer to another object to persist should find the ID of that object at save time and write it to the file as part of its data. Loading is then a 2 pass process. First, each plugin's object ID is read from the file, an instance is created and that instance's Load() method is called to get all the data from the file. This data will include the unique ID of the object whose pointer you require. The second pass will call the PostLoad() method, which can find the objects based on the ID's that were saved. In general, any plugin's Load/Save/PostLoad methods will also call the relevant method of its class parent to make sure that everything relevant to the parent is also loaded/saved properly. If plugins stick to this, then all the parameters, curves, dependencies and everything else that is managed by its class parents will be loaded and saved automatically. As an example, here are code chunks from the RenderObject Load and Save methods. The only pointer it needs to maintain is the material pointer.
|
|
Steps in Creating a Plugin
Having decided what the new plugin will do and which plugin type it best fits under, there are a few standard things that need to be done to provide the framework in which it will perform its function. We'll look at the Distance function node as an example of how this process works. The Distance node is a very simple node with two 3D vector parameters that simply returns the distance between the two points specified by the parameters. The first two things that need to be defined are the class definition for the main plugin class (derived from class Function in this case) and the description class to tell the plugin manager what this plugin does (derived from class Plugin). Here's the header file for the FDistance plugin, showing these.
Each plugin gets a unique 32 bit numerical ID. All internal Pandromeda plugins will have the high bit of the ID set to zero (E.g. 0x00000000 to 0x7fffffff). Third party developers should make sure the high bit is set to 1 to avoid ID clashes (E.g. 0x80000000 to 0xffffffff).#define FDISTANCE_OBJ_ID 0x00000003 This is the class that defines the functionality of our new plugin. It overrides virtual functions from Plugged, ParamObj and Function to do its work.
This is the descriptor class that the plugin manager uses to know what this
plugin does and what it's called.
Once we've defined the main class, we can start filling in the methods that we
need to override the standard methods in the base classes. The first (and
easiest) to tackle are the methods from class Plugged.
UniqueID() identifies the plugin. It must return the same value as the plugin descriptor FDistancePlug.
ObjectType() tells the system what kind of thing we are. In this case, we're a
function node. This must return the same type as the FDistancePlug::Type() method.
ClassName() is a simple descriptive name for what this plugin does. (Currently,
MojoString is defined as std::string, but plugins should always use MojoString
to ensure future compatibility.)
Next, we should look at the constructor and destructor. The constructor of
anything that derives from ParamObj is where the parameters are created and
initial values set up.
We allocate the array of parameter pointers and create a parameter for everything
that will have a user control. The canFunction flag lets us control whether or not
another function node can be used to drive the value of this parameter. For the
Distance node we do want to be able to drive these with functions (as its main use
is generally finding distance from the current world position to a known object),
but for parameters on other nodes, it might not make sense (E.g. it makes no sense
to drive the filename for a bitmap node from another function).
The ParamObj destructor will take care of deleting any parameters, gradients,
curves or sub-plugins that we allocate in our constructor. Anything else that
is for our own internal use should be deleted here.
Now we can look at the methods of ParamObj that we need to override. The main method that will generally be needed is the Update() method.
The Update() method will be called with the number of the parameter that has
changed, or -1 if something other than a parameter has changed. For our Distance
node, we don't need to do anything special when a parameter changes, so we
technically don't need the Update() method, but it is included as a matter of
consistency. The main use for the Update() method is to update any cached values
of parameters that can't have a function connected and any internal information
based on these parameters. For example, the Planet radius can't have a function
connected, but when its value changes, the Planet primitive needs to regenerate
preview information for the real time renderer.
The last thing we need are the methods to actually evaluate the distance value. For functions, it's quite common for there to be a "native" type that they work in and to use the converter to provide results in different types. In this case, we have a "native" double precision version and all the other versions just use the converter.
This version evaluates the result as a double precision floating point (real64)
number. It gets the two 3D vectors from the parameters and finds the distance
between them. The FunContext that gets passed in provides all the necessary base
information that the renderer can provide (e.g. World Position, surface normal,
slope, etc). A node can either access this information directly (e.g. the World
Position node just returns the position value directly from the context), or pass
this context onto the parameters so they (and their connection functions) can
use that information.
The integer version just evaluates the result as a real64 and then uses the
converter that the parameter provides to convert that to an integer. Doing
this is a simple convenience when the behavior isn't dependant on the type.
When the result is dependant on the required type, or maximum efficiency is
required, all the different type versions of the Eval methods can be different.
For example, the noise node only needs to evaluate a single noise value for the
real64 version, but requires 3 noise evaluations for the Vec3d and Color versions.
The SIMDEval methods are used by the renderer to provide much better
filtering of the final value. They are passed a 2D array of contexts
and evaluate the result at all points in the array, returning a 2D array
of results. For a simple node like Distance, whose behavior isn't dependant
on sample sizes, this can be implemented as a simple loop over all the points
in the array. More complex nodes like the fractals (who calculate the number
of octaves of noise to evaluate based on the distance between sample points)
can examine the neighbors of each point in the array to get a reasonably
accurate measure of the size of the required sample area. The simdStack.Push()
and Pop() methods provide more efficient memory handling than calling new and
delete for the temporary storage required.
Note that for function nodes, some of the required return types don't make much "sense" in terms of getting a useful value. Asking for the distance between two points as a quaternion doesn't have any useful meaning. In these cases, always use the Convert() method to convert from a sensible type. While this doesn't provide any more meaningful information, it guarantees a consistent value, and one that is at least numerically sensible. The final step is to set up the DLL functions that the core actually calls to get information about the plugins in a particular plugin file.
A plugin file can have any number of plugins of any type in it. Every time you
add a new plugin to a plugin file, just increment this number.
The Plugin() function just returns a pointer to the plugin descriptor for
the numbered plugin. Remember to add a new case to this each time you add
a new plugin to the plugin file, or the core code won't see your new plugin!
(The __declspec(dllexport) syntax above is for Win32 plugins under Visual C++. Other platforms may use differing compiler directives. Check the sample code for your particular platform.) We have included sample code for most of the plugin types that can be added to MojoWorld. In most cases, this is the actual code that we use to ship MojoWorld. We strongly recommend using this code and projects as a starting point for any plugin development, as there are many platform specific compiler and project settings that can cause headaches if not set correctly.
|
|
Class Descriptions
This is an alphabetical list of all relevant classes for plugin creation and documentation on each method and member.
|
|
Atmosphere
class Atmosphere : public ParamObj Methods:
Atmosphere() : ParamObj()
virtual ~Atmosphere()
virtual void Fog(FunContext *fc, ColorA &col) = 0
virtual void Fog(FunContext *fc, ColorA &col, const Vec3d &start, const Vec3d &end, flag isDir = false) = 0
virtual void GLSetup(FunContext *fc) = 0
virtual flag BackgroundColor(FunContext *fc, Vec3d *directions, int numDirs, Color *colors) { return false; }
|
|
Backdrop
class Backdrop : public ParamObj Methods:
Backdrop() : ParamObj()
virtual ~Backdrop()
virtual Color Shade(FunContext *fc) = 0
|
|
BBox2d
class BBox2d Data:
Vec2d min, max; Methods:
inline BBox2d(Vec2d mn, Vec2d mx)
inline BBox2d()
real64 MaxDimension()
BBox2d Intersection(BBox2d bb)
flag Empty()
void Include(Vec2d p)
inline flag Inside(Vec2d v)
inline flag FudgeInside(Vec2d v, real64 ff = 0.0) [The analogous class fBBox2D provides identical functionality with single precision floating point vectors.]
|
|
BBox3d
class BBox3d Data:
Vec3d min, max; Methods:
inline BBox3d(Vec3d mn, Vec3d mx)
inline BBox3d()
real64 MaxDimension()
BBox3d Intersection(BBox3d bb)
flag Empty()
void Include(Vec3d p)
BBox3d operator*(const Matrix &m)
void GetCorners(Vec3d *corners)
|
|
Camera
class Camera : public PreviewObject Data:
flag changed
real64 wxs, wys
real64 aspect
real64 pixelAspect
flag ortho
int32 ixs, iys
real64 closeClip, farClip Methods:
Camera()
virtual ~Camera()
virtual void SetEyePoint(Vec3d eye, FunContext *fc) = 0
virtual Vec3d GetEyePoint(FunContext *fc) = 0
virtual Vec3d GetUpVec(FunContext *fc) = 0
virtual Vec3d GetDirVec(FunContext *fc) = 0
virtual Vec3d GetRightVec(FunContext *fc) = 0
virtual void SetFOV(real64 fov, FunContext *fc) = 0
virtual real64 GetFOV(FunContext *fc) = 0
virtual void SetUIFOV(real64 fov, FunContext *fc) = 0
virtual real64 GetUIFOV(FunContext *fc) = 0
virtual void SetOrientation(const Quaternion &orient, FunContext *fc) = 0
virtual void SetOrientation(const Vec3d &dir, const Vec3d &up, FunContext *fc) = 0
virtual void UpdateOrientation(const Quaternion &orient, FunContext *fc) = 0
virtual void GetOrientation(Quaternion &orient, FunContext *fc) = 0
virtual void GetOrientation(Matrix &orient, FunContext *fc) = 0
virtual real64 FindCurrentHeading();
virtual void TurnToHeading(real64 ang)
virtual void GetLatLong(real64 &longitude, real64 &latitude)
virtual void SetLatLong(real64 longitude, real64 latitude)
virtual real64 GetCurrentPitch()
virtual real64 GetCurrentRoll()
virtual void SetCurrentPitch(real64 pitch)
virtual void SetCurrentRoll(real64 roll)
virtual void SetPitchAndRoll(real64 pitch, real64 roll)
virtual real64 PixelSize(Vec3d point) = 0
virtual void SetAspect(real64 aspect, FunContext *fc)
virtual void GenerateRay(Vec2d screen, Vec3d &from, Vec3d &dir) = 0
virtual flag WorldToScreen(Vec3d p, Vec2d &pp) = 0
virtual void WorldToEye(Vec3d p, Vec3d &ep, Matrix *tw = NULL) = 0
virtual flag EyeToScreen(Vec3d p, Vec2d &sp) = 0
virtual Vec3d ScreenToWorld(Vec2d p, real64 depth = 1.0) = 0
virtual void EyeToWorld(Vec3d eyeP, Vec3d &wp) = 0
virtual void FindCamBounds(BBox3d pb, BBox3d &cb, Matrix *tw = NULL) = 0
virtual void FindScreenBox(BBox3d cb, BBox2d &sb) = 0
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList
virtual Plugged *Clone(flag func = true, flag subP = true)
|
|
CloudLayer
class CloudLayer : public ParamObj Data:
flag excludeMe Methods:
CloudLayer() : ParamObj()
virtual ~CloudLayer()
virtual real64 GetHeight() = 0
virtual void SetHeight(real64 height) = 0
virtual void Shade(FunContext *fc, ColorA *col, real64 *atten = NULL) = 0
flag Excluded()
|
|
Color
class Color A 3 component RGB color class. Data:
real64 r, g, b Methods:
inline Color(real64 pr, real64 pg, real64 pb)
inline Color(int32 ir, int32 ig, int32 ib)
inline Color()
inline Color(const Color &c)
inline Color(const Vec3d &v)
inline real64 &operator[] (const int32 i)
inline Color operator+(const Color &v)
inline Color operator-(const Color &v)
inline Color operator*(const Color &v)
inline Color operator/(const Color &v)
inline Color operator+(const real64 &v)
inline Color operator-(const real64 &v)
inline Color operator*(const real64 &v)
inline Color operator/(const real64 &v)
inline Color& operator=(const Color& v )
inline int32 operator ==(const Color amp;&v)
inline int32 operator !=(const Color &v)
inline void Clamp()
inline void ClampPositive()
Inline bool IsBlack()
void RGBtoHSV()
void HSVtoRGB() [There is also the analogous class fColor, which stores the colors as single precision floating point internally.]
|
|
ColorA
class ColorA Data:
real64 r, g, b, a Methods:
inline ColorA(real64 pr, real64 pg, real64 pb, real64 pa)
inline ColorA(int32 ir, int32 ig, int32 ib, int32 ia)
inline ColorA()
inline real64 &operator[] (const int32 i)
inline ColorA(const ColorA &c)
inline ColorA(const Color &c)
inline ColorA(const Vec4d &v)
inline ColorA operator+(const ColorA &v)
inline ColorA operator-(const ColorA &v)
inline ColorA operator*(const ColorA &v)
inline ColorA operator/(const ColorA &v)
inline ColorA operator+(const real64 &v)
inline ColorA operator-(const real64 &v)
inline ColorA operator*(const real64 &v)
inline ColorA operator/(const real64 &v)
inline int32 operator ==(const ColorA &v)
inline int32 operator !=(const ColorA &v)
inline void Clamp()
inline void ClampPositive()
void RGBtoHSV() void HSVtoRGB() Converts the internal representation from HSV to RGB. The alpha value is unchanged.
|
|
Core
class Core Data:
TList<PreviewObject *> *objList
TList<Material *> *matList
TList<Light *> *lightList
TList<Camera *> *cameraList
TList<Satellite *> *satellites
TList<CloudLayer *> *cloudList
Atmosphere *atmos
Backdrop *backdrop
Material *defaultMaterial
Electrician electrician
CentralExchange theExchange
bool currentlyLoading
FunContext *globFC
RayEngine *rayEngine
MemStack simdStack
real64 fixedDP
PQaeb *planet
POcean *ocean
int TextUpdateRefCount
real64 stepSize
TList<SceneState *> states
TList<MUITextureLeaf *> *texLeaf
TList<Plugged *> *nodeList
Camera *currentCam
flag doTextureUpdate
flag frozen
TList<Plugged *> libraryList
flag doingLibrary
flag sceneChanged
std::list<MessageStruct> messageList
std::list<MessageStruct> ErrorList
flag m_CleaningUp
bool m_bMachineValid
bool m_bOpenGLAbove1_2
MojoString m_glVendor, m_glVersion, m_glExtensions, m_glRenderer
MojoString m_machineInfo
float m_glVersionMajMin
float m_SunPosition
float m_YearPosition Methods:
Core()
virtual ~Core()
flag Initialize(CoreCallback *cb)
void Add(Plugged *node)
flag Delete(Plugged *node)
int32 NumNodes()
Plugged *Get(int32 i)
Plugged *Create(ID id)
void SetCurrentCamera(Camera *cam)
Camera *GetCurrentCamera()
flag LoadTheFile(MojoInputStream &in)
FileChunk BeginFileChunk(MojoOutputStream &out, Plugged *plug)
ImageFileHandler *GetImageHandler(const MojoString &ext)
void CleanUp()
flag CurrentlyCleaning()
real64 PlanetHeight(Vec3d p, real64 dP = 1.0)
real64 PlanetHeight(FunContext *fc, flag doNormal = FALSE)
Matrix PlanetSpace(Vec3d p)
real64 PlanetSlope(Vec3d p, real64 dP = 1.0)
Vec3d PlanetNormal(Vec3d p, real64 dP = 1.0)
real64 PlanetRadius()
void EnableTextureUpdate(flag b)
void SetStableState(flag state)
void SetFrozen(flag b)
real64 SeaLevel()
void SetSeaLevel(real64 seaLevel)
void SetSceneStateValues(std::vector<SceneState> &MySceneValues)
MUITextureLeaf *CreateTextureLeaf(ID id = 0, bool col = true)
void StartLibrarySave()
flag SaveToLibrary(Plugged *obj, MojoOutputStream &out)
OTYPE LibraryType(MojoInputStream &in)
void SetChanged()
flag HasChanged()
void ResetChanged()
void InitMachineInfo()
float GetOpenGLVersion() const
MojoString GetMachineInfo() const
flag IsOpenGLAbove1_2() const
void SetOpenGLAbove1_2(flag val)
void UpdateForLightSourceChanges()
void SetRelativeRotationPosition(float value, bool ignoretimefix = false)
void SetBUISunPosition(float value)
void SetBUIYearTime(float val)
float GetSunPosition()
float GetYearPosition()
float GetMoonPosition()
Core *MojoInitialize()
void MojoUninitialize( Core*& pCore )
void MinimalLifeSupport()
|
|
Curve
class Curve Data:
flag unchanged
enum RangeClampType { rangeNoChange = 0, rangeClamp, rangeReflect }
enum ClampType { curveClamp = 0, curveContinue, curveMirror, curveRepeat }
TList<CurvePoint *> *points
real64 lowInput, highInput
real64 lowOutput, highOutput
ClampType clamp
RangeClampType rClamp
real64 invertSize Support Struct: The Curve class makes use of the following CurvePoint data structure:
struct CurvePoint
{
Vec2d p; // x stores the value, y stores the time
Vec2c dprev, dnext; // tangent values previous and next
flag broken;
// are we enforcing tangent continuity through this point?
flag IsIdentical(CurvePoint *cp);
}
Methods:
Curve()
Curve(const Curve& val)
~Curve()
inline real64 Eval(real64 v)
real64 UnitEval(real64 v, flag differential = false)
void SetInputRange(real64 lo, real64 hi)
void SetOutputRange(real64 lo, real64 hi)
void GetInputRange(real64 &lo, real64 &hi)
void GetOutputRange(real64 &lo, real64 &hi)
void InvertHorizontal()
void InvertVertical()
int32 GetNumPoints()
CurvePoint *GetPoint(int32 i)
void AddPoint(CurvePoint *cp)
void AddPoint(Vec2d position)
void Reorder()
void DeletePoint(real64 t)
flag IsIdentical(Curve *cc)
void StartAccumulate()
void AddSpuriousPoint(real64 v)
void SetChanged()
inline flag IsUnchanged()
void CheckForChange()
Curve& operator=(const Curve &c)
flag Load(MojoInputStream &in)
flag Save(MojoOutputStream &out)
|
|
CurveHolder
class CurveHolder Data:
Curve* Curve1, Curve2, Curve3
int NumCurves
std::string Name
bool Curve1Enabled, Curve2Enabled, Curve3Enabled
bool Curve1Visible, Curve2Visible, Curve3Visible Methods:
CurveHolder()
CurveHolder(int curvenum, std::string theName)
CurveHolder(const CurveHolder& val)
~CurveHolder()
CurveHolder& operator=(const CurveHolder& val)
void Reset(int curvenum, std::string theName)
std::string GetName()
void SetName(std::string theName)
int GetNumCurves()
Curve* GetCurve(int num)
bool GetEnabled(int curvenum)
void SetEnabled(int curvenum, bool val)
bool GetVisible(int curvenum)
void SetVisible(int curvenum, bool val)
void SetInputRange(real64 lo, real64 hi)
void SetOutputRange(real64 lo, real64 hi)
void GetInputRange(real64 &lo, real64 &hi)
void GetOutputRange(real64 &lo, real64 &hi)
Curve::ClampType GetClampValue()
void SetClampValue(Curve::ClampType val)
Curve::RangeClampType GetRangeClampValue()
void SetRangeClampValue(Curve::RangeClampType val)
real64 EvalGrey(real64 v)
flag IsIdentical(CurveHolder *cc)
void StartAccumulate()
void AddSpuriousPoint(real64 v)
flag Load(MojoInputStream &in)
flag Save(MojoOutputStream &out)
|
|
FunContext
class FunContext There is a global FunContext available for any use. A pointer to this can be obtained by GlobalCore()->globFC. The time, cam, and lights fields of this context should not be changed. Data:
real64 time
Vec3d point
Vec3d normal
Vec3d viewDir
uint32 signature
Material *mtl
int32 matIndex
RenderObject *obj
Camera *cam
TList<Light *> *lights
real64 altitude
real64 slope
Vec3d unitD
Vec3d dPV
real64 dP
Vec3d fractalPoint
flag doShadows
Vec2d UV
Vec2d helperPos
Vec2d screenPos
flag doingSliderChange
real64 v1Time
flag worthMyWhile
Vec3d objectPoint
flag heightTexture
uint32 hackflags Methods:
static real64 FindBestdP(int x, int xs, int y, int ys, Vec4d *points, FunContext *fc);
|
|
Function
class Function : public ParamObj A function should be able to evaluate its result as any type. As a fallback, a function can use the Converter class available from the parameter that it's overriding. In many cases the conversion won't have any meaning, but will at least produce a sensible default value that won't cause math problems for the renderers. Data:
Tlist<Param *> *paramList
Param *param
int32 xpos, ypos
flag collapsed
flag active
flag useFixedDP
uint32 useFlags
Param *minder Methods:
Function() : ParamObj()
~Function()
virtual void SetOverriddenParam(Param *p)
Param *GetOverriddenParam(int i)
int GetNumOverriddenParams()
void RemoveOverriddenParam(Param *p)
virtual void Update(int32 which, FunContext *fc)
flag Active()
virtual void SetActive(flag a)
flag UsingFixedDP()
void SetFixedDP(flag a)
virtual MojoString Category() The following Eval methods all return a single value, the result of the function based on its parameters at the context given by the passed FunContext.
virtual void Eval(int32 &v, FunContext *fc) = 0
virtual void Eval(real64 &v, FunContext *fc) = 0
virtual void Eval(Vec2d &d, FunContext *fc) = 0
virtual void Eval(Vec3d &d, FunContext *fc) = 0
virtual void Eval(Vec4d &d, FunContext *fc) = 0
virtual void Eval(Quaternion &d, FunContext *fc) = 0
virtual void Eval(Color &d, FunContext *fc) = 0
virtual void Eval(ColorA &d, FunContext *fc) = 0
virtual void Eval(MojoString &d, FunContext *fc) = 0 The following SIMDEval methods all evaluate a 2D array of values, based on the parameters and the array of passed in contexts. Nodes may use the neighbor information available from the context array to calculate accurate sample sizes. (see FunContext::FindBestDP()). Function nodes which are either leaf nodes (nodes with no parameters) or whose parameters cannot be overridden by functions may use the default implementation. All other nodes should provide SIMD style evaluation routines to ensure that any nodes higher up the tree get the required information. (See the Function node sample code.)
virtual void SIMDEval(int32 *v, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(real64 *v, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(Vec2d *d, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(Vec3d *d, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(Vec4d *d, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(Quaternion *d, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(Color *d, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(ColorA *d, FunContext *fc, int32 xs, int32 ys)
virtual void SIMDEval(String *d, FunContext *fc, int32 xs, int32 ys)
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList<Plugged *> *list)
virtual Plugged *Clone(flag func = true, flag subP = true)
void SetPosition(int32 xp, int32 yp)
void GetPosition(int32 &xp, int32 &yp)
void Collapse(flag c)
flag IsCollapsed()
virtual flag IsValidGenerator()
virtual uint32 UsageFlags()
void DeleteIfUnconnected() Remarks: The Generator Texture Editor (and Material Editor) make certain assumptions about the organization of function nodes so that they fit the "template" required by the editors. Nodes should set the following flags in the useFlags member only if they meet the requirements listed. If the flag is set, then the node will show up as an option in the editors. See ParamObj for more information about parameters and sub-plugins. GlobalSpace: Indicates that this node can be used as a space for global textures (i.e. not inside parameter bombs). No assumptions are made about parameters or sub-plugs. Example: World Space PBSpace: Indicates that this node can be used as a space inside a parameter bomb. Example: Helper Space. (See HasHelper) IsGenerator: Indicates that this node can be used as a fractal/generator node in the texture editor. Assumes that the first parameter is the point to evaluate the node at. Example: MonoFractal. (See HasDimension, HasBasis, ReturnsColor.) IsDistortion: Indicates that the node can be used as a distortion in the editor. Assumes the first parameter is the point to evaluate at. Example: MonoFractal. HasDimension: Indicates the last parameter is an integer used to control the dimensionality of the Generator/Distortion. For example, when using the Altitude space, fractals and noises only need to be 1-dimensional. When using World Space, they need to be 3 dimensional. If this flag is set, the editor can change the dimension from 1 to 4 by setting the last parameter and the node will behave accordingly. Example: MonoFractal. HeightSpace: Indicates that this space can be used when calculating height textures. Certain spaces (e.g. Altitude, Slope, Normal) are not defined until a height calculation is complete. Set this flag if the node is not one of these spaces. Example: WorldSpace. HasBasis: Indicates that the first sub-plugin of a generator or distortion is a basis function. Some nodes (e.g. Bitmap) use something other than a basis function and should not set this flag. Example: MonoFractal. HasHelper: Indicates that the first sub-plugin is a helper object. Generally used when the PBSpace flag is also set. Example: HelperSpace. ReturnsColor: Indicates that a generator node returns a color value rather than a single grey scale value. This causes the editor to provide a single set of color mapping curves in the output section rather than the usual input curve, gradient, output curves selection. No assumptions are made. Example: Bitmap Node.
|
|
HelperObject
class HelperObject : public PreviewObject Data:
flag constrain
HelperObject *replacement Methods:
HelperObject() : PreviewObject()
virtual flag WorldToLocal(const Vec3d &worldPoint, Vec2d &localPoint, real64 *blend = NULL) = 0
virtual void LocalToWorld(const Vec2d &localPoint, Vec3d &worldPoint) = 0
virtual real64 BlendVal(const Vec3d &worldPoint) = 0
inline void SetConstrain(flag c)
inline flag Constrained()
OTYPE ObjectType()
virtual Plugged *Clone(flag func = true, flag subP = true)
static CurveHolder MakePBHeavyCurve()
bool ExportTerrain(TerrainData &data, int xres, int yres)
virtual double GetAspectRatio()
|
|
ImageFileHandler
class ImageFileHandler : public ParamObj Data:
MojoString baseFileName
int32 extIndex Methods:
virtual MojoString &GetBaseName()
virtual void SetBaseName(MojoString &str)
virtual std::vector <MojoString> &GetExtension() = 0
virtual std::vector <MojoString> &GetUIExtension() = 0
virtual flag HandleImage(Bitmap *bm, int32 frameNum) = 0
virtual flag StartImageSequence(int32 numFrames)
virtual flag EndImageSequence(flag error = FALSE)
virtual flag HandleSingleImage(Bitmap *bm) = 0
virtual Bitmap *LoadImage(MojoString &name)
virtual flag CanLoadImage(MojoString &name)
OTYPE ObjectType()
virtual flag IsCubicVR() = 0
virtual flag IsMovie() = 0
virtual flag IsStill() = 0
virtual flag DoRunTimeCheck()
virtual void SetFPS(int val)
|
|
Light
class Light : public PreviewObject
enum LIGHTTYPE { LT_ERROR = 0, LT_POINT, LT_DIRECTIONAL, LT_AMBIENT, LT_SPOT } Data:
LIGHTTYPE lighttype
flag castShadows Methods:
Light( LIGHTTYPE t) : PreviewObject()
~Light()
virtual Color Lighting(FunContext *fc, Vec3d &dir, flag realTime = FALSE) = 0
virtual Vec4d GlLightPos() = 0
virtual Vec4d GlLightCol() = 0
virtual flag ShadowPrepare(FunContext *fc, RenderCallback *rcb = NULL)
virtual void ShadowClose()
virtual real64 InShadow(FunContext *fc)
virtual LIGHTTYPE GetType() const
virtual void SetCastShadows(flag f)
virtual flag GetCastShadows()
virtual flag CanCastShadows()
virtual void SetLocation(const Vec3d &point)
virtual void SetDirection(const Vec3d &dir)
virtual void SetType(const LIGHTTYPE type)
|
|
Material
class Material : public ParamObj Data:
flag active Methods:
Material() : ParamObj()
~Material()
virtual Color Shade(FunContext *fc, Color *transp = NULL) = 0
virtual void SIMDShade(Color *res, FunContext *fc, int32 xs, int32 ys, Color *transp = NULL)
virtual Color PreviewColor() = 0
virtual Color Diffuse() = 0
virtual Color Specular() = 0
virtual real64 Shininess() = 0
virtual Color Transparency()
virtual Color UnlitShade(FunContext *fc) = 0
virtual Color glShade(FunContext *fc) = 0
virtual real64 Displacement(FunContext *fc)
virtual void SIMDDisplacement(real64 *res, FunContext *fc, int32 xs, int32 ys)
virtual flag DoDisplacement(FunContext *fc)
virtual bool IsLeafNode()
void SetActive(bool a)
flag Active()
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList<Plugged *> *list)
|
|
Matrix
class Matrix Data:
real64 m[4][4] Methods:
inline Matrix()
inline Matrix(const Matrix &v)
void SetIdentity()
inline Matrix operator-()
inline Matrix operator+(const Matrix &v)
inline Matrix operator-(const Matrix &v)
inline Matrix operator*(const Matrix &v)
inline Vec3d operator*(const Vec3d &v)
inline Vec4d operator*(const Vec4d &v)
inline int32 operator ==(const Matrix &v)
inline int32 operator !=(const Matrix &v)
Matrix Invert()
Matrix Invert(int32 &fail, real64 epsilon = 1.0e-10)
Matrix Transpose()
real64 Determinant()
real64 Cofactor(int32 x, int32 y)
Quaternion ToQuaternion()
void SetRotateX(real64 ang)
void SetRotateY(real64 ang)
void SetRotateZ(real64 ang)
Vec3d Right()
Vec3d Up()
Vec3d Direction()
void SetAxisAngle( real64 theta, real64 x, real64 y, real64 z)
|
|
Noise
class Noise : public ParamObj Data:
flag compat102 Methods:
Noise() : ParamObj()
~Noise()
virtual real64 Eval(real64 v) = 0
virtual real64 Eval(Vec2d &v) = 0
virtual real64 Eval(Vec3d &v) = 0
virtual real64 Eval(Vec4d &v) = 0
virtual void VEval(real64 v, real64 &dv) = 0
virtual void VEval(Vec2d &v, Vec2d &dv) = 0
virtual void VEval(Vec3d &v, Vec3d &dv) = 0
virtual void VEval(Vec4d &v, Vec4d &dv) = 0
virtual real64 DCValue()
virtual real64 OctaveCorrect()
flag Load(MojoInputStream &in)
|
|
Object
class Object : public ParamObj The Object class contains information regarding hierarchies, pivots and groups (not documented below). All this is currently unimplemented. Data:
Matrix toWorld, fromWorld
flag renderable
flag previewable Methods:
Object()
~Object()
virtual void Translate(Vec3d d, Matrix *space = NULL, Matrix *iSpace = NULL)
virtual void Scale(Vec3d s, Matrix *space = NULL, Matrix *iSpace = NULL)
virtual void Rotate(Vec3d a, real64 ang, Matrix *space = NULL, Matrix *iSpace = NULL)
virtual void SetUnitScale()
virtual void TransformEnd()
virtual void ConformMatrices()
virtual Vec3d FindTransformCentre()
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList<Plugged *> *list)
|
|
Param
class Param The Param class is designed with support for key frame animation, but this is currently unsupported in MojoWorld 1.x. It's assumed that parameters will contain a single value at time 0.0 and that the time field of the FunContext will be 0.0. See Also:class SParam Data:
Function *func
Tlist<Function *> minders;
ParamObj *object
flag canFunction
void *vEntries
int32 numEntries
int32 maxEntries
real64 *times
Converter *conv
uint32 overrideID
MojoString name
MojoString tooltip
MojoString longhelp
flag hidden
flag live
flag noStates
int32 group
WidgetType widgetType
uint32 *minderID
int32 numMinders Methods:
Param()
~Param()
virtual PTYPE Type() = 0
virtual WidgetType GeneratorWidget() = 0
virtual WidgetType ProWidget() = 0
virtual int32 GetInt(FunContext *fc) = 0
virtual real64 GetDouble(FunContext *fc) = 0;
virtual Vec2d GetVec2d(FunContext *fc) = 0;
virtual Vec3d GetVec3d(FunContext *fc) = 0;
virtual Vec4d GetVec4d(FunContext *fc) = 0;
virtual Quaternion GetQuaternion(FunContext *fce) = 0;
virtual Color GetColor(FunContext *fc) = 0;
virtual ColorA GetColorA(FunContext *fc) = 0;
virtual MojoString GetString(FunContext *fc) = 0;
void Get(int32& val, FunContext *fc)
virtual int32 GetBaseInt() = 0
virtual void SIMDGetInt(int32 *v, FunContext *fc, int32 xs, int32 ys) = 0
virtual void Set(int32 v, FunContext *fc) = 0
void SetFromParam(Param* otherparam, PTYPE ptype, FunContext *fc)
virtual void GetRange(int32& low, int32& high) = 0
virtual void SetRange(const int32 &low, const int32 &high) = 0
void SetFunction(Function *fn)
void RemoveFunction()
Function *GetFunction()
void SetConverter(Converter *conv)
Converter *GetConverter()
virtual flag Load(FileStream *in) = 0
virtual flag Save(FileStream *out) = 0
virtual flag PostLoad(TList<Plugged *> *list) = 0
virtual flag IsIdentical(Param *p) = 0
virtual Param *Clone(ParamObj *newObj = NULL) = 0
virtual void Copy(Param *p) = 0
virtual void StartAccumulate() = 0
void AddToMinders(Function *fn)
|
|
ParamObj
class ParamObj : public Plugged The ParamObj class provides the following:
Types:
enum PARAMOBJ_ITEM {NAME, PARAM, CURVE, GRADIENT, SUBPLUG, SEPERATOR} Data:
Param **params
int32 numParams
TList<ParamObj *> *dependsOn
TList<ParamObj *> *dependedOnBy
Curve **curves
int32 numCurves
Gradient **gradients
int32 numGradients
Plugged **subPlugs
int32 numSubPlugs
MojoString *subPlugNames
uint32 *subPlugID
uint32 *depended
BaseBUIState *baseState
flag dirty
int32 numGroups
int m_UICallbackIDCounter
std::vector < POBJ_ITEMPAIR > StackDisplayList
flag NameVisible Methods:
ParamObj()
~ParamObj()
int32 NumParams()
Param *GetParam(int32 i)
virtual void Update(int32 which, FunContext *fc)
flag CheckForCycles(ParamObj *new_obj)
int32 FindParamIndex(MojoString &name)
int32 FindParamFromPtr(Param *p)
Param *GetParamFromName(MojoString &name)
virtual void CreateDefaultParameter(int32 i, PTYPE type)
int32 NumCurves()
Curve *GetCurve(int32 i)
int32 NumGradients()
Gradient *GetGradient(int32 i)
int32 NumSubPlugs()
Plugged *GetSubPlug(int32 i)
virtual flag SetSubPlug(int32 i, Plugged *plug)
virtual void SubPlugType(int32 i, std::vector<OTYPEFamilyPair> &list)
virtual SPWidgetType SubPlugWidgetType(int32 i)
virtual flag SubPlugCreate(int32 i)
MojoString GetSubPlugName(int32 i)
flag CheckForSubPlugCycles(Plugged *plug)
void SetDirty()
int32 GetNumGroups()
MojoString &GetGroupName(int32 i)
bool GetParamsInGroup(int32 i, std::vector<Param*> &list)
int32 NumDependsOn()
void AddDependsOn(ParamObj *obj)
flag RemoveDependsOn(ParamObj *obj)
ParamObj *GetDependsOn(int32 i)
flag ReplaceDependsOn(ParamObj *obj, int32 i)
flag ReplaceDependsOn(ParamObj *obj, ParamObj *old)
flag DependsOn(ParamObj *obj)
void TellDependsOn(DependMessage mess, void *param, FunContext *fc = NULL)
int32 NumDependedOnBy()
void AddDependedOnBy(ParamObj *obj)
flag RemoveDependedOnBy(ParamObj *obj)
ParamObj *GetDependedOnBy(int32 i)
flag ReplaceDependedOnBy(ParamObj *obj, int32 i)
flag ReplaceDependedOnBy(ParamObj *obj, ParamObj *old)
flag DependedOnBy(ParamObj *obj)
void TellDependedOnBy(DependMessage mess, void *param, FunContext *fc = NULL)
virtual void HandleDependsOnMessage(DependMessage mess, void *param, FunContext *fc = NULL)
virtual void HandleDependedOnByMessage(DependMessage mess, void *param, FunContext *fc = NULL)
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList<Plugged *> *list)
|
|
Plugged
class Plugged Data:
uint32 saveID Methods:
virtual ID UniqueID() = 0
virtual OTYPE ObjectType() = 0
virtual char *Name() = 0
virtual void *Execute(void *p1, void *p2, void *p3, void *p4)
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList<Plugged *> *list)
|
|
Plugin
class Plugin Methods:
virtual ID UniqueID() = 0
virtual OTYPE Type() = 0
virtual Plugged *Create() = 0
virtual char *Description() = 0
|
|
PreviewObject
class PreviewObject : public Object Data:
Color preColor
Color selColor Methods:
PreviewObject() : Object()
~PreviewObject()
virtual void PreparePreview(Camera *cam, FunContext *fc)
virtual void UpdatePreview(Camera *cam, FunContext *fc)
virtual void SetPreviewQuality(real64 pq)
virtual void WireDraw(DrawingContext *dc)
virtual void ShadeDraw(DrawingContext *dc)
virtual void TextureDraw(DrawingContext *dc)
virtual flag HitTest(Camera *cam, Vec2d pixel, HitInfo &hinfo) = 0
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList<Plugged *> *list)
|
|
Quaternion
class Quaternion A quaternion defines an angle of rotation and an axis about which to rotate. The x, y, z components of the quaternion are the unit axis, multiplied by the sine of half the angle. Then w component is the cosine of half the angle.
E.g.: (where ang is the angle of rotation in radians, and axis is a unit vector to rotate about)
real64 sa = sin(ang*0.5);
real64 ca = cos(ang*0.5);
q.x = axis.x*sa;
q.y = axis.y*sa;
q.z = axis.z*sa;
q.w = ca;
In general, quaternions should be unit, where x2 + y2 + z2 + w2 == 1.0 Data:
real64 x, y, z, w Methods:
inline Quaternion(real64 pw, real64 px, real64 py, real64 pz)
inline Quaternion()
inline Quaternion(const Quaternion &v)
inline real64 &operator[] (const int32 i)
inline Quaternion operator+(const real64 &v)
inline Quaternion operator-(const real64 &v)
inline Quaternion operator*(const real64 &v)
inline Quaternion operator/(const real64 &v)
inline Quaternion operator-()
inline Quaternion operator+(const Quaternion &v)
inline Quaternion operator-(const Quaternion &v)
inline Quaternion operator*(const Quaternion &v)
inline Quaternion operator/(const Quaternion &v)
inline int32 operator ==(const Quaternion &v)
inline int32 operator !=(const Quaternion &v)
inline real64 Length() const
inline real64 Length2()
inline void Normalize()
Matrix ToMatrix()
|
|
Renderer
class Renderer : public Plugged Methods:
Renderer() : Plugged()
~Renderer()
virtual flag PrepareToRender(TList<PreviewObject *> *scene, Camera *cam, real64 time) = 0
virtual flag Render(Bitmap *result, RenderCallback *rcb) Support Classes: The renderer also makes use of two support classes, defined here for the time being. These classes will probably change, as the goblin bitmap class comes available, and the actual UI requirements for the renderers become clearer.
class Bitmap
{
public:
uint8 *data; // pointer to the image data
int32 wid, hgt, channels; // resolution and number of channels
Bitmap();
Bitmap(int32 wid, int32 hgt, int32 channels);
~Bitmap();
};
class RenderCallback
{
public:
virtual flag UpdateImageBlock(int32 lx, int32 ly, int32 hx, int32 hy) = 0;
// return TRUE to continue render, false to cancel.
};
|
|
RenderObject
class RenderObject : public PreviewObject Data:
uint32 mtlID
Material *mtl Methods:
RenderObject() : PreviewObject()
~RenderObject()
virtual flag Intersect(Ray &ray, Intersection &inter, FunContext *fc)
virtual int32 NumSubPrims()
virtual SubPrimitive *GetSubPrim(int32 i)
virtual void RenderPrepare(FunContext *fc)
virtual flag Load(FileStream *in)
virtual flag Save(FileStream *out)
virtual flag PostLoad(TList<Plugged *> *list) Support Classes: These two classes are used by the ray trace interface to perform ray intersections with objects. These will evolve as the shipping ray tracer gets solidified.
class Ray
{
public:
Vec3d from;
// ray start and direction (direction is unit)
Vec3d dir;
real64 startT, endT;
// t parameters of the segment we're interested in
int32 level;
// how many bounces has this done?
};
class Intersection
{
public:
Vec3d hit; // hit point
Vec3d norm; // UNIT normal at hit
real64 rayT; // the ray parameter
RenderObject *ob; // what we actually hit
Ray ray; // the ray that was fired to create this hit.
};
|
|
Satellite
class Satellite : public PreviewObject Data:
RenderObject *obj
Light *light Methods:
Satellite() : PreviewObject()
~Satellite()
OTYPE ObjectType()
virtual void SetOrbitalPosition(float val)
virtual void SetOrbitalRadius(float val)
virtual real64 GetOrbitalRadius()
virtual void SetTimeOfYear(float val)
virtual real64 GetOrbitalPosition()
virtual void RotateOrbitalPlane(const Vec3d &axis, real64 ang, const Vec3d &mainAxis)
|
|
SParam
template < class T > class SParam : public Param Data:
Interpolator<T> *interp
T *entries Methods:
SParam(T v) : Param()
~SParam()
void LocalSet(T v, FunContext *fc)
void Get(T &t, FunContext *fc)
PTYPE Type()
inline int32 GetInt(FunContext *fc)
inline real64 GetDouble(FunContext *fc)
inline Vec2d GetVec2d(FunContext *fc)
inline Vec3d GetVec3d(FunContext *fc)
inline Vec4d GetVec4d(FunContext *fc)
inline Quaternion GetQuaternion(FunContext *fc)
inline Color GetColor(FunContext *fc)
inline ColorA GetColorA(FunContext *fc)
inline String GetString(FunContext *fc)
void VectorGetInt(int32 *v, FunContext *fc, int32 num)
void VectorGetDouble(real64 *v, FunContext *fc, int32 num)
void VectorGetVec2d(Vec2d *v, FunContext *fc, int32 num)
void VectorGetVec3d(Vec3d *v, FunContext *fc, int32 num)
void VectorGetVec4d(Vec4d *v, FunContext *fc, int32 num)
void VectorGetQuaternion(Quaternion *v, FunContext *fc, int32 num)
void VectorGetColor(Color *v, FunContext *fc, int32 num)
void VectorGetColorA(ColorA *v, FunContext *fc, int32 num)
void VectorGetString(String *v, FunContext *fc, int32 num)
inline void Set(int32 v, FunContext *fc)
inline void Set(real64 v, FunContext *fc)
inline void Set(Vec2d v, FunContext *fc)
inline void Set(Vec3d v, FunContext *fc)
inline void Set(Vec4d v, FunContext *fc)
inline void Set(Quaternion v, FunContext *fc)
inline void Set(Color v, FunContext *fc)
inline void Set(ColorA v, FunContext *fc)
inline void Set(String v, FunContext *fc)
flag Load(FileStream *in)
flag Save(FileStream *out)
flag PostLoad(TList<Plugged *> *list)
void SetInterpolator(Interpolator<T> *interp)
Interpolator<T> *GetInterpolator()
|
|
SubPrimitive
class SubPrimitive Data:
RenderObject *object
MicroGrid *grid
int32 bucketCount
BBox2d screenBox
real64 closeDist
virtual void PrimBounds(BBox3d &box, FunContext *fc) = 0
virtual flag Split(TList<SubPrimitive *> *list, FunContext *fc) = 0
virtual void Dice(int32 &xs, int32 &ys, FunContext *fc) = 0
virtual ~SubPrimitive() Support Classes: The sub-primitives need to dice themselves into grids of micropolygons. This is the current definition of the MicroGrid class.
class MicroGrid
{
public:
MicroGrid(RenderObject *ro, int32 xs, int32 ys);
~MicroGrid();
int32 xSize, ySize;
// The dimensions of the grid.
// There are size+1 points, making size quads.
int32 displaced; // are the vertices displaced?
RenderObject *object;
int32 screenDone; // have we calculated the screen points yet?
Vec3d *points; // the original world space points
Vec3d *eyePoints;
// and the points transformed into eye space
Vec2d *screenPoints; // cache of the points in screen space
Vec3d *normals; // world space normals
Color *colors;
// _preshaded_ colors returned from the material.
// (why do we need normals?)
flag ScreenPointInside(int32 x, int32 y, Vec2d p, real64 &z);
// is the screen point inside the given poly?
// (and find the z if it is...)
BBox2d FindScreenBounds(int32 x, int32 y);
// find the screen bounds of the given poly
void Shade(FunContext *fc); // calls the material Shade() on all points
};
|
|
Vec2d
class Vec2d Data:
real64 x, y Methods:
inline Vec2d(real64 px, real64 py)
inline Vec2d()
inline Vec2d(const Vec2d &v)
inline real64 &operator[] (const uint32 i)
inline Vec2d operator+(const Vec2d &v)
inline Vec2d operator-(const Vec2d &v)
inline Vec2d operator*(const Vec2d &v)
inline Vec2d operator/(const Vec2d &v)
inline Vec2d operator+(const real64 &v)
inline Vec2d operator-(const real64 &v)
inline Vec2d operator*(const real64 &v)
inline Vec2d operator/(const real64 &v)
inline int32 operator==(const Vec2d &v)
inline int32 operator!=(const Vec2d &v)
inline Vec2d operator -()
inline real64 operator^(Vec2d &v)
inline real64 operator%(Vec2d &v)
inline real64 Length()
inline real64 Length2()
inline void Normalize() Friend Functions: The following functions provide a much more readable version of the dot and cross product.
inline real64 DotProd(Vec2d a, Vec2d b)
|
|
Vec3d
class Vec3d Data:
real64 x, y, z Methods:
inline Vec3d(real64 px, real64 py, real64 pz)
inline Vec3d()
inline Vec3d(const Vec3d &v)
inline real64 &operator[] (const int32 i)
inline Vec3d operator+(const Vec3d &v)
inline Vec3d operator-(const Vec3d &v)
inline Vec3d operator*(const Vec3d &v)
inline Vec3d operator/(const Vec3d &v)
inline Vec3d operator+(const real64 &v)
inline Vec3d operator-(const real64 &v)
inline Vec3d operator*(const real64 &v)
inline Vec3d operator/(const real64 &v)
Vec3d &operator*=(const Matrix &m)
inline int32 operator ==(const Vec3d &v)
inline int32 operator !=(const Vec3d &v)
inline Vec3d operator -()
inline Vec3d operator^(Vec3d &v)
inline real64 operator%(Vec3d &v)
inline real64 Length()
inline real64 Length2()
inline void Normalize() Friend Functions: The following functions provide a much more readable version of the dot and cross product.
inline real64 DotProd(Vec3d a, Vec3d b)
|
|
Vec4d
class Vec4d Data:
real64 x, y, z, w Methods:
inline Vec4d(real64 px, real64 py, real64 pz, real64 pw)
inline Vec4d()
inline Vec4d(const Vec4d &v)
inline real64 &operator[] (const int32 i)
inline Vec4d operator+(const Vec4d &v)
inline Vec4d operator-(const Vec4d &v)
inline Vec4d operator*(const Vec4d &v)
inline Vec4d operator/(const Vec4d &v)
inline Vec4d operator+(const real64 &v)
inline Vec4d operator-(const real64 &v)
inline Vec4d operator*(const real64 &v)
inline Vec4d operator/(const real64 &v)
inline int32 operator ==(const Vec4d &v)
inline int32 operator !=(const Vec4d &v)
inline Vec4d operator -()
inline real64 operator%(Vec4d &v)
inline real64 Length()
inline real64 Length2()
inline void Normalize() Friend Functions: The following function provides a much more readable alternative for Dot Product.
inline real64 DotProd(Vec4d a, Vec4d b)
|