2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

CWE Directory Reorganization

Rearrange directory structure of CWE to be loosely equivalent to
the H'uru Plasma repository.

Part 1: Movement of directories and files.
This commit is contained in:
rarified
2021-05-15 12:49:46 -06:00
parent c3f4a640a3
commit 96903e8dca
4002 changed files with 159 additions and 644 deletions

View File

@ -0,0 +1,112 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "HeadSpin.h"
#include "plRealTimeLightBase.h"
#include "plRealTimeLights.h"
#include "plRTProjDirLightClassDesc.h"
#include "../pnMessage/pnMessageCreatable.h"
#include "../pnKeyedObject/pnKeyedObjectCreatable.h"
#include "../pnNetCommon/pnNetCommonCreatable.h"
#include "../plSurface/plLayerInterface.h"
REGISTER_NONCREATABLE( plLayerInterface );
HINSTANCE hInstance;
int controlsInit = FALSE;
// This function is called by Windows when the DLL is loaded. This
// function may also be called many times during time critical operations
// like rendering. Therefore developers need to be careful what they
// do inside this function. In the code below, note how after the DLL is
// loaded the first time only a few statements are executed.
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
{
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
if (!controlsInit)
{
controlsInit = TRUE;
InitCustomControls(hInstance); // Initialize MAX's custom controls
InitCommonControls(); // Initialize Win95 controls
}
return (TRUE);
}
__declspec(dllexport) const TCHAR* LibDescription()
{
return NULL;
}
__declspec(dllexport) int LibNumberClasses()
{
return 4;
}
__declspec(dllexport) ClassDesc* LibClassDesc(int i)
{
switch (i)
{
case 0: return (ClassDesc*)plRTSpotLightDesc::GetDesc();
case 1: return (ClassDesc*)plRTOmniLightDesc::GetDesc();
case 2: return (ClassDesc*)plRTDirLightDesc::GetDesc();
case 3: return (ClassDesc*)plRTProjDirLightDesc::GetDesc();
default: return 0;
}
}
__declspec(dllexport) ULONG LibVersion()
{
return VERSION_3DSMAX;
}
TCHAR *GetString(int id)
{
static TCHAR buf[256];
if (hInstance)
return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
return NULL;
}

View File

