radiosity.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: radiosity.h
00004 
00005     DESCRIPTION: Definitions for radiosity plugin
00006 
00007     CREATED BY: Cleve Ard
00008 
00009     HISTORY:
00010         [d.levesque | 21August2001]
00011             Addition of IRadiosityEffectExtension interface.
00012 
00013  *> Copyright (c) 2000, All Rights Reserved.
00014  **********************************************************************/
00015 
00016 
00017 #pragma once
00018 
00019 #include "render.h"
00020 
00021 typedef SFXParamDlg RadiosityParamDlg;
00022 
00023 #pragma warning(push)
00024 #pragma warning(disable:4100)
00025 
00026 /*=====================================================================
00027  * Radiosity Interface class
00028  *===================================================================*/
00029 
00061 class RadiosityEffect : public SpecialFX {
00062 public:
00063     enum CompletionCode {
00064         PROCESS_COMPLETED,
00065         PROCESS_TIMED_OUT,
00066         PROCESS_CANCELED,
00067         PROCESS_ABORTED
00068     };
00069 
00070     RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, 
00071           PartID& partID,  RefMessage message) {return REF_SUCCEED;}
00072     SClass_ID SuperClassID() {return RADIOSITY_CLASS_ID;}
00073     
00076     IOResult Save(ISave *isave) { return SpecialFX::Save(isave); }
00079     IOResult Load(ILoad *iload) { return SpecialFX::Load(iload); }
00080 
00082 
00090     virtual void SetActive(
00091         bool        active,
00092         TimeValue   t) 
00093     {
00094         if (active ^ (TestAFlag(A_ATMOS_DISABLED) == 0)) {
00095             if (active) {
00096                 ClearAFlag(A_ATMOS_DISABLED);
00097             }
00098             else {
00099                 SetAFlag(A_ATMOS_DISABLED);
00100             }
00101             NotifyDependents(FOREVER, (PartID)PART_ALL, REFMSG_CHANGE);
00102         }
00103     }
00104 
00106 
00113     virtual IOResult Merge(ILoad* iload, const Class_ID& id) { return IO_OK; }
00114 
00116 
00123     virtual RadiosityParamDlg *CreateParamDialog(IRendParams *ip)   { return NULL; }
00124 
00125     // Implement this if you are using the ParamMap2 AUTO_UI system and the 
00126     // atmosphere has secondary dialogs that don't have the effect as their 'thing'.
00127     // Called once for each secondary dialog for you to install the correct thing.
00128     // Return TRUE if you process the dialog, false otherwise.
00130 
00140     virtual BOOL SetDlgThing(RadiosityParamDlg* dlg) { return FALSE; }
00141 
00142     // Render access
00143 
00145 
00153     virtual bool UseLight(INode* node, bool recalcSolution = false) { return true; }
00154 
00157 
00164     virtual int NumLightDesc( ) const = 0;
00165     
00168 
00177     virtual void CreateLightDesc(ObjLightDesc** buffer) = 0;
00178 
00180 
00193     virtual void RunProcess(
00194         TimeValue               t,
00195         RenderGlobalContext*    rgc,
00196         bool                    interactiveRender
00197     ) = 0;
00198 
00200 
00208     virtual void StopProcess(bool allowAbort = true) = 0;
00209 
00210     // Abort the radiosity process. This method aborts the global
00211     // illumination process quickly. If AbortProcess is called, RunProcess
00212     // may start at the beginning the next time it is called.
00214 
00216     virtual void AbortProcess() = 0;
00217 
00218     // Wait for radiosity process to complete. The RendContext is
00219     // used to provide progress reporting to the user, and to detect when the
00220     // cancel button is pressed. If the process doesn't complete in timeout
00221     // milliseconds, it is stopped and WaitForCompletion returns.
00222     // Completion criteria is set by the user in the radiosity plugin
00223     // UI. If the user cancels the render, the radiosity plugin should attempt
00224     // to stop the process, but allow the user to abort, when stopping
00225     // takes an excessive amount of time.
00227 
00238     virtual CompletionCode WaitForCompletion(
00239         RendContext*    rc = NULL,
00240         DWORD       timeout = INFINITE
00241     ) = 0;
00242 
00243 
00245 
00262     virtual bool NeedsCamVerts(
00263         TimeValue               t,
00264         RenderGlobalContext*    rgc,
00265         bool                    interactiveRender,
00266         bool                    saveMem
00267     ) { return false; }
00268 };
00269 
00270 
00271 /*=====================================================================
00272  * Radisity Core Interface class
00273  *===================================================================*/
00274 
00275 // This class is used to get access to the radiosity plugin
00276 // and UI.
00277 #define RADIOSITY_INTERFACE Interface_ID(0x6711e7a, 0x5b504baa)
00278 
00291 class RadiosityInterface : public FPStaticInterface {
00292 public:
00294     virtual void OpenRadiosityPanel()=0;
00296     virtual void CloseRadiosityPanel()=0;
00298     virtual void MinimizeRadiosityPanel()=0;
00299 
00301 
00305     virtual RadiosityEffect* GetRadiosity() const = 0;
00306     
00308 
00317     virtual void SetRadiosity(RadiosityEffect* op) = 0;
00318 };
00319 
00320 
00321 /*=====================================================================
00322  * Class IRadiosityEffectExtension
00323  *
00324  * Provides extended functionality to class RadiosityEffect. To use
00325  * this functionality with a RadiosityEffect class, derive the class
00326  * from both RadiosityEffect and IRadiosityEffectExtension, and implement
00327  * RadiosityEffect::GetInterface() to return a pointer to this interface
00328  * on request.
00329  *===================================================================*/
00330 
00331 #define IRADIOSITYEFFECT_EXTENSION_INTERFACE Interface_ID(0x703149db, 0x43ed63b8)
00332 
00347 class IRadiosityEffectExtension : public BaseInterface {
00348 public:
00350 
00356     virtual bool UseDefaultLight(const DefaultLight& defLight, bool recalcSolution = false) const = 0;
00357 
00360 
00387     virtual bool IsInterestedInChannels(PartID part) const { return true; }
00388 
00389     // -- from BaseInterface
00391 
00394     virtual Interface_ID GetID() { return IRADIOSITYEFFECT_EXTENSION_INTERFACE; }
00395 };
00396 
00397 #pragma warning(pop)
00398 
00399 //===========================================================================
00400 //
00401 // Class IRadiosityRenderParameters
00405 //===========================================================================
00406 #define IRADIOSITY_RENDER_PARAMETERS_INTERFACE Interface_ID(0x39981beb, 0x38df21ad)
00407 
00408 class IRadiosityRenderParameters : public BaseInterface {
00409 
00410 public:
00411 
00412     virtual bool GetReuseDirectIllumination(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00413     virtual void SetReuseDirectIllumination(bool in_reuse, TimeValue in_time = 0) = 0;
00414 
00415     virtual bool GetRegather(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00416     virtual void SetRegather(bool in_gather, TimeValue in_time = 0) = 0;
00417 
00418     virtual int GetRaysPerSample(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00419     virtual void SetRaysPerSample(int in_raysPerSample, TimeValue in_time = 0) = 0;
00420 
00421     virtual float GetFilterRadius(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00422     virtual void SetFilterRadius(float in_radius, TimeValue in_time = 0) = 0;
00423 
00424     virtual bool GetClampEnabled(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00425     virtual void SetClampEnabled(bool in_clamp, TimeValue in_time = 0) = 0;
00426 
00427     virtual float GetClampValue(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00428     virtual void SetClampValue(float in_clampValue, TimeValue in_time = 0) = 0;
00429 
00430     virtual bool GetAdaptiveEnabled(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00431     virtual void SetAdaptiveEnabled(bool in_adaptive, TimeValue in_time = 0) = 0;
00432 
00433     virtual int GetSampleSpacing(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00434     virtual void SetSampleSpacing(int in_sampleSpacing, TimeValue in_time = 0) = 0;
00435 
00436     virtual float GetSubdivionContrast(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00437     virtual void SetSubdivionContrast(float in_contrast, TimeValue in_time = 0) = 0;
00438 
00439     virtual int GetMinSampleSpacing(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00440     virtual void SetMinSampleSpacing(int in_minSpacing, TimeValue in_time = 0) = 0;
00441 
00442     virtual bool GetShowSamples(TimeValue in_time = 0, Interval *valid = NULL) const = 0;
00443     virtual void SetShowSamples(bool in_show, TimeValue in_time = 0) = 0;
00444 
00445     // -- from BaseInterface
00446     virtual Interface_ID GetID() { return IRADIOSITY_RENDER_PARAMETERS_INTERFACE; }
00447 };
00448