@ -0,0 +1,86 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// Animation Rollout Dialog Proc Class Definition //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.6.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#if 0//ndef _plRTLightBaseAnimDlgProc_h
#define _plRTLightBaseAnimDlgProc_h
#include "../MaxComponent/plNotetrackDlg.h"
///////////////////////////////////////////////////////////////////////////////
//// Dialog Proc for Animation Rollout ////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTLightBaseAnimDlgProc : public ParamMap2UserDlgProc
{
protected:
plNoteTrackDlg fNoteTrackDlg;
HWND fhWnd;
static plRTLightBaseAnimDlgProc fInstance;
static const char *kDecalNameNone;
public:
BOOL DlgProc( TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
void DeleteThis() { fNoteTrackDlg.DeleteCache(); }
void SetThing( ReferenceTarget *m );
static plRTLightBaseAnimDlgProc *Instance() { return &fInstance; }
protected:
void IInitControls( Animatable *anim, IParamBlock2 *pb );
};
#endif //_plRTLightBaseAnimDlgProc_h

View File

@ -0,0 +1,84 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// Animation Rollout ParamBlock for Runtime Lights //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.3.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#if 0//ndef _plRTLightBaseAnimPB_h
#define _plRTLightBaseAnimPB_h
///////////////////////////////////////////////////////////////////////////////
//// Animation Rollout ParamBlock /////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
ParamBlockDesc2 plRTLightBaseAnimPB
(
plRTLightBase::kBlkAnim, _T("anim"), IDS_LIGHT_ANIM, nil, // To be added manually
P_AUTO_CONSTRUCT + P_AUTO_UI, plRTLightBase::kRefAnimParams,
// UI
IDD_LIGHT_ANIM, IDS_LIGHT_ANIM, 0, APPENDROLL_CLOSED, plRTLightBaseAnimDlgProc::Instance(),
plRTLightBase::kAnimName, _T("animName"), TYPE_STRING, 0, 0,
end,
plRTLightBase::kAnimAutoStart, _T("autoStart"), TYPE_BOOL, 0, 0,
end,
plRTLightBase::kAnimLoop, _T("loop"), TYPE_BOOL, 0, 0,
end,
plRTLightBase::kAnimLoopName, _T("loopName"), TYPE_STRING, 0, 0,
end,
end
);
#endif //_plRTLightBaseAnimPB_h

View File

@ -0,0 +1,682 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_LIGHT_PARAM DIALOG DISCARDABLE 0, 0, 108, 60
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Diffuse:",IDC_LIGHT_DIFFUSE,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,36,5,38,10
CONTROL "User1",IDC_LIGHT_COLOR,"ColorSwatch",WS_GROUP,80,4,22,
12
LTEXT "Multiplier:",IDC_STATIC,27,39,30,8
CONTROL "",IDC_LMULT,"CustEdit",WS_GROUP | WS_TABSTOP,59,39,26,
10
CONTROL "",IDC_LMULTSPINNER,"SpinnerControl",WS_GROUP,86,39,7,10
CONTROL "Specular:",IDC_AFFECT_SPECULAR,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,36,20,42,10
CONTROL "User1",IDC_LIGHT_COLOR_SPECULAR,"ColorSwatch",WS_GROUP,
80,19,22,12
CONTROL "On",IDC_LIGHT_ON,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,7,12,24,10
CONTROL "STUB-Ambient Only",IDC_AMBIENT_ONLY_STUB,"Button",
BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,0,50,32,9
END
IDD_SPOTLIGHT DIALOG DISCARDABLE 0, 0, 108, 120
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Light Cone:",IDC_STATIC,2,1,103,75,WS_GROUP
CONTROL "Show Cone ",IDC_SHOW_CONE,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,5,11,50,10
CONTROL "Overshoot",IDC_OVERSHOOT,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,57,11,45,10
RTEXT "Hotspot:",ID_STATIC,12,25,33,8
CONTROL "",IDC_LHOTSIZE,"CustEdit",WS_GROUP | WS_TABSTOP,49,24,
36,10
CONTROL "",IDC_LHOTSIZESPINNER,"SpinnerControl",WS_GROUP,86,24,7,
10
RTEXT "Falloff:",IDC_STATIC,12,36,33,8
CONTROL "",IDC_LFALLOFF,"CustEdit",WS_GROUP | WS_TABSTOP,49,35,
36,10
CONTROL "",IDC_LFALLOFFSPINNER,"SpinnerControl",WS_GROUP,86,35,7,
10
CONTROL "Circle",IDC_CIRCLE_LIGHT,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,48,30,10
CONTROL "Rectangle",IDC_RECT_LIGHT,"Button",BS_AUTORADIOBUTTON,
49,48,45,10
RTEXT "Aspect:",IDC_STATIC,4,61,24,8
CONTROL "",IDC_LASPECT,"CustEdit",WS_GROUP | WS_TABSTOP,29,61,23,
10
CONTROL "",IDC_LASPECT_SPIN,"SpinnerControl",WS_GROUP,53,61,7,10
PUSHBUTTON "Bitmap Fit...",IDC_BITMAP_FIT,62,60,40,12,WS_GROUP
GROUPBOX "Projector Map:",IDC_STATIC,2,78,103,26,WS_GROUP
CONTROL "",IDC_PROJECTOR,"Button",BS_AUTOCHECKBOX | BS_RIGHT |
WS_GROUP | WS_TABSTOP,9,90,9,8
CONTROL "Custom1",IDC_PROJ_MAPNAME,"CustButton",WS_GROUP |
WS_TABSTOP,21,88,67,12
LTEXT "Target Distance:",IDC_STATIC,6,108,55,10
RTEXT "XXXXX",IDC_TARG_DISTANCE,65,108,36,8
END
IDD_FREE_SPOTLIGHT DIALOG DISCARDABLE 0, 0, 108, 178
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Light Cone:",IDC_STATIC,2,2,103,39,WS_GROUP
CONTROL "Show Cone ",IDC_SHOW_CONE,"Button",BS_AUTOCHECKBOX |
NOT WS_VISIBLE | WS_GROUP | WS_TABSTOP,6,13,14,10
RTEXT "Hotspot:",IDC_STATIC,12,14,33,8
CONTROL "",IDC_LHOTSIZE,"CustEdit",WS_GROUP | WS_TABSTOP,49,14,
36,10
CONTROL "",IDC_LHOTSIZESPINNER,"SpinnerControl",WS_GROUP,86,14,7,
10
RTEXT "Falloff:",IDC_STATIC,12,25,33,8
CONTROL "",IDC_LFALLOFF,"CustEdit",WS_GROUP | WS_TABSTOP,49,25,
36,10
CONTROL "",IDC_LFALLOFFSPINNER,"SpinnerControl",WS_GROUP,86,25,7,
10
GROUPBOX "Projector Map:",IDC_STATIC,1,42,104,132,WS_GROUP
CONTROL "Map:",IDC_PROJECTOR,"Button",BS_AUTOCHECKBOX | BS_RIGHT |
WS_GROUP | WS_TABSTOP,5,52,28,10
CONTROL "Custom1",IDC_PROJ_MAPNAME,"CustButton",WS_GROUP |
WS_TABSTOP,35,52,68,11
CONTROL "Illuminate",IDC_ILLUMINATE,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,76,48,10
GROUPBOX "Mode",IDC_STATIC,5,66,92,58
CONTROL "Add",IDC_ADD,"Button",BS_AUTORADIOBUTTON | WS_GROUP |
WS_TABSTOP,11,87,48,10
CONTROL "Multiply",IDC_MULT,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,98,48,10
CONTROL "Brighten",IDC_MADD,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,109,48,10
GROUPBOX "Texture",IDC_STATIC,5,126,91,40
CONTROL "Don't Compress",IDC_PROJ_NOCOMPRESS,"Button",
BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,11,138,
67,10
CONTROL "Don't Mip",IDC_PROJ_NOMIP,"Button",BS_AUTOCHECKBOX |
BS_LEFT | WS_GROUP | WS_TABSTOP,11,150,67,10
END
IDD_OMNI DIALOG DISCARDABLE 0, 0, 108, 20
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Map:",IDC_PROJECTOR,"Button",BS_AUTOCHECKBOX | BS_RIGHT |
WS_GROUP | WS_TABSTOP,4,5,27,10
CONTROL "Custom1",IDC_PROJ_MAPNAME,"CustButton",WS_GROUP |
WS_TABSTOP,32,4,73,12
END
IDD_LIGHT_ATTEN DIALOG DISCARDABLE 0, 0, 108, 72
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX " ",IDC_STATIC,4,2,100,65,
WS_GROUP
CONTROL "Use Attenuation",IDC_LIGHT_ATTENBOOL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,11,2,67,10
LTEXT "Max Distance:",IDC_STATIC,7,16,46,8
CONTROL "",IDC_LIGHT_ATTEN,"CustEdit",WS_GROUP | WS_TABSTOP,55,
15,36,10
CONTROL "",IDC_LIGHT_ATTEN_SPIN,"SpinnerControl",WS_GROUP,92,15,
7,10
CONTROL "Linear Falloff",IDC_LIGHT_ATTEN_LINEAR_RADIO,"Button",
BS_AUTORADIOBUTTON,11,30,56,10
CONTROL "Quadratic Falloff",IDC_LIGHT_ATTEN_QUAD_RADIO,"Button",
BS_AUTORADIOBUTTON,11,41,67,10
CONTROL "No Falloff",IDC_LIGHT_ATTEN_NONE_RADIO,"Button",
BS_AUTORADIOBUTTON,11,52,46,10
END
IDD_LIGHT_SHADOW3 DIALOG DISCARDABLE 0, 0, 108, 212
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Use Global Settings",IDC_GLOBAL_SET,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,5,5,76,10
GROUPBOX "Shadow Type:",IDC_STATIC,1,17,105,30,WS_GROUP
CONTROL "Shadow Maps",IDC_SHADOW_MAPS,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,26,72,10
CONTROL "Ray-Traced Shadows",IDC_RAY_TRACED_SHADOWS,"Button",
BS_AUTORADIOBUTTON,6,35,87,10
GROUPBOX "Shadow Maps:",IDC_STATIC,1,51,105,42,WS_GROUP
LTEXT "Bias",IDC_STATIC,9,60,14,8
CONTROL "",IDC_MAP_BIAS,"CustEdit",WS_GROUP | WS_TABSTOP,4,69,21,
10
CONTROL "",IDC_MAP_BIAS_SPIN,"SpinnerControl",WS_GROUP,25,69,8,
10
LTEXT "Size",IDC_STATIC,43,60,15,8
CONTROL "",IDC_MAP_SIZE,"CustEdit",WS_GROUP | WS_TABSTOP,35,69,
26,10
CONTROL "",IDC_MAP_SIZE_SPIN,"SpinnerControl",WS_GROUP,61,69,8,
10
LTEXT "Smp Range",IDC_STATIC,67,60,38,8
CONTROL "",IDC_MAP_RANGE,"CustEdit",WS_GROUP | WS_TABSTOP,73,69,
21,10
CONTROL "",IDC_MAP_RANGE_SPIN,"SpinnerControl",WS_GROUP,94,69,8,
10
CONTROL "Absolute Map Bias",IDC_ABS_MAP_BIAS,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,8,81,72,10
GROUPBOX "Ray Traced Shadows:",IDC_STATIC,1,97,105,24,WS_GROUP
RTEXT "Bias:",IDC_STATIC,23,109,20,8
CONTROL "",IDC_RT_BIAS,"CustEdit",WS_GROUP | WS_TABSTOP,47,108,
21,10
CONTROL "",IDC_RT_BIAS_SPIN,"SpinnerControl",WS_GROUP,68,108,7,
10
GROUPBOX "Shadow Color:",IDC_STATIC,1,125,105,41,WS_GROUP
CONTROL "User1",IDC_SHADOW_COLOR,"ColorSwatch",WS_GROUP,5,140,25,
12
RTEXT "Map:",IDC_STATIC,56,131,18,8
CONTROL "Custom1",IDC_SHADPROJ_MAPNAME,"CustButton",WS_GROUP |
WS_TABSTOP,32,140,69,12
CONTROL "Light Affects Shadow Color",IDC_LT_EFFECT_SHADCOL,
"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,4,154,
99,10
GROUPBOX "Atmospheric Shadowing:",IDC_STATIC,1,171,105,38,
WS_GROUP
CONTROL "On",IDC_ATMOS_SHADOWS,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,7,184,27,10
LTEXT "Opacity:",IDC_STATIC,40,184,27,8
CONTROL "",IDC_ATM_OPACITY,"CustEdit",WS_GROUP | WS_TABSTOP,68,
183,27,10
CONTROL "",IDC_ATM_OPACITY_SPIN,"SpinnerControl",WS_GROUP,95,183,
8,10
LTEXT "Color Amount:",IDC_STATIC,23,196,45,8
CONTROL "",IDC_ATM_COLAMT,"CustEdit",WS_GROUP | WS_TABSTOP,68,
195,27,10
CONTROL "",IDC_ATM_COLAMT_SPIN,"SpinnerControl",WS_GROUP,95,195,
8,10
END
IDD_LIGHT_SHADOW2 DIALOG DISCARDABLE 0, 0, 108, 146
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Object Shadows:",IDC_STATIC,1,1,105,97,WS_GROUP
CONTROL "On",IDC_OBJECT_SHADOWS,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,5,11,22,10
COMBOBOX IDC_SHADOW_TYPE,9,22,91,64,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_GROUP | WS_TABSTOP
CONTROL "Use Global Settings",IDC_GLOBAL_SET,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,9,36,78,10
RTEXT "Color:",IDC_STATIC,4,55,19,8
CONTROL "User1",IDC_SHADOW_COLOR,"ColorSwatch",WS_GROUP,24,53,15,
12
LTEXT "Dens.",IDC_STATIC,44,55,20,8
CONTROL "",IDC_SHAD_MULT,"CustEdit",WS_GROUP | WS_TABSTOP,66,54,
27,10
CONTROL "",IDC_SHAD_MULT_SPIN,"SpinnerControl",WS_GROUP,94,54,7,
10
CONTROL "Map:",IDC_USE_SHAD_COLMAP,"Button",BS_AUTOCHECKBOX |
BS_RIGHT | WS_GROUP | WS_TABSTOP,5,70,30,10
CONTROL "Custom1",IDC_SHADPROJ_MAPNAME,"CustButton",WS_GROUP |
WS_TABSTOP,35,69,66,12
CONTROL "Light Affects Shadow Color",IDC_LT_EFFECT_SHADCOL,
"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,5,85,98,
10
GROUPBOX "Atmosphere Shadows:",IDC_STATIC,1,103,105,40,WS_GROUP
CONTROL "On",IDC_ATMOS_SHADOWS,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,6,113,22,10
LTEXT "Opacity:",IDC_STATIC,39,117,27,8
CONTROL "",IDC_ATM_OPACITY,"CustEdit",WS_GROUP | WS_TABSTOP,67,
116,27,10
CONTROL "",IDC_ATM_OPACITY_SPIN,"SpinnerControl",WS_GROUP,94,116,
8,10
LTEXT "Color Amount:",IDC_STATIC,22,129,45,8
CONTROL "",IDC_ATM_COLAMT,"CustEdit",WS_GROUP | WS_TABSTOP,67,
128,27,10
CONTROL "",IDC_ATM_COLAMT_SPIN,"SpinnerControl",WS_GROUP,94,128,
8,10
END
IDD_LIGHT_SHADOW1 DIALOG DISCARDABLE 0, 0, 108, 142
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Object Shadows:",IDC_STATIC,1,1,105,94,WS_GROUP
CONTROL "On",IDC_OBJECT_SHADOWS,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,8,12,22,10
COMBOBOX IDC_SHADOW_TYPE,34,12,69,64,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
CONTROL "Use Global Settings",IDC_GLOBAL_SET,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,8,26,76,10
LTEXT "Shadow Density:",IDC_STATIC,6,46,54,8
CONTROL "",IDC_SHAD_MULT,"CustEdit",WS_GROUP | WS_TABSTOP,65,45,
27,10
CONTROL "",IDC_SHAD_MULT_SPIN,"SpinnerControl",WS_GROUP,93,45,7,
10
RTEXT "Color:",IDC_STATIC,5,56,22,8
RTEXT "Map:",IDC_STATIC,49,56,18,8
CONTROL "User1",IDC_SHADOW_COLOR,"ColorSwatch",WS_GROUP,5,65,22,
12
CONTROL "Custom1",IDC_SHADPROJ_MAPNAME,"CustButton",WS_GROUP |
WS_TABSTOP,28,65,61,12
CONTROL "",IDC_USE_SHAD_COLMAP,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,92,66,9,10
CONTROL "Light Affects Shadow Color",IDC_LT_EFFECT_SHADCOL,
"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,5,81,99,
10
GROUPBOX "Atmospheric Shadows:",IDC_STATIC,1,99,105,40,WS_GROUP
CONTROL "On",IDC_ATMOS_SHADOWS,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,8,109,22,10
LTEXT "Opacity:",IDC_STATIC,39,113,27,8
CONTROL "",IDC_ATM_OPACITY,"CustEdit",WS_GROUP | WS_TABSTOP,67,
112,27,10
CONTROL "",IDC_ATM_OPACITY_SPIN,"SpinnerControl",WS_GROUP,94,112,
8,10
LTEXT "Color Amount:",IDC_STATIC,22,125,45,8
CONTROL "",IDC_ATM_COLAMT,"CustEdit",WS_GROUP | WS_TABSTOP,67,
124,27,10
CONTROL "",IDC_ATM_COLAMT_SPIN,"SpinnerControl",WS_GROUP,94,124,
8,10
END
IDD_SHADOWMAP_PARAMS DIALOG DISCARDABLE 0, 0, 108, 48
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
RTEXT "Bias:",IDC_STATIC,3,5,17,8
CONTROL "",IDC_SHADBIAS,"CustEdit",WS_GROUP | WS_TABSTOP,22,4,21,
10
CONTROL "",IDC_SHADBIAS_SPIN,"SpinnerControl",WS_GROUP,44,4,7,10
RTEXT "Size:",IDC_STATIC,53,5,17,8
CONTROL "",IDC_SHADSIZE,"CustEdit",WS_GROUP | WS_TABSTOP,73,4,21,
10
CONTROL "",IDC_SHADSIZE_SPIN,"SpinnerControl",WS_GROUP,95,4,7,10
RTEXT "Sample Range:",IDC_STATIC,5,20,53,8
CONTROL "",IDC_SHADSAMPLE_RANGE,"CustEdit",WS_GROUP | WS_TABSTOP,
61,19,21,10
CONTROL "",IDC_SHADSAMPLE_RANGE_SPIN,"SpinnerControl",WS_GROUP,
83,19,7,10
CONTROL "Absolute Map Bias",IDC_ABSOLUTE_MAPBIAS,"Button",
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,10,34,81,10
END
IDD_PROJ_DIRECTIONAL DIALOG DISCARDABLE 0, 0, 108, 179
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Width:",ID_STATIC,12,31,22,8
CONTROL "",IDC_WIDTH,"CustEdit",WS_GROUP | WS_TABSTOP,37,30,36,
10
CONTROL "",IDC_WIDTHSPINNER,"SpinnerControl",WS_GROUP,74,30,7,10
LTEXT "Height:",IDC_STATIC,10,42,24,8
CONTROL "",IDC_HEIGHT,"CustEdit",WS_GROUP | WS_TABSTOP,37,42,36,
10
CONTROL "",IDC_HEIGHTSPINNER,"SpinnerControl",WS_GROUP,74,42,7,
10
CONTROL "Custom1",IDC_PROJ_MAPNAME,"CustButton",WS_TABSTOP,9,13,
88,12
LTEXT "Range:",IDC_STATIC,10,54,24,8
CONTROL "",IDC_DEPTH,"CustEdit",WS_GROUP | WS_TABSTOP,37,54,36,
10
CONTROL "",IDC_DEPTHSPINNER,"SpinnerControl",WS_GROUP,74,54,7,10
LTEXT "Projector Map:",IDC_STATIC,9,4,47,8
CONTROL "Illuminate",IDC_ILLUMINATE,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,79,48,10
GROUPBOX "Mode",IDC_STATIC,5,69,92,58
CONTROL "Add",IDC_ADD,"Button",BS_AUTORADIOBUTTON | WS_GROUP |
WS_TABSTOP,11,90,48,10
CONTROL "Multiply",IDC_MULT,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,101,48,10
CONTROL "Brighten",IDC_MADD,"Button",BS_AUTORADIOBUTTON |
WS_GROUP | WS_TABSTOP,11,112,48,10
GROUPBOX "Texture",IDC_STATIC,5,130,91,40
CONTROL "Don't Compress",IDC_PROJ_NOCOMPRESS,"Button",
BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,11,142,
67,10
CONTROL "Don't Mip",IDC_PROJ_NOMIP,"Button",BS_AUTOCHECKBOX |
BS_LEFT | WS_GROUP | WS_TABSTOP,11,154,67,10
END
IDD_LIGHT_ANIM DIALOG DISCARDABLE 0, 0, 108, 74
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_NAMES,27,7,76,52,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
CONTROL "Auto-start",IDC_AUTO_START,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,5,25,46,10
CONTROL "Loop",IDC_LOOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,
39,32,10
COMBOBOX IDC_LOOPS,38,37,65,54,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Refresh",IDC_REFRESH,3,55,35,15
LTEXT "Name:",IDC_STATIC,4,9,22,8
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,0,0
PRODUCTVERSION 4,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "TECH: dan.silva (of AutoDesk) and allred, ryan (of CyanWorlds...)\0"
VALUE "CompanyName", "CyanWorlds.com\0"
VALUE "FileDescription", "plRealTimeLights plugin\0"
VALUE "FileVersion", "4.0.0.0\0"
VALUE "InternalName", "plRTLights\0"
VALUE "LegalCopyright", "Copyright <20> 2001 CyanWorlds.com\0"
VALUE "LegalTrademarks", "3D Studio MAX, Biped, Character Studio, Heidi, Kinetix and Physique are registered trademarks and 3ds max, combustion, Discreet, DWG Unplugged, DXF, FLI and FLC are trademarks of Autodesk, Inc.\0"
VALUE "OriginalFilename", "plRealTimeLights.dlo\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "3ds max\0"
VALUE "ProductVersion", "4.0.0.0\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_SHADOWMAP_PARAMS, DIALOG
BEGIN
BOTTOMMARGIN, 7
END
IDD_LIGHT_ANIM, DIALOG
BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 69
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_DB_TARGET "Target"
IDS_DB_DOT_TARGET ".Target"
IDS_DB_OMNI "RT Omni"
IDS_DB_TARGET_SPOT "Target Spot"
IDS_DB_DIRECTIONAL "RT Directional"
IDS_DB_FREE_SPOT "RT Spot"
IDS_DB_NONE "None"
IDS_DB_PROJDIR "RT Proj Direct"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DB_OMNI_CLASS "Plasma Omni"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DB_COLOR "Color"
IDS_DB_ASPECT_RATIO "Aspect Ratio"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DB_MULTIPLIER "Multiplier"
IDS_DB_ATTENSTART "Attenuation Far Start"
IDS_DB_ATTENEND "Attenuation Far End"
IDS_DB_HOTSIZE "Hotspot"
IDS_DB_FALLSIZE "Falloff"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DB_TDIST "Target Distance"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_EXCLUDE__ "Exclude.."
IDS_DS_INCLUDE__ "Include.."
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_LIGHTCOL "Diffuse Color"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_TDIRECTIONAL "Target Direct"
IDS_DS_TDIRECT "Direct"
IDS_DS_TDIR_LIGHT "Target Directional Light"
IDS_DS_ATTENSTARTNEAR "Attenuation Near Start"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DB_GENERAL_PARAMS "General Parameters"
IDS_DB_DIR_PARAMS "Directional Parameters"
IDS_DB_SPOT_PARAMS "Spotlight Parameters"
IDS_DB_SHADOW_PARAMS "Shadow Parameters"
IDS_DB_SELECT_TO_FIT " Select Image File to Fit "
IDS_DB_OMNI_LIGHT "Omni Light"
IDS_DB_DIR_LIGHT "Free Directional Light"
IDS_DB_DIRECT "FDirect"
IDS_DB_FSPOT "Fspot"
IDS_DB_SPOT "Spot"
IDS_DB_LIGHT "RTLight"
IDS_DB_TAPE "Tape"
IDS_DB_GENERAL "General"
IDS_DB_TARGET_SPOT_CLASS "Target Spot"
IDS_DB_TAPE_CLASS "Tape"
IDS_LIGHT_ANIM "Animation Parameters"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_ATTENENDNEAR "Attenuation Near End"
IDS_PROJ_PARAMS "Projection Parameters"
IDS_DS_CONTRAST "Contrast"
IDS_PROJWIDTH "Projection Width"
IDS_PROJHEIGHT "Projection Height"
IDS_PROJDEPTH "Projection Depth"
IDS_DS_DIFFSOFT "Diffuse Soften"
IDS_DS_SHADCOL "Shadow Color"
IDS_DS_SETTYPE "Set Type"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DB_DIRECTIONAL_CLASS "RT Directional"
IDS_DS_TDIRECTIONAL_CLASS "Target Direct"
IDS_DB_FREE_SPOT_CLASS "RT Spot"
IDS_DB_SLAVECONTROL_CLASS "SlaveControl"
IDS_DB_TARGET_CLASS "Target"
IDS_DB_PROJDIR_CLASS "RT Projected Direct"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_AP_SLICEON "Slice On"
IDS_AP_SLICETO "Slice To"
IDS_AP_SLICEFROM "Slice From"
IDS_DECAY_NONE "None"
IDS_DECAY_INVERSE "Inverse"
IDS_DECAY_INVSQ "Inverse Square"
IDS_ATTEN_PARAM "Attenuation Parameters"
IDS_DECAY_RADIUS "Decay Falloff"
IDS_ATMOS_OPACITY "Atmosphere Opacity"
IDS_ATMOS_COLAMT "Atmosphere Color Amount"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_PROJMAP "Projection Map"
IDS_DS_SHADPROJMAP "Shadow Projection Map"
IDS_DS_SHAD_GEN "Shadow Parameters"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_SETSHADTYPE "Set Shadow Type"
IDS_PW_CV "CV"
IDS_SHAD_DENSITY "Shadow Density"
IDS_DOF "Depth Of Field"
IDS_DOF_ENABLE "Enable"
IDS_DOF_FSTOP "fStop"
IDS_TH_VIZ_TEXT "VIZ Text"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_RTLIGHT_ON "LightOn"
IDS_LIGHT_GEN_PARAMS "General Parameters"
IDS_LIGHT_ATTEN_PARAMSS "Attenuation Parameters"
IDS_LIGHT_SPOT_PARAMS "Spot Light Parameters"
IDS_DS_HUE "Hue"
IDS_DS_SAT "Saturation"
IDS_DS_VAL "Value"
IDS_DS_DIFFON "Diffuse On"
IDS_DS_SPEC "Specularity"
IDS_DS_AMBI "Ambient Only"
IDS_DS_USENEAR "Use Near Atten"
IDS_DS_SHOWNEARRANGES "Show Near Ranges (Atten)"
IDS_DS_USEFARATTEN "Use Far Atten"
IDS_DS_SHOWFARRANGES "Show Far Ranges (Atten)"
IDS_DB_DECAY_STATE "Decay State"
IDS_DS_SHOWDECAY "Show Decay"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_SHOWCONE "Show Cone"
IDS_DS_OVERSHOOT "Overshoot On"
IDS_DS_LIGHTSHAPE_RATIO "Light Shape Ratio"
IDS_DB_LIGHTTYPE "Light Type"
IDS_DS_RED "Red"
IDS_DS_GREEN "Green"
IDS_DS_BLUE "Blue"
IDS_LIGHT_SHADOWS "Shadow Parameters"
IDS_DS_USESHADOWSS "Shadows On"
IDS_DS_USESHADOWGLOBS "Use Shadow Global"
IDS_DS_SHADCOLORS "Shadow Color"
IDS_DS_DENSITYSHADOWS "Shadow Density"
IDS_DS_USESHADOWMAPS "Use Shadow Maps"
IDS_DS_SHADOWMAPBUTTONS "Shadow Map Button"
IDS_DS_LIGHTEFFECTS_SHADS "Light Effect Shadows Bool"
IDS_DS_ATMOS_SHADS "Atmospheric Shadows Bool"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_ATMOS_SHAD_OPACS "Atmospheric Shadow Opacity"
IDS_DS_ATMOS_SHAD_COLORS "Atmospheric Shadow Color Amount"
IDS_LIGHT_SHADOWMAP_PARAMSS "Shadow Map Params"
IDS_DS_SHADOWMAP_BIASS "Shadow Map Bias"
IDS_DS_SHADOWMAP_SIZES "Shadow Map Size"
IDS_DS_SHADOWMAP_SAMPLESS "Shadow Map Sample Range"
IDS_DS_SHADOWMAP_ABSOLULTE_BIASS "Absolute Map Bias"
IDS_DS_CASTSHADOWSS "Cast Shadows"
IDS_DS_LIGHT_ATTEN_SLIDER "Atten Slider"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DS_SPECCOL "Specular Color"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,167 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// plRTObjLightDesc.h - Header for the various ObjLightDesc classes //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#ifndef _plRTObjLightDesc_h
#define _plRTObjLightDesc_h
#include "plRealTimeLightBase.h"
#include "resource.h"
class plMaxNode;
//// AttenRanges Class ////////////////////////////////////////////////////////
class AttenRanges
{
public:
float aStart, aEnd; // Attenuation start and end and hot spot scaling for volume shading
//float aNearStart, aNearEnd; // Near Attenuation start and end and hot spot scaling for volume shading
float decayRadius;
};
//// BaseObjLight Class ///////////////////////////////////////////////////////
class BaseObjLight : public ObjLightDesc
{
public:
Color intensCol; // intens*color
Color shadColor;
float contrast,kA,kB,diffSoft;
int decayType;
BOOL diffSoften;
float decayRadius;
plRTLightBase* gl;
BaseObjLight(INode *n);
void DeleteThis() {delete this;}
int Update(TimeValue t, const RendContext& rc, RenderGlobalContext * rgc, BOOL shadows, BOOL shadowGeomChanged);
void UpdateGlobalLightLevel(Color globLightLevel) { intensCol = ls.intens*ls.color*globLightLevel;}
virtual Color AttenuateIllum(ShadeContext& sc,Point3 p,Color &colStep,Point3 &dp,int filt, float ldp, float &distAtten, AttenRanges &ranges) {return Color(0,0,0);}
virtual BOOL UseAtten()=0;
virtual BOOL IsFacingLight(Point3 &dir) {return FALSE;}
virtual int LightType()=0;
inline float ContrastFunc(float nl) {
if (diffSoft!=0.0f) {
float p = nl*nl*(2.0f-nl); // based on Hermite interpolant
nl = diffSoft*p + (1.0f-diffSoft)*nl;
}
return (contrast==0.0f)? nl:
nl/(kA*nl+kB); // the "Bias" function described in Graphics Gems IV, pp. 401ff
}
};
//// OmniLight Class //////////////////////////////////////////////////////////
class OmniLight : public BaseObjLight
{
Matrix3 tmCamToLight[6];
BOOL shadow, doShadows, shadowRay;
Texmap *projMap;
BOOL needMultiple;
BOOL genCanDoOmni;
float zfac, xscale, yscale, fov, sz2,size,sizeClip,sampSize,sampSize2;
public:
OmniLight(INode *inode, BOOL forceShadowBuf );
~OmniLight();
int Update(TimeValue t, const RendContext& rc, RenderGlobalContext *rgc, BOOL shadows, BOOL shadowGeomChanged);
int UpdateViewDepParams(const Matrix3& worldToCam);
BOOL UseAtten() {return TRUE;}
int LightType() { return plRTLightBase::RT_OMNI; }
};
//// SpotLight Class //////////////////////////////////////////////////////////
class SpotLight: public BaseObjLight
{
Point3 lightDir; // light direction in render space
BOOL projector; //, shadowRay, overshoot;
float hot_cos, fall_cos, fall_tan, fall_sin;
float hotpct, ihotpct;
float zfac, xscale,yscale, fov, sz2, curve;
float out_range,in_range, range_span;
Point2 rectv0, rectv1;
Texmap* projMap;
public:
SpotLight(INode *inode, BOOL forceShadowBuf );
~SpotLight() {} // FreeShadGens(); }
int Update(TimeValue t, const RendContext& rc, RenderGlobalContext *rgc, BOOL shadows, BOOL shadowGeomChanged);
int UpdateViewDepParams(const Matrix3& worldToCam);
BOOL UseAtten() {return ls.useAtten;}
BOOL IsFacingLight(Point3 &dir);
int LightType() { return FSPOT_LIGHT; }
};
//// DirLight Class ///////////////////////////////////////////////////////////
class DirLight : public BaseObjLight
{
Point3 lightDir; // light direction in render space
//BOOL projector;//,overshoot;
float hotsz, fallsz, fallsq;
float xscale, yscale, sz2, curve;
float out_range,in_range, range_span;
float hotpct,ihotpct;
float aspect;
float sw2, sh2;
Texmap* projMap;
public:
DirLight(INode *inode, BOOL forceShadowBuf );
~DirLight() { /* FreeShadGens();*/}
int Update(TimeValue t, const RendContext& rc, RenderGlobalContext *rgc, BOOL shadows, BOOL shadowGeomChanged);
int UpdateViewDepParams(const Matrix3& worldToCam);
BOOL UseAtten() {return FALSE;}
int LightType() { return plRTLightBase::RT_FREE_DIR; }
};
#endif // _plRTObjLightDesc_h

View File

@ -0,0 +1,8 @@
LIBRARY
EXPORTS
LibDescription @1
LibNumberClasses @2
LibClassDesc @3
LibVersion @4
SECTIONS
.data READ WRITE

View File

@ -0,0 +1,490 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// plRTProjDirLight.cpp - Functions for the Projected Directional MAX light //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#include "HeadSpin.h"
#include "plRTProjDirLight.h"
#include "plRTProjDirLightClassDesc.h"
#include "iparamm2.h"
#include "../MaxPlasmaMtls/Layers/plLayerTex.h"
#include "../MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h"
#include "../MaxComponent/plMaxAnimUtils.h"
#include "plRTObjLightDesc.h"
#include "plRTLightBaseAnimDlgProc.h"
//// Static ClassDesc2 Get Functions //////////////////////////////////////////
plRTProjDirLightDesc plRTProjDirLightDesc::fStaticDesc;
//// Dialog Proc //////////////////////////////////////////////////////////////
class plProjDirDlgProc : public plBaseLightProc
{
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
plRTProjDirLight *lite = (plRTProjDirLight *)pb->GetOwner();
PBBitmap *bitmap;
plLayerTex *layer = (plLayerTex *)lite->GetProjMap();
ICustButton *bmSelectBtn;
switch( msg )
{
case WM_COMMAND:
if( LOWORD( wParam ) == IDC_PROJ_MAPNAME )
{
BOOL selectedNewBitmap = layer->HandleBitmapSelection();
if( selectedNewBitmap )
{
bmSelectBtn = GetICustButton( GetDlgItem( hWnd, IDC_PROJ_MAPNAME ) );
bitmap = layer->GetPBBitmap();
bmSelectBtn->SetText( bitmap != nil ? (TCHAR *)bitmap->bi.Filename() : "");
ReleaseICustButton( bmSelectBtn );
}
return false;
}
break;
case WM_INITDIALOG:
// Set projection map bitmap name
bmSelectBtn = GetICustButton( GetDlgItem( hWnd, IDC_PROJ_MAPNAME ) );
if( bmSelectBtn != nil )
{
bitmap = ( layer == nil ) ? nil : layer->GetPBBitmap();
if( bitmap != nil )
bmSelectBtn->SetText( (TCHAR *)bitmap->bi.Filename() );
else
bmSelectBtn->SetText( _T( "<none>" ) );
ReleaseICustButton( bmSelectBtn );
}
break;
}
return plBaseLightProc::DlgProc( t, map, hWnd, msg, wParam, lParam );
}
void DeleteThis() {};
};
static plProjDirDlgProc gPPDirLiteDlgProc;
/// Include for the ParamBlock2 definition
#include "plRTProjDirLightPBDec.h"
///////////////////////////////////////////////////////////////////////////////
//// plRTProjPBAccessor Class Functions ///////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
plRTProjPBAccessor plRTProjPBAccessor::fAccessor;
void plRTProjPBAccessor::Set( PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t )
{
plRTProjDirLight *obj = (plRTProjDirLight *)owner;
IParamBlock2 *pb = obj->GetParamBlockByID( plRTProjDirLight::kBlkProj );
switch( id )
{
case plRTProjDirLight::kProjMap:
/* {
if( pb->GetMap() )
pb->GetMap()->Invalidate( plRTProjDirLight::kProjMap );
PBBitmap *thisMap = val.bm;
obj->SetProjMap( &thisMap->bi );
}
*/ break;
default:
break;
}
}
void plRTProjPBAccessor::Get( PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid )
{
}
///////////////////////////////////////////////////////////////////////////////
//// Projected Directional Light //////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
plRTProjDirLight::plRTProjDirLight()
{
fIP = nil;
fLightPB = nil;
fProjPB = nil;
fClassDesc = plRTProjDirLightDesc::GetDesc();
fClassDesc->MakeAutoParamBlocks( this );
fLightPB->SetValue(kLightColor, 0, Color(255,255,255));
SetHSVColor(0, Point3(255, 255, 255));
fTex = nil;
meshBuilt = 0;
IBuildMeshes(true);
}
ObjLightDesc *plRTProjDirLight::CreateLightDesc( INode *n, BOOL forceShadowBuf )
{
return TRACKED_NEW DirLight( n, forceShadowBuf );
}
RefTargetHandle plRTProjDirLight::Clone( RemapDir &remap )
{
plRTProjDirLight *obj = TRACKED_NEW plRTProjDirLight;
obj->ReplaceReference( kRefDirLight, fLightPB->Clone( remap ) );
BaseClone( this, obj, remap );
return obj;
}
//// SubAnim /////////////////////////////////////////////////////////////////
Animatable *plRTProjDirLight::SubAnim( int i )
{
switch( i )
{
case 0:
return (Animatable *)fLightPB;
case 1:
return (Animatable *)fProjPB;
default:
return nil;
}
}
//// SubAnimName /////////////////////////////////////////////////////////////
TSTR plRTProjDirLight::SubAnimName( int i )
{
switch( i )
{
case 0:
return fLightPB->GetLocalName();
case 1:
return fProjPB->GetLocalName();
default:
return TSTR( "" );
}
}
//// GetReference ////////////////////////////////////////////////////////////
RefTargetHandle plRTProjDirLight::GetReference( int i )
{
switch( i )
{
case kRefMainRollout:
return (RefTargetHandle)fLightPB;
case kRefProjRollout:
return (RefTargetHandle)fProjPB;
default:
return plRTLightBase::GetReference( i );
}
}
//// SetReference ////////////////////////////////////////////////////////////
void plRTProjDirLight::SetReference( int ref, RefTargetHandle rtarg )
{
switch( ref )
{
case kRefMainRollout:
fLightPB = (IParamBlock2 *)rtarg;
break;
case kRefProjRollout:
fProjPB = (IParamBlock2 *)rtarg;
break;
default:
plRTLightBase::SetReference( ref, rtarg );
break;
}
}
//// ParamBlock Functions ////////////////////////////////////////////////////
int plRTProjDirLight::NumParamBlocks()
{
return plRTLightBase::NumParamBlocks() + 1;
}
IParamBlock2 *plRTProjDirLight::GetParamBlock( int i )
{
switch ( i )
{
case 2: return fProjPB;
default: return plRTLightBase::GetParamBlock( i );
}
}
IParamBlock2 *plRTProjDirLight::GetParamBlockByID( BlockID id )
{
if( fProjPB->ID() == id )
return fProjPB;
else
return plRTLightBase::GetParamBlockByID( id );
}
//// GetProjMap //////////////////////////////////////////////////////////////
Texmap *plRTProjDirLight::GetProjMap()
{
// If we don't have one, create one
plLayerTex *layer = (plLayerTex *)fProjPB->GetTexmap( kTexmap, 0 );
if( layer == nil || layer->ClassID() != LAYER_TEX_CLASS_ID )
{
layer = TRACKED_NEW plLayerTex;
fProjPB->SetValue( kTexmap, 0, (Texmap *)layer );
IParamBlock2 *bitmapPB = layer->GetParamBlockByID( plLayerTex::kBlkBitmap );
bitmapPB->SetValue( kBmpUseBitmap, 0, 1 );
}
// Backwards compatability here
PBBitmap *bitmap = fProjPB->GetBitmap( kProjMap, 0 );
if( bitmap != nil )
{
layer->SetBitmap( &bitmap->bi );
fProjPB->SetValue( kProjMap, 0, (PBBitmap *)nil );
}
if( layer )
{
const char* dbgTexName = layer->GetName();
IParamBlock2 *bitmapPB = layer->GetParamBlockByID(plLayerTex::kBlkBitmap);
hsAssert(bitmapPB, "LayerTex with no param block");
int noCompress = fProjPB->GetInt(kProjNoCompress);
int noMip = fProjPB->GetInt(kProjNoMip);
bitmapPB->SetValue(kBmpNonCompressed, TimeValue(0), noCompress);
bitmapPB->SetValue(kBmpNoFilter, TimeValue(0), noMip);
}
return (Texmap *)layer;
}
//// IBuildMeshes ////////////////////////////////////////////////////////////
void plRTProjDirLight::IBuildMeshes( BOOL isnew )
{
BuildStaticMeshes();
fMesh = staticMesh[ plRTLightBase::RT_OMNI + 1 ];
}
//// GetLocalBoundBox ////////////////////////////////////////////////////////
void plRTProjDirLight::GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box )
{
Point3 loc = node->GetObjectTM( t ).GetTrans();
float scaleFactor = vpt->NonScalingObjectSize() * vpt->GetVPWorldWidth( loc ) / 360.0f;
float width, height, depth;
box = fMesh.getBoundingBox();
// Because we want to scale about the origin, not the box center, we have to do this funky offset
Point3 boxCenter = box.Center();
box.Translate( -boxCenter );
box.Scale( scaleFactor );
boxCenter *= scaleFactor;
box.Translate( boxCenter );
if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
{
fProjPB->GetValue( kWidth, t, width, FOREVER );
fProjPB->GetValue( kHeight, t, height, FOREVER );
fProjPB->GetValue( kRange, t, depth, FOREVER );
width /= 2.f;
height /= 2.f;
box += Point3( -width, -height, 0.f );
box += Point3( width, height, -depth );
}
}
//// DrawConeAndLine /////////////////////////////////////////////////////////
int plRTProjDirLight::DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing )
{
Matrix3 tm = inode->GetObjectTM( t );
gw->setTransform( tm );
gw->clearHitCode();
if( extDispFlags & EXT_DISP_ONLY_SELECTED )
DrawCone( t, gw, 500 );
return gw->checkHitCode();
}
//// DrawCone ////////////////////////////////////////////////////////////////
// Function called by MAX to render the cone shape in the viewport for this
// light. Note that this is the cone, not the actual object itself!
void plRTProjDirLight::DrawCone( TimeValue t, GraphicsWindow *gw, float dist )
{
Point3 nearPts[ 5 ], farPts[ 5 ], u[ 3 ];
int i;
float width, height;
// Get values
fProjPB->GetValue( kWidth, t, width, FOREVER );
fProjPB->GetValue( kHeight, t, height, FOREVER );
fProjPB->GetValue( kRange, t, dist, FOREVER );
// Draw a rectangle showing the extents of the light (width, height and depth)
IBuildRectangle( width, height, 0, nearPts );
IBuildRectangle( width, height, -dist, farPts );
gw->setColor( LINE_COLOR, GetUIColor( COLOR_HOTSPOT ) );
gw->polyline( 4, nearPts, nil, nil, true, nil );
gw->polyline( 4, farPts, nil, nil, true, nil );
for( i = 0; i < 4; i++ )
{
u[ 0 ] = nearPts[ i ];
u[ 1 ] = farPts[ i ];
gw->polyline( 2, u, nil, nil, false, nil );
}
}
//// IBuildRectangle /////////////////////////////////////////////////////////
void plRTProjDirLight::IBuildRectangle( float width, float height, float z, Point3 *pts )
{
width /= 2.f;
height /= 2.f;
pts[ 0 ] = Point3( -width, -height, z );
pts[ 1 ] = Point3( width, -height, z );
pts[ 2 ] = Point3( width, height, z );
pts[ 3 ] = Point3( -width, height, z );
}
//// GetFallsize /////////////////////////////////////////////////////////////
// To get using-light-as-camera-viewport to work
float plRTProjDirLight::GetFallsize( TimeValue t, Interval &valid )
{
if( fProjPB == nil )
return -1.f;
return fProjPB->GetFloat( kWidth, t );
}
//// GetAspect ///////////////////////////////////////////////////////////////
// To get using-light-as-camera-viewport to work
float plRTProjDirLight::GetAspect( TimeValue t, Interval &valid )
{
if( fProjPB == nil )
return -1.f;
return( fProjPB->GetFloat( kHeight, t ) / fProjPB->GetFloat( kWidth, t ) );
}
//// GetTDist ////////////////////////////////////////////////////////////////
// To get using-light-as-camera-viewport to work
float plRTProjDirLight::GetTDist( TimeValue t, Interval &valid )
{
return 0.f;
if( fProjPB == nil )
return -1.f;
return fProjPB->GetFloat( kRange, t );
}
//// SetFallsize /////////////////////////////////////////////////////////////
// To get using-light-as-camera-viewport to work
void plRTProjDirLight::SetFallsize( TimeValue time, float f )
{
if( fProjPB != nil )
fProjPB->SetValue( kWidth, time, f );
}
//// EvalLightState //////////////////////////////////////////////////////////
// To get using-light-as-camera-viewport to work
RefResult plRTProjDirLight::EvalLightState( TimeValue t, Interval& valid, LightState *ls )
{
ls->type = DIRECT_LGT;
if( fLightPB->GetInt( kLightOn, t ) == true )
ls->color = GetRGBColor( t, valid );
else
ls->color = Color( 0, 0, 0 );
ls->on = fLightPB->GetInt( kLightOn, t );
ls->intens = GetIntensity( t, valid );
float fall = fProjPB->GetFloat( kWidth, t );
if( fall < fProjPB->GetFloat( kHeight, t ) )
fall = fProjPB->GetFloat( kHeight, t );
ls->hotsize = ls->fallsize = fall / 2.f;
ls->useNearAtten = false;
ls->useAtten = false;
ls->shape = RECT_LIGHT;
ls->aspect = fProjPB->GetFloat( kHeight, t ) / fProjPB->GetFloat( kWidth, t );
ls->overshoot = false;
ls->shadow = false;
ls->ambientOnly = false;
ls->affectDiffuse = fLightPB->GetInt( kAffectDiffuse, t );
ls->affectSpecular = fLightPB->GetInt( kSpec, t );
return REF_SUCCEED;
}

View File

@ -0,0 +1,171 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// plRTProjDirLight.h - Header for the derived MAX RT projected directional //
// light //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#ifndef _plRTProjDirLight_h
#define _plRTProjDirLight_h
#include "plRealTimeLightBase.h"
#include "iparamm2.h"
///////////////////////////////////////////////////////////////////////////////
//// plRTProjPBAccessor ///////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTProjPBAccessor : public PBAccessor
{
public:
void Set( PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t );
void Get( PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid );
static plRTProjPBAccessor *Instance( void ) { return &fAccessor; }
protected:
static plRTProjPBAccessor fAccessor;
};
///////////////////////////////////////////////////////////////////////////////
//// Projected Directional Light //////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTProjDirLight : public plRTLightBase
{
public:
friend class plRTProjPBAccessor;
enum Blocks
{
kBlkProj = kBlkDerivedStart
};
enum References
{
kRefMainRollout = kRefDerivedStart,
kRefProjRollout,
kNumRefs
};
enum ProjRollout
{
kWidth,
kHeight,
kRange,
kShowCone,
kProjMap,
kTexmap,
// Someone goofed and used this index from the base class in our param block.
// luckily it worked because there was no overlap, but we can't change it to
// clean it up without breaking everything that uses it. So hopefully this
// will at least clarify what's going on and prevent someone from stepping on
// the index later.
kProjTypeRadio = plRTLightBase::kProjTypeRadio,
};
plRTProjDirLight();
/// Class ID stuff
Class_ID ClassID( void ) { return RTPDIR_LIGHT_CLASSID; }
SClass_ID SuperClassID( void ) { return LIGHT_CLASS_ID; }
ObjLightDesc *CreateLightDesc( INode *n, BOOL forceShadowBuf = FALSE );
GenLight *NewLight( int type ) { return TRACKED_NEW plRTProjDirLight(); }
RefTargetHandle Clone( RemapDir &remap );
int CanConvertToType( Class_ID obtype ) { return ( obtype == RTPDIR_LIGHT_CLASSID ) ? 1 : 0; }
virtual void GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box );
virtual int DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing );
virtual void DrawCone( TimeValue t, GraphicsWindow *gw, float dist );
virtual BOOL IsDir( void ) { return TRUE; }
virtual RefTargetHandle GetReference( int i );
virtual void SetReference( int ref, RefTargetHandle rtarg );
virtual int NumRefs() { return kNumRefs; }
virtual int NumSubs() { return 2; }
virtual TSTR SubAnimName( int i );
virtual Animatable *SubAnim( int i );
virtual int NumParamBlocks();
virtual IParamBlock2 *GetParamBlock( int i );
virtual IParamBlock2 *GetParamBlock2() { return fLightPB; }
virtual IParamBlock2 *GetParamBlockByID( BlockID id );
virtual Texmap *GetProjMap();
virtual void InitNodeName( TSTR &s ) { s = _T( "RTProjDirLight" ); }
// To get using-light-as-camera-viewport to work
virtual int GetSpotShape( void ) { return RECT_LIGHT; }
virtual float GetAspect( TimeValue t, Interval &valid = Interval(0,0) );
virtual float GetFallsize( TimeValue t, Interval &valid = Interval(0,0) );
virtual int Type() { return DIR_LIGHT; }
virtual float GetTDist( TimeValue t, Interval &valid = Interval(0,0) );
virtual void SetFallsize( TimeValue time, float f );
RefResult EvalLightState(TimeValue t, Interval& valid, LightState *ls);
protected:
IParamBlock2 *fProjPB;
virtual void IBuildMeshes( BOOL isNew );
void IBuildRectangle( float width, float height, float z, Point3 *pts );
};
#endif // _plRTProjDirLight_h

View File

@ -0,0 +1,78 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// plRTProjDirLight.h - Header for the derived MAX RT projected directional //
// light //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#ifndef _plRTProjDirLightClassDesc_h
#define _plRTProjDirLightClassDesc_h
#include "plRTProjDirLight.h"
#include "iparamm2.h"
#include "resource.h"
class plRTProjDirLightDesc : public ClassDesc2
{
public:
int IsPublic() { return TRUE; }
void* Create(BOOL loading) { return TRACKED_NEW plRTProjDirLight; }
const TCHAR* ClassName() { return GetString(IDS_DB_PROJDIR); }
SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
Class_ID ClassID() { return RTPDIR_LIGHT_CLASSID; }
const TCHAR* Category() { return _T("Plasma RunTime");}
const TCHAR* InternalName() { return _T("RTProjDir"); } // returns fixed parsable name (scripter-visible name)
HINSTANCE HInstance() { return hInstance; }
static plRTProjDirLightDesc fStaticDesc;
static ClassDesc2 *GetDesc( void ) { return &fStaticDesc; }
};
#endif // _plRTProjDirLightClassDesc_h

View File

@ -0,0 +1,178 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// ParamBlock Type Konstants for plRT*Lights //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#ifndef _plRTProjDirLightPBDec_h
#define _plRTProjDirLightPBDec_h
///////////////////////////////////////////////////////////////////////////////
//// Projected Directional Lights /////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static ParamBlockDesc2 RTProjDirLightBlk
(
/// Main def
plRTProjDirLight::kBlkMain, _T("RTProjDir"), 0, plRTProjDirLightDesc::GetDesc(), P_AUTO_CONSTRUCT + P_AUTO_UI,
plRTProjDirLight::kRefMainRollout,
/// Rollout definition
IDD_LIGHT_PARAM, IDS_LIGHT_GEN_PARAMS, 0, 0, &gPPDirLiteDlgProc,
plRTLightBase::kLightOn, _T("on"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, TYPE_SINGLECHEKBOX, IDC_LIGHT_ON,
end,
plRTLightBase::kAffectDiffuse, _T("AffectDiffuse"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, TYPE_SINGLECHEKBOX, IDC_LIGHT_DIFFUSE,
end,
plRTLightBase::kAmbientOnlyStub, _T("AmbientOnly"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, false,
p_ui, TYPE_SINGLECHEKBOX, IDC_AMBIENT_ONLY_STUB,
end,
plRTLightBase::kCastShadows, _T("CastShadows"), TYPE_BOOL, 0, IDS_DS_CASTSHADOWSS,
// p_default, false,
// p_ui, TYPE_SINGLECHEKBOX, IDC_CAST_SHADOWS,
end,
plRTLightBase::kLightColor, _T("LightColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_LIGHTCOL,
p_default, Color(255,255,255),
p_ui, TYPE_COLORSWATCH, IDC_LIGHT_COLOR,
end,
plRTLightBase::kSpec, _T("AffectSpecular"), TYPE_BOOL, P_ANIMATABLE, IDS_DS_SPEC,
p_default, false,
p_ui, TYPE_SINGLECHEKBOX, IDC_AFFECT_SPECULAR,
end,
plRTLightBase::kSpecularColorSwatch,_T("SpecularColor"),TYPE_RGBA, P_ANIMATABLE, IDS_DS_SPECCOL,
p_default, Color(255,255,255),
p_ui, TYPE_COLORSWATCH, IDC_LIGHT_COLOR_SPECULAR,
end,
plRTLightBase::kIntensity, _T("IntensityEditSpinner"), TYPE_FLOAT, P_ANIMATABLE, IDS_DB_MULTIPLIER,
p_range, -250.0, 250.0,
p_default, 1.0,
p_ui, TYPE_SPINNER, EDITTYPE_FLOAT,
IDC_LMULT,IDC_LMULTSPINNER, .05f,
end,
end
);
///////////////////////////////////////////////////////////////////////////////
//// Projection Rollout ParamBlock ////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static ParamBlockDesc2 plRTProjParamBlock
(
/// Main def
plRTProjDirLight::kBlkProj, _T("RTProjDir_Proj"), 0, plRTProjDirLightDesc::GetDesc(), P_AUTO_CONSTRUCT + P_AUTO_UI,
plRTProjDirLight::kRefProjRollout,
/// Rollout definition
IDD_PROJ_DIRECTIONAL, IDS_PROJ_PARAMS, 0, 0, &gPPDirLiteDlgProc,
plRTProjDirLight::kWidth, _T("Width"), TYPE_FLOAT, P_ANIMATABLE, IDS_PROJWIDTH,
p_range, 0.0, 999999999.0,
p_default, 200.0,
p_ui, TYPE_SPINNER, EDITTYPE_POS_UNIVERSE, IDC_WIDTH, IDC_WIDTHSPINNER, .05f,
end,
plRTProjDirLight::kHeight, _T("Height"), TYPE_FLOAT, P_ANIMATABLE, IDS_PROJHEIGHT,
p_range, 0.0, 999999999.0,
p_default, 200.0,
p_ui, TYPE_SPINNER, EDITTYPE_POS_UNIVERSE,
IDC_HEIGHT, IDC_HEIGHTSPINNER, .05f,
end,
plRTProjDirLight::kRange, _T("Range"), TYPE_FLOAT, P_ANIMATABLE, IDS_PROJDEPTH,
p_range, 0.0, 999999999.0,
p_default, 200.0,
p_ui, TYPE_SPINNER, EDITTYPE_POS_UNIVERSE,
IDC_DEPTH, IDC_DEPTHSPINNER, .05f,
end,
// Old way--here for backwards compatability
plRTProjDirLight::kProjMap, _T("ProjMapButton"), TYPE_BITMAP, P_SHORT_LABELS, IDS_DS_PROJMAP,
// p_ui, TYPE_BITMAPBUTTON, IDC_PROJ_MAPNAME,
// p_accessor, plRTProjPBAccessor::Instance(),
end,
// New way
plRTProjDirLight::kTexmap, _T("texmap"), TYPE_TEXMAP, 0, 0,
end,
plRTLightBase::kProjTypeRadio, _T("ProjTypeRadio"), TYPE_INT, 0, 0,
p_ui, TYPE_RADIO, 4, IDC_ILLUMINATE, IDC_ADD, IDC_MULT, IDC_MADD,
p_vals, plRTLightBase::kIlluminate, plRTLightBase::kAdd, plRTLightBase::kMult, plRTLightBase::kMADD,
p_default, plRTLightBase::kIlluminate,
end,
plRTLightBase::kProjNoCompress, _T("NoCompress"), TYPE_BOOL, 0, IDS_DS_PROJ_PARAMS,
p_default, false,
p_ui, TYPE_SINGLECHEKBOX, IDC_PROJ_NOCOMPRESS,
end,
plRTLightBase::kProjNoMip, _T("NoMip"), TYPE_BOOL, 0, IDS_DS_PROJ_PARAMS,
p_default, false,
p_ui, TYPE_SINGLECHEKBOX, IDC_PROJ_NOMIP,
end,
end
);
#endif //_plRTProjDirLightPBDec_h

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,514 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef PL_RTLIGHT_BASE_H
#define PL_RTLIGHT_BASE_H
// Max related headers
#include "max.h"
#include "iparamb2.h"
#include "iparamm2.h"
// Our generic headers
#include "hsTypes.h"
#include "../MaxPlasmaMtls/Layers/plLayerTex.h"
extern TCHAR *GetString(int id);
extern HINSTANCE hInstance;
#define RTOMNI_LIGHT_CLASSID Class_ID(0x57cf7089, 0x282e5b71)
#define RTSPOT_LIGHT_CLASSID Class_ID(0x2b263fdd, 0x19c4351f)
#define RTTSPOT_LIGHT_CLASSID Class_ID(0x48cb06ab, 0x3c142832)
#define RTDIR_LIGHT_CLASSID Class_ID(0x5a6d278c, 0x780a78b1)
// Projected Directional Light
#define RTPDIR_LIGHT_CLASSID Class_ID(0x2f611934, 0x3681ff0)
#define FOREVER Interval(TIME_NegInfinity, TIME_PosInfinity)
#define DEF_TDIST 240.0f // 160.0f
#define NUM_HALF_ARC 5
#define NUM_ARC_PTS (2*NUM_HALF_ARC+1)
#define NUM_CIRC_PTS 28
#define SEG_INDEX 7
#define ATTEN_START 2 // far
#define ATTEN_END 3 // far
#define WM_SET_TYPE WM_USER + 0x04002
inline float MaxF(float a, float b) { return a>b?a:b; }
inline float MinF(float a, float b) { return a<b?a:b; }
class plMaxNode;
class ClassDesc2;
///////////////////////////////////////////////////////////////////////////////
//// Base LightDlgProc ////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTLightBase;
class plBaseLightProc : public ParamMap2UserDlgProc
{
protected:
void ILoadComboBox( HWND hComboBox, const char *names[] );
void IBuildLightMesh( plRTLightBase *base, float coneSize );
public:
virtual BOOL DlgProc( TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
};
///////////////////////////////////////////////////////////////////////////////
//// plLightTexPBAccessor /////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plLightTexPBAccessor : public PBAccessor
{
public:
void Set( PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t );
void Get( PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid );
static plLightTexPBAccessor *Instance( void ) { return &fAccessor; }
protected:
static plLightTexPBAccessor fAccessor;
};
///////////////////////////////////////////////////////////////////////////////
//// plRTLightBase Class //////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTLightBase : public GenLight
{
protected:
ClassDesc2 *fClassDesc; // Must set in derived classes constructor
Color fColor; // Color of mesh
Mesh fMesh; // Mesh to draw
IParamBlock2 *fLightPB; // The derived component's paramblock (optional)
plLayerTex* fTex;
virtual hsBool IHasAttenuation( void ) { return false; }
virtual void IBuildMeshes( BOOL isNew ) {}
void BuildStaticMeshes();
void BuildSpotMesh(float coneSize);
int meshBuilt;
int extDispFlags;
Mesh staticMesh[2];
Mesh spotMesh;
public:
friend class plBaseLightProc;
friend class plLightTexPBAccessor;
friend class SetTypeRest;
ExclList exclList;
IObjParam *fIP;
enum LightType
{
RT_OMNI,
RT_TARGET_SPOT,
RT_FREE_SPOT,
RT_TARGET_DIR,
RT_FREE_DIR
};
//// NOTE /////////////////////////////////////////////////////////////////////
// I would've overhauled this entire system to be far more sane, but doing
// so would break every scene with RT lights that the artists have (as in
// they would crash and burn, or at best just not read in). As a result,
// as much as it annoys me to death, we can't do a damn thing about it.
// Hopefully, in the future we will be able to clean all of this out somehow
// (a conversion utility might come in handy, dunno).
//
// For reference, the setup SHOULD have separate paramBlocks for each rollout,
// using the P_USE_PARAMS to duplicate the shared ones, and all the rollouts
// should have *IDENTICAL* block and ref #s, so the shared code actually looks
// sane. The final block/ref #s needed would be kBlkMain, kBlkAnim, kBlkProj
// (for spots and proj dir) and kBlkAttenuation (projMaps don't need ref #s,
// since they're part of the paramBlocks).
///////////////////////////////////////////////////////////////////////////////
// Blk Numbers
enum BlkNumber
{
// Old numbers. Phase out when possible
kBlkGeneralLightProp,
kBlkAttenLightProp,
kBlkOmniLightProp,
kBlkOtherLightProp,
kBlkOmniLight,
kBlkSpotLight,
kBlkTSpotLight,
kBlkDirLight,
kBlkTDirLight,
// New ones
kBlkMain = 0,
kBlkAnim = 9,
kBlkDerivedStart = 20
};
// Ref numbers
enum RefNumber
{
kRefGeneralLightProp,
kRefProjMap,
kRefShadowProjMap,
kRefShadowType,
kRefOmniLight,
kRefSpotLight,
kRefTSpotLight,
kRefDirLight,
kRefTDirLight,
kRefProjDirLight,
kRefAnimParams_DEAD,
kNumRefs,
kRefDerivedStart = 30
};
//Multimap Support?
enum MapChoice
{
kLightMap1,
kLightMap2,
kLightMap3,
kLightMap4,
kLightMap5,
kLightMap6
};
enum ParamVals
{
kLightType, //Inserted in v1, Removed in v4
kAffectDiffuse, //Inserted in v1
kLightColor, //Inserted in v1
kLightExclude, //Inserted in v1
kCastShadows, //Inserted in v2, OBSOLETE
kIntensity, //Inserted in v1
kContrast, //Inserted in v1
kDiffSoft, //Inserted in v1
kDiffOn, //Inserted in v1
kSpec, //Inserted in v1
kAmbiOnly, //Inserted in v1
kStartAttenNear, //Inserted in v1, Removed in v3
kEndAttenNear, //Inserted in v1, Removed in v3
kUseNearAtten, //Inserted in v1, Removed in v3
kShowNearAttenRanges,//Inserted in v1, Removed in v3
kStartAttenFar, //Inserted in v1, Removed in v3
kEndAttenFar, //Inserted in v1, Removed in v3
kUseFarAtten, //Inserted in v1, Removed in v3
kShowFarAttenRanges, //Inserted in v1, Removed in v3
kLightDecay, //Inserted in v1, Removed in v3
kDecayEdit, //Inserted in v1, Removed in v3
kShowDecay, //Inserted in v1, Removed in v3
kUseProjectBool, //Inserted in v1
kProjMapTexButton, //Inserted in v1
kShowConeBool, //Inserted in v1
kOvershootBool, //Inserted in v1, Removed in v2
kHotSpot, //Inserted in v1
kFallOff, //Inserted in v1
kLightShapeRadio, //Inserted in v1, Removed in v2
kAspect, //Inserted in v1, Removed in v2
kUseProjectorBool, //Inserted in v1
kProjMapTexButton2, //Inserted in v1
kTargetDist, //Inserted in v1
kShadowOn, //Inserted in v2
kShadowChoice, //Inserted in v2
kUseShadGlobal, //Inserted in v2
kShadowColor, //Inserted in v2
kShadowDensity, //Inserted in v2
kUseShadMapBool, //Inserted in v2
kShadMapButton, //Inserted in v2
kLightColorEffects, //Inserted in v2
kAtmosShadowsBool, //Inserted in v2
kAtmosShadOpacity, //Inserted in v2
kAtmosShadColor, //Inserted in v2
kShadMapBias, //Inserted in v2
kShadMapSize, //Inserted in v2
kShadSampleRange, //Inserted in v2
kAbsoluteShadBias, //Inserted in v2
kUseAttenuationBool,//Inserted in v3
kAttenMaxFalloffEdit, //Inserted in v3
kAttenTypeRadio, //Inserted in v3
kSpecularColorSwatch,//Inserted in v3
kAttenSlider,
kLightOn,
kAmbientOnlyStub,
kProjTypeRadio,
kProjNoCompress,
kProjNoMip
};
// Projection types.
enum
{
kIlluminate,
kAdd,
kMult,
kMADD
};
// Animation rollout parameters
enum
{
kAnimName,
kAnimAutoStart,
kAnimLoop,
kAnimLoopName
};
plRTLightBase() { }//meshBuilt = 0; fClassDesc = NULL; fLightPB = NULL; fIP = NULL; BuildMeshes(true); }
virtual ~plRTLightBase();
void DeleteThis() { delete this; }
static ParamBlockDesc2 *GetAnimPBDesc( void );
TCHAR* GetObjectName() { return (TCHAR*)fClassDesc->ClassName(); }
void GetClassName(TSTR& s) { s = fClassDesc->ClassName(); }
virtual IParamBlock2 *GetParamBlock( int i );
virtual IParamBlock2* GetParamBlock2();
virtual IParamBlock2* GetParamBlockByID(short id);
plLayerTex* GetTex() { return fTex; }
// So our animatables will show up in the trackview
virtual int NumParamBlocks() { return 1; }
virtual int NumSubs();
virtual Animatable* SubAnim(int i);
virtual TSTR SubAnimName(int i);
// plug-in mouse creation callback
CreateMouseCallBack* GetCreateMouseCallBack();
RefTargetHandle Clone(RemapDir &remap = NoRemap()){ plRTLightBase* thisObj = TRACKED_NEW plRTLightBase(); BaseClone(this, thisObj, remap); return thisObj;}
virtual void BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev);
virtual void EndEditParams(IObjParam *ip, ULONG flags, Animatable *next);
// main function that will build our mesh
void FreeCaches();
// retreives bounding box in object space/world space
void GetLocalBoundBox(TimeValue t, INode *node, ViewExp *vpt, Box3 &box);
void GetWorldBoundBox(TimeValue t, INode *node, ViewExp *vpt, Box3 &box);
// main display function for this object
int Display(TimeValue t, INode *node, ViewExp *vpt, int flags);
virtual int DrawConeAndLine(TimeValue t, INode* inode, GraphicsWindow *gw, int drawing );
void GetConePoints(TimeValue t, float aspect, float angle, float dist, Point3 *q);
virtual void DrawCone(TimeValue t, GraphicsWindow *gw, float dist);
int GetSpotShape(void){ return 0; }
void SetExtendedDisplay(int flags){ extDispFlags = flags; }
void BoxCircle(TimeValue t, float r, float d, Box3& box, int extraPt, Matrix3 *tm);
void BoxDirPoints(TimeValue t, float angle, float dist, Box3 &box, Matrix3 *tm);
void BoxPoints(TimeValue t, float angle, float dist, Box3 &box, Matrix3 *tm);
void DrawArrow( TimeValue t, GraphicsWindow *gw, Point3 &direction, float dist );
void GetAttenPoints(TimeValue t, float rad, Point3 *q);
int GetRectXPoints(TimeValue t, float angle, float dist, Point3 *q);
int GetCirXPoints(TimeValue t, float angle, float dist, Point3 *q);
void DrawSphereArcs(TimeValue t, GraphicsWindow *gw, float r, Point3 *q);
//
void DrawX(TimeValue t, float asp, int npts, float dist, GraphicsWindow *gw, int indx);
void DrawCircleX(TimeValue t, GraphicsWindow *gw, float angle, float dist, Point3 *q);
void DrawWarpRect(TimeValue t, GraphicsWindow *gw, float angle, float dist, Point3 *q);
void DrawAttenCirOrRect(TimeValue t, GraphicsWindow *gw, float dist, BOOL froze, int uicol);
int DrawAtten(TimeValue t, INode *inode, GraphicsWindow *gw);
//void SetType(int tp);
// hit testing of this object
int HitTest(TimeValue t, INode *node, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt);
void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel );
//Internal routines
void BoxLight(TimeValue t, INode *inode, Box3& box, Matrix3 *tm);
void GetMat(TimeValue t, INode* inode, ViewExp *vpt, Matrix3& tm);
virtual RefTargetHandle GetReference(int i);
virtual void SetReference(int ref, RefTargetHandle rtarg);
virtual int NumRefs() { return kNumRefs;}
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);
// Called to retreive the state of this object at the specified time.
ObjectState Eval(TimeValue t) { return ObjectState(this); }
const char *GetCategory(){ return fClassDesc->Category(); }
//
// LightObject Specific Stuff below
//
//
virtual BOOL IsSpot( void ) { return FALSE; }
virtual BOOL IsDir( void ) { return FALSE; }
RefResult EvalLightState(TimeValue time, Interval& valid, LightState *ls);
ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuffer=FALSE);
void SetUseLight(int onOff) { fLightPB->SetValue(kLightOn, 0, onOff); NotifyDependents(FOREVER, PART_OBJ, REFMSG_CHANGE); }
BOOL GetUseLight(void) { BOOL v; fLightPB->GetValue(kLightOn, 0, v, FOREVER); return v; }
void SetHotspot(TimeValue time, float f);
float GetHotspot(TimeValue t, Interval& valid = Interval(0,0));
void SetFallsize(TimeValue time, float f);
float GetFallsize(TimeValue t, Interval& valid = Interval(0,0));
void SetAtten(TimeValue time, int which, float f);
float GetAtten(TimeValue t, int which, Interval& valid = Interval(0,0));
// TDist funcs needs implementation as of 31/5/01
void SetTDist(TimeValue time, float f);
float GetTDist(TimeValue t, Interval& valid = Interval(0,0));
void SetConeDisplay(int s, int notify=TRUE);
BOOL GetConeDisplay(void);
void SetRGBColor(TimeValue t, Point3& rgb); //fLightPB->SetValue(kRGB, t, rgb); NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);}
Point3 GetRGBColor(TimeValue t, Interval &valid = Interval(0,0)); //return fLightPB->GetPoint3(kRGB, t); }
void SetIntensity(TimeValue t, float f) { fLightPB->SetValue(kIntensity, t, f); NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);}
float GetIntensity(TimeValue t, Interval& valid = Interval(0,0)) {return fLightPB->GetFloat(kIntensity, t); }
void SetAspect(TimeValue t, float f) {}
float GetAspect(TimeValue t, Interval& valid = Interval(0,0)) { return 0.0; }
void SetUseAtten(int s){ fLightPB->SetValue(kUseAttenuationBool, 0, s); NotifyDependents(FOREVER, PART_OBJ, REFMSG_CHANGE); }
BOOL GetUseAtten(void) {return fLightPB->GetInt(kUseAttenuationBool, 0);}
void SetUseAttenNear(int s) { }
BOOL GetUseAttenNear(void) {return false;}
void SetAttenDisplay(int s){ }
BOOL GetAttenDisplay(void) {return fLightPB->GetInt(kUseAttenuationBool, 0);}
void SetAttenDisplayNear(int s){ }
BOOL GetAttenDisplayNear(void){return false;}
void Enable(int enab) { fLightPB->SetValue(kLightOn, 0, enab); }
void SetMapBias(TimeValue t, float f) {}
float GetMapBias(TimeValue t, Interval& valid = Interval(0,0)){return 0.0f;}
void SetMapRange(TimeValue t, float f) {}
float GetMapRange(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0f;}
void SetMapSize(TimeValue t, int f) {}
int GetMapSize(TimeValue t, Interval& valid = Interval(0,0)){return 0;}
void SetRayBias(TimeValue t, float f) {}
float GetRayBias(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0;} //{return 0.0f;}
int GetAbsMapBias() {return 0;}
void SetAbsMapBias(int a) {}
int GetOvershoot(){return 0;}
void SetOvershoot(int a){}
virtual int GetProjector() { return 0; }
void SetProjector(int a){fLightPB->SetValue(kUseProjectorBool, 0, a); }
ExclList* GetExclList(){return NULL;}
BOOL Include() {return false;}
virtual Texmap* GetProjMap(); //{ Interval valid = Interval(0,0); Texmap* MyMap; fLightPB->GetValue(kProjMapTexButton, 0, MyMap, valid); return MyMap; }
void SetProjMap(BitmapInfo* pmap);
void UpdateTargDistance(TimeValue t, INode* inode);
// GenLight Specific Stuff below
BOOL GetUseGlobal() { return false; } //Global Shadow param
void SetUseGlobal(int a) {}
BOOL GetShadow();
void SetShadow(int a);
BOOL GetShadowType() { return -1; } //No Shadows generated ....
void SetShadowType(int a) {} //Until implemented....
GenLight* NewLight(int type) { return NULL;}
int Type() {return -1;}
void SetSpotShape(int a) {}
void SetHSVColor(TimeValue t, class Point3 &b);
Point3 GetHSVColor(TimeValue t, Interval& b);
void SetContrast(int a, float other) {} // fLightPB->SetValue(kContrast, a, other); NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);}
float GetContrast(int a, Interval &valid) {return 0.0;} //float f; f = fLightPB->GetFloat(kContrast, a); return f;}
void SetAttenNearDisplay(int a) {}
BOOL GetAttenNearDisplay() {return false;}
ExclList& GetExclusionList() {return exclList;}
void SetExclusionList(ExclList & a) {}
BOOL SetHotSpotControl(Control* a) {fLightPB->SetController(ParamID(kHotSpot),0, a); return true;}
BOOL SetFalloffControl(Control* a) {fLightPB->SetController(ParamID(kFallOff),0, a); return true;}
Control* GetHotSpotControl() {return fLightPB->GetController(ParamID(kHotSpot));}
Control* GetFalloffControl() {return fLightPB->GetController(ParamID(kFallOff));}
BOOL SetColorControl(Control * a) {fLightPB->SetController(ParamID(kLightColor),0, a); return true;}
Control* GetColorControl() {return fLightPB->GetController(ParamID(kLightColor)); }
BOOL GetDecayType() { return fLightPB->GetInt(kAttenTypeRadio, 0) + 1;} //Offset for the radio.
void SetDecayType(BOOL onOff) {if (!onOff) return; else {fLightPB->SetValue(kAttenTypeRadio, 0, ((int) onOff - 1)); return;} }
void SetDecayRadius(TimeValue time, float f) { fLightPB->SetValue(kAttenMaxFalloffEdit, time, f); }
float GetDecayRadius(TimeValue t, Interval& valid = Interval(0,0)) {return fLightPB->GetFloat(kAttenMaxFalloffEdit, t); }
void SetDiffuseSoft(TimeValue time, float f) {}//fLightPB->SetValue(kDiffSoft, time, f);}
float GetDiffuseSoft(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0;} //return fLightPB->GetFloat(kDiffSoft, t);}
void SetAffectDiffuse(BOOL onOff) {}//fLightPB->SetValue(kDiffOn, 0, onOff); }
BOOL GetAffectDiffuse() {return false; } //fLightPB->GetInt(kDiffOn, 0); }
LRESULT CALLBACK TrackViewWinProc( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam ){return(0);}
};
#endif

View File

@ -0,0 +1,906 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// plRealTimeLights.cpp - Implementation for some MAX RT lights //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#include "HeadSpin.h"
#include "plRealTimeLights.h"
#include "iparamm2.h"
#include "../MaxPlasmaMtls/Layers/plLayerTex.h"
#include "../MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h"
#include "../MaxComponent/plMaxAnimUtils.h"
#include "plRTLightBaseAnimDlgProc.h"
#include "../plGLight/plLightKonstants.h"
void DummyLightCodeIncludeFunc() {}
//// Static ClassDesc2 Get Functions //////////////////////////////////////////
plRTOmniLightDesc plRTOmniLightDesc::fStaticDesc;
plRTSpotLightDesc plRTSpotLightDesc::fStaticDesc;
plRTDirLightDesc plRTDirLightDesc::fStaticDesc;
//// ParamBlock2 DlgProc Functions ////////////////////////////////////////////
const char* DecayLevel[] = {
"None",
"Inverse",
"Inverse Square",
NULL
};
const char* ShadowState[] = {
"Shadow Map",
NULL
};
class LightDlgProc : public plBaseLightProc
{
protected:
void IValidateSpinners( TimeValue t, WPARAM wParam, IParamBlock2 *pb, IParamMap2 *map )
{
/// Make sure falloff is >= hotspot (adjust the one we're not editing)
float hotspot, falloff;
hotspot = pb->GetFloat( plRTLightBase::kHotSpot, t );
falloff = pb->GetFloat( plRTLightBase::kFallOff, t );
if( falloff < hotspot )
{
if( LOWORD( wParam ) == IDC_LHOTSIZESPINNER )
pb->SetValue( plRTLightBase::kFallOff, t, hotspot );
else
pb->SetValue( plRTLightBase::kHotSpot, t, falloff );
map->Invalidate( plRTLightBase::kHotSpot );
map->Invalidate( plRTLightBase::kFallOff );
}
IBuildLightMesh( (plRTLightBase *)pb->GetOwner(), falloff );
}
public:
BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
IParamBlock2 *pb = map->GetParamBlock();
plRTLightBase *gl = (plRTLightBase *) pb->GetOwner();
switch (msg)
{
case WM_COMMAND:
if(LOWORD(wParam) == IDC_PROJ_MAPNAME )
{
if( gl->ClassID() != RTOMNI_LIGHT_CLASSID )
// if(pb->GetInt(plRTLightBase::kLightType) != plRTLightBase::RT_OMNI)
// map->SetValue(plRTSpotLight::kProjMapTexButton, t,
//gl->SetProjMap(
map->Invalidate(plRTSpotLight::kProjMapTexButton);
return false;
}
else if( LOWORD( wParam ) == IDC_LHOTSIZE || LOWORD( wParam ) == IDC_LFALLOFF )
{
if( HIWORD( wParam ) == EN_CHANGE )
IValidateSpinners( t, wParam, pb, map );
}
break;
case CC_SPINNER_CHANGE:
if( LOWORD( wParam ) == IDC_LHOTSIZESPINNER || LOWORD( wParam ) == IDC_LFALLOFFSPINNER )
IValidateSpinners( t, wParam, pb, map );
break;
}
return plBaseLightProc::DlgProc( t, map, hWnd, msg, wParam, lParam );;
}
void DeleteThis() {};
};
static LightDlgProc gLiteDlgProc;
#include "plRealTimeLightsPBDec.h"
#include "plRTObjLightDesc.h"
///////////////////////////////////////////////////////////////////////
//
// Light Descriptors declared below for the different plRTLights...
//
//
//
//
//--- Base Light Class derived from the ObjLightDesc
#define COS_45 0.7071067f
#define COS_45_2X 1.4142136f
static float stepFactor[] = {50.0f,80.0f,140.0f};
#define MAXSTEPS 1000
BaseObjLight::BaseObjLight(INode *n) : ObjLightDesc(n)
{
ObjectState os = n->EvalWorldState(TimeValue(0));
assert(os.obj->SuperClassID()==LIGHT_CLASS_ID);
gl = (os.obj->GetInterface(I_MAXSCRIPTPLUGIN) != NULL) ? (plRTLightBase*)os.obj->GetReference(0) : (plRTLightBase*)os.obj; // JBW 4/7/99
}
static Color blackCol(0,0,0);
int BaseObjLight::Update(TimeValue t, const RendContext& rc, RenderGlobalContext * rgc, BOOL shadows, BOOL shadowGeomChanged) {
ObjLightDesc::Update(t,rc,rgc,shadows,shadowGeomChanged);
intensCol = ls.intens*ls.color*rc.GlobalLightLevel();
ObjectState os = inode->EvalWorldState(t);
plRTLightBase* lob = (plRTLightBase *)os.obj;
contrast = 0; //lob->GetParamBlock2()->GetFloat(plRTLightBase::kContrast, t);
diffSoft = 0; //lob->GetDiffuseSoft(t)/100.0f;
float a = .5; //contrast/204.0f + 0.5f; // so "a" varies from .5 to .99
kA = (2.0f-1.0f/a);
kB = 1.0f-kA;
diffSoften = false; //lob->GetParamBlock2()->GetInt(plRTLightBase::kDiffOn, t); //GetSoftenDiffuse();
return 1;
}
//--- Omni Light ------------------------------------------------
OmniLight::OmniLight(INode *inode, BOOL forceShadowBuf ) : BaseObjLight(inode){
//projector = /*doShadows = shadowRay =*/ FALSE;
//projMap = NULL;
needMultiple = FALSE;
}
OmniLight::~OmniLight()
{
}
int OmniLight::UpdateViewDepParams(const Matrix3& worldToCam) {
BaseObjLight::UpdateViewDepParams(worldToCam);
return 1;
}
static Point3 MapToDir(Point3 p, int k) {
switch(k) {
case 0: return Point3( p.z, p.y, -p.x); // +X
case 1: return Point3( -p.z, p.y, p.x); // -X
case 2: return Point3( p.x, p.z, -p.y); // +Y
case 3: return Point3( p.x,-p.z, p.y); // -Y
case 4: return Point3( -p.x, p.y, -p.z); // +Z
case 5: return p; // -Z
}
return p;
}
static void GetMatrixForDir(Matrix3 &origm, Matrix3 &tm, int k ) {
tm = origm;
switch(k) {
case 0: tm.PreRotateY(-HALFPI); break; // Map 0: +X axis
case 1: tm.PreRotateY( HALFPI); break; // Map 1: -X axis
case 2: tm.PreRotateX( HALFPI); break; // Map 2: +Y axis
case 3: tm.PreRotateX(-HALFPI); break; // Map 3: -Y axis
case 4: tm.PreRotateY( PI ); break; // Map 4: +Z axis
case 5: break; // Map 5: -Z axis
}
}
static int WhichDir(Point3 &p) {
int j = MaxComponent(p); // the component with the maximum abs value
return (p[j]<0.0f) ? 2*j+1 : 2*j;
}
int OmniLight::Update(TimeValue t, const RendContext & rc,
RenderGlobalContext *rgc, BOOL shadows, BOOL shadowGeomChanged)
{
BaseObjLight::Update(t,rc,rgc,shadows,shadowGeomChanged);
ObjectState os = inode->EvalWorldState(t);
LightObject* lob = (LightObject *)os.obj;
assert(os.obj->SuperClassID()==LIGHT_CLASS_ID);
plRTOmniLight* gl = (lob->GetInterface(I_MAXSCRIPTPLUGIN) != NULL) ? (plRTOmniLight*)lob->GetReference(0) : (plRTOmniLight*)lob; // JBW 4/7/99
decayType = gl->GetDecayType();
decayRadius = gl->GetDecayRadius(t);
fov = HALFPI; // 90 degree fov
int res=1;
if(gl->GetTex())
gl->GetTex()->Update(t, FOREVER);
//projector = gl->GetProjector();
//if (projector){
// projMap = gl->GetProjMap();
// if( projMap ) projMap->Update(t,FOREVER);
//}
return res;
}
////------------------------------------------------------------------
//
//
// SpotLight descriptors.....
//
//
//
//
//
SpotLight::SpotLight(INode *inode, BOOL forceShadowBuf ):BaseObjLight(inode)
{
projMap = NULL;
}
int SpotLight::Update(TimeValue t, const RendContext &rc, RenderGlobalContext *rgc, BOOL shadows, BOOL shadowGeomChanged)
{
int res = 1;
BaseObjLight::Update(t,rc,rgc,shadows, shadowGeomChanged);
float hs = DegToRad(ls.hotsize);
float fs = DegToRad(ls.fallsize);
fall_tan = (float)tan(fs/2.0f);
hot_cos = (float)cos(hs/2.0f);
fall_cos =(float)cos(fs/2.0f);
fall_sin = (float)sin(fs/2.0f);
hotpct = ls.hotsize/ls.fallsize;
ihotpct = 1.0f - hotpct;
ObjectState os = inode->EvalWorldState(t);
LightObject* lob = (LightObject *)os.obj;
assert(os.obj->SuperClassID()==LIGHT_CLASS_ID);
plRTLightBase* gl = (lob->GetInterface(I_MAXSCRIPTPLUGIN) != NULL) ? (plRTLightBase*)lob->GetReference(0) : (plRTLightBase*)lob; // JBW 4/7/99
decayType = gl->GetDecayType();
decayRadius = gl->GetDecayRadius(t);
projector = gl->GetProjector();
fov = hsMaximum(fs,hs);
float aspect = 1.0f;
fov = 2.0f* (float)atan(tan(fov*0.5f)*sqrt(aspect));
zfac = -sz2 /(float)tan(0.5*(double)fov);
xscale = zfac;
yscale = -zfac*aspect;
curve =(float)fabs(1.0f/xscale);
rectv0.y = fall_sin * (float)sqrt(aspect);
rectv1.y = fall_sin / (float)sqrt(aspect);
rectv0.x = rectv1.x = fall_cos;
rectv0 = Normalize(rectv0);
rectv1 = Normalize(rectv1);
Interval v;
if (projector){
projMap = gl->GetProjMap();
if( projMap ) projMap->Update(t,v);
}
return res;
}
int SpotLight::UpdateViewDepParams(const Matrix3& worldToCam)
{
BaseObjLight::UpdateViewDepParams(worldToCam);
lightDir = -FNormalize(lightToCam.GetRow(2));
return 1;
}
BOOL SpotLight::IsFacingLight(Point3 &dir)
{
return dir.z>0.0f;
}
//--- Directional Light ------------------------------------------------
DirLight::DirLight(INode *inode, BOOL forceShadowBuf ) : BaseObjLight(inode)
{
projMap = NULL;
}
int DirLight::Update(TimeValue t, const RendContext &rc,
RenderGlobalContext *rgc, BOOL shadows, BOOL shadowGeomChanged)
{
int res = 1;
BaseObjLight::Update(t,rc,rgc,shadows,shadowGeomChanged);
hotsz = ls.hotsize;
fallsz = ls.fallsize;
fallsq = fallsz*fallsz;
hotpct = ls.hotsize/ls.fallsize;
ihotpct = 1.0f - hotpct;
ObjectState os = inode->EvalWorldState(t);
LightObject* lob = (LightObject *)os.obj;
assert(os.obj->SuperClassID()==LIGHT_CLASS_ID);
plRTDirLight* gl = (lob->GetInterface(I_MAXSCRIPTPLUGIN) != NULL) ? (plRTDirLight*)lob->GetReference(0) : (plRTDirLight*)lob; // JBW 4/7/99
//projector = gl->GetProjector();
aspect = 1.0f;
//if (projector){
// projMap = gl->GetProjMap();
// if( projMap ) projMap->Update(t,FOREVER);
// }
return res;
};
int DirLight::UpdateViewDepParams(const Matrix3& worldToCam) {
BaseObjLight::UpdateViewDepParams(worldToCam);
lightDir = FNormalize(lightToCam.GetRow(2));
return 1;
}
////////////////////////////////////////////////////////////////////////////////////
//
// plRTOmni Stuff below
//
//
//
//
//
plRTOmniLight::plRTOmniLight()
{
fIP = NULL;
fLightPB = NULL;
fClassDesc = plRTOmniLightDesc::GetDesc();
fClassDesc->MakeAutoParamBlocks(this);
fLightPB->SetValue(kLightColor, 0, Color(255,255,255));
SetHSVColor(0, Point3(255, 255, 255));
fTex = NULL;
meshBuilt = 0;
IBuildMeshes(true);
}
ObjLightDesc *plRTOmniLight::CreateLightDesc(INode *n, BOOL forceShadowBuf)
{
return TRACKED_NEW OmniLight( n, forceShadowBuf );
}
RefTargetHandle plRTOmniLight::Clone(RemapDir &remap)
{
plRTOmniLight *obj = TRACKED_NEW plRTOmniLight;//(plRTLightBase*) fClassDesc->Create(false);
obj->ReplaceReference(kRefSpotLight, fLightPB->Clone(remap));
BaseClone(this, obj, remap);
return obj;
}
void plRTOmniLight::IBuildMeshes( BOOL isnew )
{
BuildStaticMeshes();
fMesh = staticMesh[ plRTLightBase::RT_OMNI ];
}
//// DrawConeAndLine /////////////////////////////////////////////////////////
int plRTOmniLight::DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing )
{
float atOneHalfDist;
Matrix3 tm = inode->GetObjectTM( t );
gw->setTransform( tm );
gw->clearHitCode();
if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
{
if( GetUseAtten() )
{
// Draw hotspot as the point at which light is 1/2 intensity (just to help the visual)
gw->setColor( LINE_COLOR, GetUIColor( COLOR_HOTSPOT ) );
if( fLightPB->GetInt( kAttenTypeRadio, t ) == 0 )
atOneHalfDist = GetAtten( t, ATTEN_END ) / ( fLightPB->GetFloat( kIntensity, t ) * plSillyLightKonstants::GetFarPowerKonst() - 1.f );
else
atOneHalfDist = sqrt( GetAtten( t, ATTEN_END ) * GetAtten( t, ATTEN_END ) / ( fLightPB->GetFloat( kIntensity, t ) * plSillyLightKonstants::GetFarPowerKonst() - 1.f ) );
if( atOneHalfDist > 0.0f )
DrawCone( t, gw, atOneHalfDist );
gw->setColor( LINE_COLOR, GetUIColor( COLOR_FALLOFF ) );
DrawCone( t, gw, GetAtten( t, ATTEN_END ) );
}
else
DrawArrows( t, gw, 50 );
}
return gw->checkHitCode();
}
//// DrawCone ////////////////////////////////////////////////////////////////
// Function called by MAX to render the cone shape in the viewport for this
// light. Note that this is the cone, not the actual object itself!
void plRTOmniLight::DrawCone( TimeValue t, GraphicsWindow *gw, float dist )
{
Point3 pts[ NUM_CIRC_PTS * 3 + 1 ];
/// Draw sphere-thingy
GetAttenPoints( t, dist, pts );
gw->polyline( NUM_CIRC_PTS, pts, nil, nil, true, nil );
gw->polyline( NUM_CIRC_PTS, pts + NUM_CIRC_PTS, nil, nil, true, nil );
gw->polyline( NUM_CIRC_PTS, pts + 2 * NUM_CIRC_PTS, nil, nil, true, nil );
}
//// DrawArrows //////////////////////////////////////////////////////////////
// Renders some arrows in all directions, to show a radiating, attenuation-less
// omni light.
void plRTOmniLight::DrawArrows( TimeValue t, GraphicsWindow *gw, float dist )
{
Point3 directions[] = { Point3( 1, 0, 0 ), Point3( -1, 0, 0 ), Point3( 0, 1, 0 ), Point3( 0, -1, 0 ),
Point3( 0, 0, 1 ), Point3( 0, 0, -1 ),
Point3( 2, 2, 0 ), Point3( 2, -2, 0 ), Point3( 2, 0, 2 ), Point3( 2, 0, -2 ),
Point3( -2, 2, 0 ), Point3( -2, -2, 0 ), Point3( -2, 0, 2 ), Point3( -2, 0, -2 ),
Point3( 0, 2, 2 ), Point3( 0, 2, -2 ), Point3( 0, -2, 2 ), Point3( 0, -2, -2 ),
Point3( 0, 0, 0 ) };
Point3 empty( 0, 0, 0 );
int i;
Point3 pts[ 5 ];
/// Adjust directions
for( i = 0; directions[ i ] != empty; i++ )
{
if( directions[ i ].x == 2.f )
directions[ i ].x = 0.7f;
else if( directions[ i ].x == -2.f )
directions[ i ].x = -0.7f;
if( directions[ i ].y == 2.f )
directions[ i ].y = 0.7f;
else if( directions[ i ].y == -2.f )
directions[ i ].y = -0.7f;
if( directions[ i ].z == 2.f )
directions[ i ].z = 0.7f;
else if( directions[ i ].z == -2.f )
directions[ i ].z = -0.7f;
}
/// Draw da arrows
gw->setColor( LINE_COLOR, GetUIColor( COLOR_HOTSPOT ) );
for( i = 0; directions[ i ] != empty; i++ )
DrawArrow( t, gw, directions[ i ], dist );
}
//// GetLocalBoundBox ////////////////////////////////////////////////////////
void plRTOmniLight::GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box )
{
Point3 loc = node->GetObjectTM( t ).GetTrans();
float scaleFactor = vpt->NonScalingObjectSize() * vpt->GetVPWorldWidth( loc ) / 360.0f;
float width;
box = fMesh.getBoundingBox();
// Because we want to scale about the origin, not the box center, we have to do this funky offset
Point3 boxCenter = box.Center();
box.Translate( -boxCenter );
box.Scale( scaleFactor );
boxCenter *= scaleFactor;
box.Translate( boxCenter );
// Include points for the spotlight. That means either the attenuated cone or
// our unattenuated cone display
if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
{
if( GetUseAtten() )
width = GetAtten( t, ATTEN_END );
else
width = 50.f; // Include our arrows
box += Point3( -width, -width, -width );
box += Point3( width, width, width );
}
}
////////////////////////////////////////////////////////////////////////////////////////
//
//
// SpotLight Stuff
//
//
//// Local Copy of shared Anim PB /////////////////////////////////////////////
plRTSpotLight::plRTSpotLight()
{
fIP = NULL;
fLightPB = NULL;
fClassDesc = plRTSpotLightDesc::GetDesc();
fClassDesc->MakeAutoParamBlocks(this);
fLightPB->SetValue(kLightColor, 0, Color(255,255,255));
SetHSVColor(0, Point3(255, 255, 255));
fTex = NULL;
meshBuilt = 0;
IBuildMeshes(true);
}
ObjLightDesc *plRTSpotLight::CreateLightDesc(INode *n, BOOL forceShadowBuf)
{
return TRACKED_NEW SpotLight( n, forceShadowBuf );
}
RefTargetHandle plRTSpotLight::Clone(RemapDir &remap)
{
plRTSpotLight *obj = TRACKED_NEW plRTSpotLight;//(plRTLightBase*) fClassDesc->Create(false);
obj->ReplaceReference(kRefSpotLight, fLightPB->Clone(remap));
BaseClone(this, obj, remap);
return obj;
}
Texmap *plRTSpotLight::GetProjMap()
{
if( !fLightPB->GetInt( kUseProjectorBool ) )
return nil;
Interval valid = Interval(0,0);
if( !GetTex() )
{
if( fLightPB->GetInt( kUseProjectorBool ) )
{
PBBitmap* bitmap = fLightPB->GetBitmap( kProjMapTexButton, 0 );
SetProjMap( &bitmap->bi );
}
}
if( GetTex() )
{
const char* dbgTexName = GetTex()->GetName();
IParamBlock2 *bitmapPB = fTex->GetParamBlockByID(plLayerTex::kBlkBitmap);
hsAssert(bitmapPB, "LayerTex with no param block");
int noCompress = fLightPB->GetInt(kProjNoCompress);
int noMip = fLightPB->GetInt(kProjNoMip);
bitmapPB->SetValue(kBmpNonCompressed, TimeValue(0), noCompress);
bitmapPB->SetValue(kBmpNoFilter, TimeValue(0), noMip);
}
return (Texmap *)GetTex();
}
void plRTSpotLight::IBuildMeshes( BOOL isnew )
{
float val = fLightPB->GetFloat( kHotSpot, TimeValue(0) ); //Init val of HotSpot
if( isnew )
{
val = fLightPB->GetFloat(kHotSpot, TimeValue(0));
SetHotspot( TimeValue(0), val);
//val = 45.0;
val = fLightPB->GetFloat(kFallOff, TimeValue(0));
SetFallsize( TimeValue(0), val);
val = fLightPB->GetFloat(kAttenMaxFalloffEdit, TimeValue(0)); //fLightPB->GetFloat(kTargetDist, TimeValue(0));
if(val < 1.0f)
SetTDist( TimeValue(0), DEF_TDIST);
else
SetTDist( TimeValue(0), val);
val = fLightPB->GetFloat(kHotSpot, TimeValue(0));
}
BuildSpotMesh( val );
fMesh = spotMesh;
}
//// DrawConeAndLine /////////////////////////////////////////////////////////
int plRTSpotLight::DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing )
{
Matrix3 tm = inode->GetObjectTM( t );
gw->setTransform( tm );
gw->clearHitCode();
if( extDispFlags & EXT_DISP_ONLY_SELECTED )
DrawCone( t, gw, GetAtten( t, ATTEN_END ) );
return gw->checkHitCode();
}
//// DrawCone ////////////////////////////////////////////////////////////////
// Function called by MAX to render the cone shape in the viewport for this
// light. Note that this is the cone, not the actual object itself!
void plRTSpotLight::DrawCone( TimeValue t, GraphicsWindow *gw, float dist )
{
int i;
Point3 pts[ NUM_CIRC_PTS + 1 ], u[ 3 ];
if( !GetUseAtten() )
{
/// Don't use atten, but still want a cone, so draw the cone w/ a dist of 100
/// and the lines extending past it (thus indicating that it keeps going)
dist = 100;
}
/// Draw hotspot cone
gw->setColor( LINE_COLOR, GetUIColor( COLOR_HOTSPOT ) );
GetConePoints( t, -1.0f, GetHotspot( t ), dist, pts );
gw->polyline( NUM_CIRC_PTS, pts, nil, nil, true, nil );
if( GetUseAtten() )
{
u[ 0 ] = Point3( 0, 0, 0 );
for( i = 0; i < NUM_CIRC_PTS; i += SEG_INDEX )
{
u[ 1 ] = pts[ i ];
gw->polyline( 2, u, nil, nil, true, nil );
}
}
else
{
for( i = 0; i < NUM_CIRC_PTS; i += SEG_INDEX )
{
pts[ i ] = pts[ i ].Normalize();
DrawArrow( t, gw, pts[ i ], dist + 50.f );
}
}
/// Draw falloff cone if necessary
if( GetHotspot( t ) < GetFallsize( t ) )
{
gw->setColor( LINE_COLOR, GetUIColor( COLOR_FALLOFF ) );
GetConePoints( t, -1.0f, GetFallsize( t ), dist, pts );
gw->polyline( NUM_CIRC_PTS, pts, nil, nil, true, nil );
if( GetUseAtten() )
{
u[ 0 ] = Point3( 0, 0, 0 );
for( i = 0; i < NUM_CIRC_PTS; i += SEG_INDEX )
{
u[ 1 ] = pts[ i ];
gw->polyline( 2, u, nil, nil, true, nil );
}
}
else
{
for( i = 0; i < NUM_CIRC_PTS; i += SEG_INDEX )
{
pts[ i ] = pts[ i ].Normalize();
DrawArrow( t, gw, pts[ i ], dist + 50.f );
}
}
}
}
//// GetLocalBoundBox ////////////////////////////////////////////////////////
void plRTSpotLight::GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box )
{
Point3 loc = node->GetObjectTM( t ).GetTrans();
float scaleFactor = vpt->NonScalingObjectSize() * vpt->GetVPWorldWidth( loc ) / 360.0f;
float width, depth;
box = fMesh.getBoundingBox();
// Because we want to scale about the origin, not the box center, we have to do this funky offset
Point3 boxCenter = box.Center();
box.Translate( -boxCenter );
box.Scale( scaleFactor );
boxCenter *= scaleFactor;
box.Translate( boxCenter );
// Include points for the spotlight. That means either the attenuated cone or
// our unattenuated cone display
if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
{
if( GetUseAtten() )
depth = GetAtten( t, ATTEN_END );
else
depth = 100.f + 50.f; // Include arrows
width = depth * tan( DegToRad( GetFallsize( t ) / 2.f ) );
box += Point3( -width, -width, 0.f );
box += Point3( width, width, -depth );
}
}
///////////////////////////////////////////////////////////////////////////////
//// Directional Light ////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
plRTDirLight::plRTDirLight()
{
fIP = NULL;
fLightPB = NULL;
fClassDesc = plRTDirLightDesc::GetDesc();
fClassDesc->MakeAutoParamBlocks(this);
fLightPB->SetValue(kLightColor, 0, Color(255,255,255));
SetHSVColor(0, Point3(255, 255, 255));
fTex = NULL;
meshBuilt = 0;
IBuildMeshes(true);
}
ObjLightDesc *plRTDirLight::CreateLightDesc(INode *n, BOOL forceShadowBuf)
{
return TRACKED_NEW DirLight( n, forceShadowBuf );
}
RefTargetHandle plRTDirLight::Clone(RemapDir &remap)
{
plRTDirLight *obj = TRACKED_NEW plRTDirLight;//(plRTLightBase*) fClassDesc->Create(false);
obj->ReplaceReference(kRefDirLight, fLightPB->Clone(remap));
BaseClone(this, obj, remap);
return obj;
}
//// IBuildMeshes ////////////////////////////////////////////////////////////
void plRTDirLight::IBuildMeshes( BOOL isnew )
{
BuildStaticMeshes();
fMesh = staticMesh[ plRTLightBase::RT_OMNI + 1 ];
}
//// DrawCone ////////////////////////////////////////////////////////////////
// Function called by MAX to render the cone shape in the viewport for this
// light. Note that this is the cone, not the actual object itself!
void plRTDirLight::DrawCone( TimeValue t, GraphicsWindow *gw, float dist )
{
Point3 arrow[ 7 ];
int i, j, r;
float d;
const float spacing = 20.f;
// Draw some funky arrows to represent our direction
dist = 100.f;
gw->setColor( LINE_COLOR, GetUIColor( COLOR_HOTSPOT ) );
for( i = -2; i <= 2; i++ )
{
for( j = -2; j <= 2; j++ )
{
r = ( i * i ) + ( j * j );
if( r <= 4 )
{
d = dist * ( 5 - r ) / 5;
IBuildZArrow( i * spacing, j * spacing, -d, -10.f, arrow );
gw->polyline( 6, arrow, nil, nil, true, nil );
}
}
}
}
//// IBuildZArrow ////////////////////////////////////////////////////////////
void plRTDirLight::IBuildZArrow( float x, float y, float zDist, float arrowSize, Point3 *pts )
{
pts[ 0 ] = Point3( x, y, 0.f );
pts[ 1 ] = Point3( x, y, zDist );
pts[ 2 ] = Point3( x + arrowSize / 2.f, y, zDist - arrowSize );
pts[ 3 ] = Point3( x, y, zDist - arrowSize );
pts[ 4 ] = Point3( x, y + arrowSize / 2.f, zDist - arrowSize );
pts[ 5 ] = Point3( x, y, zDist );
}
//// GetLocalBoundBox ////////////////////////////////////////////////////////
void plRTDirLight::GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box )
{
Point3 loc = node->GetObjectTM( t ).GetTrans();
float scaleFactor = vpt->NonScalingObjectSize() * vpt->GetVPWorldWidth( loc ) / 360.0f;
float width, height, depth;
box = fMesh.getBoundingBox();
// Because we want to scale about the origin, not the box center, we have to do this funky offset
Point3 boxCenter = box.Center();
box.Translate( -boxCenter );
box.Scale( scaleFactor );
boxCenter *= scaleFactor;
box.Translate( boxCenter );
if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
{
width = 2 * 20.f + ( 10.f / 2.f ); // Add in half arrow size
height = 2 * 20.f + ( 10.f / 2.f );
depth = 100.f;
box += Point3( -width, -height, 0.f );
box += Point3( width, height, -depth );
}
}

View File

@ -0,0 +1,219 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// plRealTimeLights - Header for the derived MAX RT light type plug-ins //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#ifndef PL_RTLIGHT_H
#define PL_RTLIGHT_H
#include "plRealTimeLightBase.h"
#include "iparamm2.h"
#include "resource.h"
class plMaxNode;
///////////////////////////////////////////////////////////////////////////////
//// Omni Light ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTOmniLight : public plRTLightBase
{
public:
Class_ID ClassID() { return RTOMNI_LIGHT_CLASSID; }
SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
int CanConvertToType(Class_ID obtype) { return (obtype == RTOMNI_LIGHT_CLASSID ) ? 1 : 0; }
plRTOmniLight();
ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuf= FALSE);
GenLight* NewLight(int type) {return TRACKED_NEW plRTOmniLight();}
RefTargetHandle Clone(RemapDir &remap);
virtual void InitNodeName( TSTR &s ) { s = _T( "RTOmniLight" ); }
virtual int DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing );
virtual void DrawCone( TimeValue t, GraphicsWindow *gw, float dist );
virtual void DrawArrows( TimeValue t, GraphicsWindow *gw, float dist );
virtual void GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box );
protected:
virtual void IBuildMeshes( BOOL isNew );
virtual hsBool IHasAttenuation( void ) { return true; }
};
class plRTOmniLightDesc : public ClassDesc2
{
public:
int IsPublic() { return TRUE; }
void* Create(BOOL loading) { return TRACKED_NEW plRTOmniLight; }
const TCHAR* ClassName() { return GetString(IDS_DB_OMNI); }
SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
Class_ID ClassID() { return RTOMNI_LIGHT_CLASSID; }
const TCHAR* Category() { return _T("Plasma RunTime");}
const TCHAR* InternalName() { return _T("plRTOmni"); } // returns fixed parsable name (scripter-visible name)
HINSTANCE HInstance() { return hInstance; }
static plRTOmniLightDesc fStaticDesc;
static ClassDesc2 *GetDesc( void ) { return &fStaticDesc; }
};
///////////////////////////////////////////////////////////////////////////////
//// Spotlight ////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTSpotLight : public plRTLightBase
{
public:
plRTSpotLight(BOOL loading);
plRTSpotLight();
Class_ID ClassID() { return RTSPOT_LIGHT_CLASSID; }
SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
int CanConvertToType(Class_ID obtype) { return (obtype == RTSPOT_LIGHT_CLASSID ) ? 1 : 0; }
ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuf= FALSE);
GenLight* NewLight(int type) {return TRACKED_NEW plRTSpotLight();}
RefTargetHandle Clone(RemapDir &remap);
virtual Texmap *GetProjMap();
virtual BOOL IsSpot( void ) { return TRUE; }
virtual int GetProjector() { return fLightPB->GetInt( kUseProjectorBool, 0 ); }
virtual void InitNodeName( TSTR &s ) { s = _T( "RTSpotLight" ); }
virtual int DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing );
virtual void DrawCone( TimeValue t, GraphicsWindow *gw, float dist );
virtual void GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box );
protected:
virtual void IBuildMeshes( BOOL isNew );
virtual hsBool IHasAttenuation( void ) { return true; }
};
class plRTSpotLightDesc : public ClassDesc2
{
public:
int IsPublic() { return TRUE; }
void* Create(BOOL loading = FALSE) { return TRACKED_NEW plRTSpotLight; }
const TCHAR* ClassName() { return GetString(IDS_DB_FREE_SPOT); }
SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
Class_ID ClassID() { return RTSPOT_LIGHT_CLASSID; }
const TCHAR* Category() { return _T("Plasma RunTime"); }
const TCHAR* InternalName() { return _T("RTSpot"); } // returns fixed parsable name (scripter-visible name)
HINSTANCE HInstance() { return hInstance; }
static plRTSpotLightDesc fStaticDesc;
static ClassDesc2 *GetDesc( void ) { return &fStaticDesc; }
};
///////////////////////////////////////////////////////////////////////////////
//// Directional Light ////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class plRTDirLight : public plRTLightBase
{
public:
plRTDirLight();
Class_ID ClassID() { return RTDIR_LIGHT_CLASSID; }
SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuf= FALSE);
GenLight* NewLight(int type) {return TRACKED_NEW plRTDirLight();}
RefTargetHandle Clone(RemapDir &remap);
int CanConvertToType(Class_ID obtype) { return (obtype == RTDIR_LIGHT_CLASSID ) ? 1 : 0; }
virtual void DrawCone(TimeValue t, GraphicsWindow *gw, float dist);
virtual void GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box );
virtual BOOL IsDir( void ) { return TRUE; }
virtual void InitNodeName( TSTR &s ) { s = _T( "RTDirLight" ); }
protected:
virtual void IBuildMeshes( BOOL isNew );
void IBuildZArrow( float x, float y, float zDist, float arrowSize, Point3 *pts );
};
class plRTDirLightDesc : public ClassDesc2
{
public:
int IsPublic() { return TRUE; }
void* Create(BOOL loading) { return TRACKED_NEW plRTDirLight; }
const TCHAR* ClassName() { return GetString(IDS_DB_DIRECTIONAL); }
SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
Class_ID ClassID() { return RTDIR_LIGHT_CLASSID; }
const TCHAR* Category() { return _T("Plasma RunTime");}
const TCHAR* InternalName() { return _T("RTDir"); } // returns fixed parsable name (scripter-visible name)
HINSTANCE HInstance() { return hInstance; }
static plRTDirLightDesc fStaticDesc;
static ClassDesc2 *GetDesc( void ) { return &fStaticDesc; }
};
#endif

View File

@ -0,0 +1,339 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
///////////////////////////////////////////////////////////////////////////////
// //
// ParamBlock Type Konstants for plRT*Lights //
// Cyan, Inc. //
// //
//// Version History //////////////////////////////////////////////////////////
// //
// 8.2.2001 mcn - Created. //
// //
///////////////////////////////////////////////////////////////////////////////
#ifndef _plRTLightsPB_h
#define _plRTLightsPB_h
///////////////////////////////////////////////////////////////////////////////
//// Spotlights ///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static ParamBlockDesc2 RTSpotLightBlk
(
/// Main def
plRTSpotLight::kBlkSpotLight, _T("RT Spot Light"), 0, plRTSpotLightDesc::GetDesc(), P_AUTO_CONSTRUCT + P_AUTO_UI + P_MULTIMAP, plRTSpotLight::kRefSpotLight,
/// Rollout definitions
3,
plRTSpotLight::kLightMap1, IDD_LIGHT_PARAM, IDS_LIGHT_GEN_PARAMS, 0, 0, &gLiteDlgProc,
plRTSpotLight::kLightMap2, IDD_LIGHT_ATTEN, IDS_LIGHT_ATTEN_PARAMSS, 0, 0, &gLiteDlgProc,
plRTSpotLight::kLightMap3, IDD_FREE_SPOTLIGHT, IDS_LIGHT_SPOT_PARAMS, 0, 0, &gLiteDlgProc,
/// Rollout 1 - General Parameters
plRTSpotLight::kLightOn, _T("on"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, plRTSpotLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_LIGHT_ON,
end,
plRTSpotLight::kAffectDiffuse, _T("AffectDiffuse"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, plRTSpotLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_LIGHT_DIFFUSE,
end,
plRTSpotLight::kAmbientOnlyStub, _T("AmbientOnly"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, false,
p_ui, plRTSpotLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_AMBIENT_ONLY_STUB,
end,
plRTSpotLight::kCastShadows, _T("CastShadows"), TYPE_BOOL, 0, IDS_DS_CASTSHADOWSS,
// p_default, false,
// p_ui, plRTSpotLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_CAST_SHADOWS,
end,
plRTSpotLight::kLightColor, _T("LightColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_LIGHTCOL,
p_default, Color(255,255,255),
p_ui, plRTSpotLight::kLightMap1, TYPE_COLORSWATCH, IDC_LIGHT_COLOR,
end,
plRTSpotLight::kSpec, _T("AffectSpecular"), TYPE_BOOL, P_ANIMATABLE, IDS_DS_SPEC,
p_default, false,
//p_enable_ctrls, plRTSpotLight::kSpecularColorSwatch,
p_ui, plRTSpotLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_AFFECT_SPECULAR,
end,
plRTSpotLight::kSpecularColorSwatch,_T("SpecularColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_SPECCOL,
p_default, Color(255,255,255),
p_ui, plRTSpotLight::kLightMap1, TYPE_COLORSWATCH, IDC_LIGHT_COLOR_SPECULAR,
end,
plRTSpotLight::kIntensity, _T("IntensityEditSpinner"), TYPE_FLOAT, P_ANIMATABLE, IDS_DB_MULTIPLIER,
p_range, -250.0, 250.0,
p_default, 1.0,
p_ui, plRTSpotLight::kLightMap1, TYPE_SPINNER, EDITTYPE_FLOAT,
IDC_LMULT,IDC_LMULTSPINNER, .05f,
end,
/// Rollout 2 - Attenuation Parameters
plRTSpotLight::kUseAttenuationBool, _T("AttenOnBool"), TYPE_BOOL, 0, IDS_DS_USEFARATTEN,
p_default, TRUE,
p_ui, plRTSpotLight::kLightMap2, TYPE_SINGLECHEKBOX, IDC_LIGHT_ATTENBOOL,
p_enable_ctrls, 2, plRTSpotLight::kAttenMaxFalloffEdit,plRTSpotLight::kAttenTypeRadio,
end,
plRTSpotLight::kAttenMaxFalloffEdit, _T("MaxFalloffEdit"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_ATTENSTARTNEAR,
p_range, 0.0, 999999999.0,
p_default, 200.0,
p_ui, plRTSpotLight::kLightMap2, TYPE_SPINNER, EDITTYPE_POS_UNIVERSE,
IDC_LIGHT_ATTEN, IDC_LIGHT_ATTEN_SPIN, .05f,
end,
plRTSpotLight::kAttenTypeRadio, _T("LightShapeRadio"), TYPE_INT, 0, IDS_DS_LIGHTSHAPE_RATIO,
p_default, 0,
//p_vals, 1, 2,
p_ui, plRTSpotLight::kLightMap2, TYPE_RADIO, 3,
IDC_LIGHT_ATTEN_LINEAR_RADIO, IDC_LIGHT_ATTEN_QUAD_RADIO, IDC_LIGHT_ATTEN_NONE_RADIO,
end,
/// Rollout 3 - Spotlight Parameters
plRTSpotLight::kShowConeBool, _T("ShowConeBool"), TYPE_BOOL, 0, IDS_DS_SHOWCONE,
p_default, false,
p_ui, plRTSpotLight::kLightMap3, TYPE_SINGLECHEKBOX, IDC_SHOW_CONE,
end,
plRTSpotLight::kHotSpot, _T("HotSpot"), TYPE_FLOAT, P_ANIMATABLE, IDS_DB_HOTSIZE,
p_range, 0.0, 179.0f,
p_default, 43.0,
p_ui, plRTSpotLight::kLightMap3, TYPE_SPINNER, EDITTYPE_POS_FLOAT,
IDC_LHOTSIZE, IDC_LHOTSIZESPINNER, .05f,
end,
plRTSpotLight::kFallOff, _T("FallOff"), TYPE_FLOAT, P_ANIMATABLE, IDS_DB_FALLSIZE,
p_range, 0.0, 179.0f,
p_default, 45.0,
p_ui, plRTSpotLight::kLightMap3, TYPE_SPINNER, EDITTYPE_POS_FLOAT,
IDC_LFALLOFF, IDC_LFALLOFFSPINNER, .05f,
end,
plRTSpotLight::kUseProjectorBool, _T("UseProjBool"), TYPE_BOOL, 0, IDS_DS_PROJ_PARAMS,
p_default, false,
p_enable_ctrls, 1, plRTSpotLight::kProjMapTexButton,
p_ui, plRTSpotLight::kLightMap3, TYPE_SINGLECHEKBOX, IDC_PROJECTOR,
end,
plRTSpotLight::kProjMapTexButton, _T("ProjMapButton"), TYPE_BITMAP, P_SHORT_LABELS, IDS_DS_PROJMAP,
p_ui, plRTSpotLight::kLightMap3, TYPE_BITMAPBUTTON, IDC_PROJ_MAPNAME,
p_accessor, plLightTexPBAccessor::Instance(),
end,
plRTLightBase::kProjTypeRadio, _T("ProjTypeRadio"), TYPE_INT, 0, 0,
p_default, plRTLightBase::kIlluminate,
p_ui, plRTSpotLight::kLightMap3, TYPE_RADIO, 4, IDC_ILLUMINATE, IDC_ADD, IDC_MULT, IDC_MADD,
p_vals, plRTLightBase::kIlluminate, plRTLightBase::kAdd, plRTLightBase::kMult, plRTLightBase::kMADD,
end,
plRTLightBase::kProjNoCompress, _T("NoCompress"), TYPE_BOOL, 0, IDS_DS_PROJ_PARAMS,
p_default, false,
p_ui, plRTSpotLight::kLightMap3, TYPE_SINGLECHEKBOX, IDC_PROJ_NOCOMPRESS,
end,
plRTLightBase::kProjNoMip, _T("NoMip"), TYPE_BOOL, 0, IDS_DS_PROJ_PARAMS,
p_default, false,
p_ui, plRTSpotLight::kLightMap3, TYPE_SINGLECHEKBOX, IDC_PROJ_NOMIP,
end,
end
);
///////////////////////////////////////////////////////////////////////////////
//// Omni Lights //////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static ParamBlockDesc2 RTOmniLightBlk
(
/// Main def
plRTOmniLight::kBlkOmniLight, _T("RT Omni Light"), 0, plRTOmniLightDesc::GetDesc(), P_AUTO_CONSTRUCT + P_AUTO_UI + P_MULTIMAP, plRTOmniLight::kRefOmniLight,
/// Rollout definitions
2,
plRTOmniLight::kLightMap1, IDD_LIGHT_PARAM, IDS_LIGHT_GEN_PARAMS, 0, 0, &gLiteDlgProc,
plRTOmniLight::kLightMap2, IDD_LIGHT_ATTEN, IDS_LIGHT_ATTEN_PARAMSS, 0, 0, &gLiteDlgProc,
/// Rollout 1 - General Parameters
plRTOmniLight::kLightOn, _T("on"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, plRTOmniLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_LIGHT_ON,
end,
plRTOmniLight::kAffectDiffuse, _T("AffectDiffuse"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, plRTOmniLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_LIGHT_DIFFUSE,
end,
plRTOmniLight::kAmbientOnlyStub, _T("AmbientOnly"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, false,
p_ui, plRTOmniLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_AMBIENT_ONLY_STUB,
end,
plRTOmniLight::kCastShadows, _T("CastShadows"), TYPE_BOOL, 0, IDS_DS_CASTSHADOWSS,
// p_default, false,
// p_ui, plRTOmniLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_CAST_SHADOWS,
end,
plRTOmniLight::kLightColor, _T("LightColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_LIGHTCOL,
p_default, Color(255,255,255),
p_ui, plRTOmniLight::kLightMap1, TYPE_COLORSWATCH, IDC_LIGHT_COLOR,
end,
plRTOmniLight::kSpec, _T("AffectSpecular"), TYPE_BOOL, P_ANIMATABLE, IDS_DS_SPEC,
p_default, false,
p_ui, plRTOmniLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_AFFECT_SPECULAR,
end,
plRTOmniLight::kSpecularColorSwatch,_T("SpecularColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_SPECCOL,
p_default, Color(255,255,255),
p_ui, plRTOmniLight::kLightMap1, TYPE_COLORSWATCH, IDC_LIGHT_COLOR_SPECULAR,
end,
plRTOmniLight::kIntensity, _T("IntensityEditSpinner"), TYPE_FLOAT, P_ANIMATABLE, IDS_DB_MULTIPLIER,
p_range, -250.0, 250.0,
p_default, 1.0,
p_ui, plRTOmniLight::kLightMap1, TYPE_SPINNER, EDITTYPE_POS_FLOAT,
IDC_LMULT,IDC_LMULTSPINNER, .05f,
end,
/// Rollout 2 - Light Attenuation Parameters
plRTOmniLight::kUseAttenuationBool, _T("AttenOnBool"), TYPE_BOOL, 0, IDS_DS_USEFARATTEN,
p_default, TRUE,
p_ui, plRTOmniLight::kLightMap2, TYPE_SINGLECHEKBOX, IDC_LIGHT_ATTENBOOL,
p_enable_ctrls, 2, plRTOmniLight::kAttenMaxFalloffEdit, plRTOmniLight::kAttenTypeRadio,
end,
plRTOmniLight::kAttenMaxFalloffEdit, _T("MaxFalloffEdit"), TYPE_FLOAT, P_ANIMATABLE, IDS_DS_ATTENSTARTNEAR,
p_range, 0.0, 999999999.0,
p_default, 200.0,
p_ui, plRTOmniLight::kLightMap2, TYPE_SPINNER, EDITTYPE_POS_UNIVERSE,
IDC_LIGHT_ATTEN, IDC_LIGHT_ATTEN_SPIN, .05f,
end,
plRTOmniLight::kAttenTypeRadio, _T("LightShapeRadio"), TYPE_INT, 0, IDS_DS_LIGHTSHAPE_RATIO,
p_default, 0,
//p_vals, 1, 2,
p_ui, plRTOmniLight::kLightMap2, TYPE_RADIO, 3,
IDC_LIGHT_ATTEN_LINEAR_RADIO, IDC_LIGHT_ATTEN_QUAD_RADIO, IDC_LIGHT_ATTEN_NONE_RADIO,
end,
end
);
///////////////////////////////////////////////////////////////////////////////
//// Directional Lights ///////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static ParamBlockDesc2 RTTDirLightBlk
(
/// Main def
plRTDirLight::kBlkTSpotLight, _T("RT Spot Light"), 0, plRTDirLightDesc::GetDesc(), P_AUTO_CONSTRUCT + P_AUTO_UI + P_MULTIMAP, plRTDirLight::kRefTSpotLight,
/// Rollout definitions
1,
plRTDirLight::kLightMap1, IDD_LIGHT_PARAM, IDS_LIGHT_GEN_PARAMS, 0, 0, &gLiteDlgProc,
/// Rollout 1 - General Parameters
plRTDirLight::kLightOn, _T("on"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, plRTDirLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_LIGHT_ON,
end,
plRTDirLight::kAffectDiffuse, _T("AffectDiffuse"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, true,
p_ui, plRTDirLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_LIGHT_DIFFUSE,
end,
plRTDirLight::kAmbientOnlyStub, _T("AmbientOnly"), TYPE_BOOL, 0, IDS_RTLIGHT_ON,
p_default, false,
p_ui, plRTDirLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_AMBIENT_ONLY_STUB,
end,
plRTDirLight::kCastShadows, _T("CastShadows"), TYPE_BOOL, 0, IDS_DS_CASTSHADOWSS,
// p_default, false,
// p_ui, plRTDirLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_CAST_SHADOWS,
end,
plRTDirLight::kLightColor, _T("LightColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_LIGHTCOL,
p_default, Color(255,255,255),
p_ui, plRTDirLight::kLightMap1, TYPE_COLORSWATCH, IDC_LIGHT_COLOR,
end,
plRTDirLight::kSpec, _T("AffectSpecular"), TYPE_BOOL, P_ANIMATABLE, IDS_DS_SPEC,
p_default, false,
p_ui, plRTDirLight::kLightMap1, TYPE_SINGLECHEKBOX, IDC_AFFECT_SPECULAR,
end,
plRTDirLight::kSpecularColorSwatch,_T("SpecularColor"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_SPECCOL,
p_default, Color(255,255,255),
p_ui, plRTDirLight::kLightMap1, TYPE_COLORSWATCH, IDC_LIGHT_COLOR_SPECULAR,
end,
plRTDirLight::kIntensity, _T("IntensityEditSpinner"), TYPE_FLOAT, P_ANIMATABLE, IDS_DB_MULTIPLIER,
p_range, -250.0, 250.0,
p_default, 1.0,
p_ui, plRTDirLight::kLightMap1, TYPE_SPINNER, EDITTYPE_FLOAT,
IDC_LMULT,IDC_LMULTSPINNER, .05f,
end,
end
);
#endif //_plRTLightsPB_h

View File

@ -0,0 +1,120 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/**********************************************************************
*<
FILE: prim.h
DESCRIPTION:
CREATED BY: Dan Silva
HISTORY:
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __PRIM__H
#define __PRIM__H
#include "Max.h"
#include "resource.h"
#ifdef DESIGN_VER //for conversion to amodeler solids
#include "igeomimp.h"
#include "plugapi.h"
#endif
TCHAR *GetString(int id);
extern ClassDesc* GetBoxobjDesc();
extern ClassDesc* GetSphereDesc();
extern ClassDesc* GetCylinderDesc();
extern ClassDesc* GetSimpleCamDesc();
extern ClassDesc* GetOmniLightDesc();
extern ClassDesc* GetDirLightDesc();
extern ClassDesc *GetTDirLightDesc();
extern ClassDesc* GetFSpotLightDesc();
extern ClassDesc* GetTSpotLightDesc();
extern ClassDesc* GetLookatCamDesc();
extern ClassDesc* GetSplineDesc();
#ifdef DESIGN_VER
extern ClassDesc* GetOrthoSplineDesc();
#endif
extern ClassDesc* GetNGonDesc();
extern ClassDesc* GetDonutDesc();
extern ClassDesc* GetTargetObjDesc();
extern ClassDesc* GetBonesDesc();
extern ClassDesc* GetRingMasterDesc();
extern ClassDesc* GetSlaveControlDesc();
extern ClassDesc* GetQuadPatchDesc();
extern ClassDesc* GetTriPatchDesc();
extern ClassDesc* GetTorusDesc();
extern ClassDesc* GetMorphObjDesc();
extern ClassDesc* GetCubicMorphContDesc();
extern ClassDesc* GetRectangleDesc();
extern ClassDesc* GetBoolObjDesc();
extern ClassDesc* GetTapeHelpDesc();
extern ClassDesc* GetProtHelpDesc();
extern ClassDesc* GetTubeDesc();
extern ClassDesc* GetConeDesc();
extern ClassDesc* GetHedraDesc();
extern ClassDesc* GetCircleDesc();
extern ClassDesc* GetEllipseDesc();
extern ClassDesc* GetArcDesc();
extern ClassDesc* GetStarDesc();
extern ClassDesc* GetHelixDesc();
extern ClassDesc* GetRainDesc();
extern ClassDesc* GetSnowDesc();
extern ClassDesc* GetTextDesc();
extern ClassDesc* GetTeapotDesc();
extern ClassDesc* GetBaryMorphContDesc();
#ifdef DESIGN_VER
extern ClassDesc* GetOrthoSplineDesc();
extern ClassDesc* GetParallelCamDesc();
#endif
extern ClassDesc* GetGridobjDesc();
extern ClassDesc* GetNewBonesDesc();
extern HINSTANCE hInstance;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,124 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/**********************************************************************
*<
FILE: target.h
DESCRIPTION: Defines a Target Object Class
CREATED BY: Dan Silva
HISTORY: created 11 January 1995
*> Copyright (c) 1994, All Rights Reserved.
**********************************************************************/
#ifndef __TARGET__H__
#define __TARGET__H__
class TargetObject: public GeomObject {
friend class TargetObjectCreateCallBack;
friend BOOL CALLBACK TargetParamDialogProc( HWND hDlg, UINT message,
WPARAM wParam, LPARAM lParam );
// Mesh cache
static HWND hSimpleCamParams;
static IObjParam* iObjParams;
static Mesh mesh;
static int meshBuilt;
void GetMat(TimeValue t, INode* inode, ViewExp* vpt, Matrix3& tm);
void BuildMesh();
// inherited virtual methods for Reference-management
RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message );
public:
TargetObject();
// inherited virtual methods:
// From BaseObject
int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt);
int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags);
CreateMouseCallBack* GetCreateMouseCallBack();
void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
TCHAR *GetObjectName() { return GetString(IDS_DB_TARGET); }
// From Object
ObjectState Eval(TimeValue time);
void InitNodeName(TSTR& s) { s = GetString(IDS_DB_TARGET); }
ObjectHandle ApplyTransform(Matrix3& matrix);
int UsesWireColor() { return 0; }
int IsRenderable() { return 0; }
// From GeomObject
int IntersectRay(TimeValue t, Ray& r, float& at);
ObjectHandle CreateTriObjRep(TimeValue t); // for rendering, also for deformation
void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box );
void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box );
void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel );
// From Animatable
void DeleteThis() {
delete this;
}
Class_ID ClassID() { return Class_ID(TARGET_CLASS_ID,0); }
void GetClassName(TSTR& s) { s = TSTR(GetString(IDS_DB_TARGET_CLASS)); }
int IsKeyable(){ return 1;}
LRESULT CALLBACK TrackViewWinProc( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam ){return(0);}
// From ref.h
RefTargetHandle Clone(RemapDir& remap = NoRemap());
// IO
IOResult Save(ISave *isave);
IOResult Load(ILoad *iload);
};
#endif