deargui-vpl/ref/virtools/Samples/Virtools Interface SDK/ShaderEditor/ShaderEditor.cpp

123 lines
3.4 KiB
C++

// ShaderEditor.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "ShaderEditor.h"
#include "ShaderEditorDlg.h"
#include "ShaderEditorToolbarDlg.h"
#ifdef _MFCDEBUGNEW
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#endif
//---------------------------------------------------------------------------
//EXPORTED FUNCTIONS
PluginInfo g_ShaderEditor;
int GetVirtoolsPluginInfoCount()
{
return 1;
}
PluginInfo* GetVirtoolsPluginInfo(int index)
{
switch(index)
{
case 0:
return &g_ShaderEditor;
}
return NULL;
}
//EXPORTED FUNCTIONS
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// CShaderEditorApp
BEGIN_MESSAGE_MAP(CShaderEditorApp, CWinApp)
//{{AFX_MSG_MAP(CShaderEditorApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShaderEditorApp construction
CShaderEditorApp::CShaderEditorApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CShaderEditorApp object
CShaderEditorApp theApp;
int CShaderEditorApp::ExitInstance()
{
return CWinApp::ExitInstance();
}
WIN_HANDLE ShaderParamUIFunc(CKParameter* param,WIN_HANDLE parent,CKRECT *rect);
void ShaderEditorPluginCallback(PluginInfo::CALLBACK_REASON reason,PluginInterface* plugininterface)
{
CKContext* ctx = GetCKContext(0);
CKParameterManager *pm = ctx->GetParameterManager();
{ //--- Set UI Function of Shader Param
CKParameterTypeDesc *param_desc = pm->GetParameterTypeDescription(CKPGUID_SHADER);
if( !param_desc ) return;
param_desc->UICreatorFunction = ShaderParamUIFunc;
}
{ //--- Set UI Function of Shader Technique Param
CKParameterTypeDesc *param_desc = pm->GetParameterTypeDescription(CKPGUID_TECHNIQUE);
if( !param_desc ) return;
param_desc->UICreatorFunction = ShaderParamUIFunc;
}
{ //--- Set UI Function of Shader Technique Param
CKParameterTypeDesc *param_desc = pm->GetParameterTypeDescription(CKPGUID_PASS);
if( !param_desc ) return;
param_desc->UICreatorFunction = ShaderParamUIFunc;
}
}
BOOL CShaderEditorApp::InitInstance()
{
//Action Editor plugin
//--- Main plugin info
g_ShaderEditor.m_PluginType = PluginInfo::PT_EDITOR;
strcpy(g_ShaderEditor.m_Name,"Shader Editor Plugin");
//--- Editor info
g_ShaderEditor.m_EditorInfo.m_Guid[0] = 0x000000000;
g_ShaderEditor.m_EditorInfo.m_Guid[1] = 0x01ab13457;
strcpy(g_ShaderEditor.m_EditorInfo.m_EditorName,"Shader Editor");
g_ShaderEditor.m_EditorInfo.m_CreateEditorDlgFunc = fCreateEditorDlg;
g_ShaderEditor.m_EditorInfo.m_CreateToolbarDlgFunc = fCreateToolbarDlg;
g_ShaderEditor.m_EditorInfo.m_bUnique = TRUE;
g_ShaderEditor.m_EditorInfo.m_bIndestructible = FALSE;
g_ShaderEditor.m_EditorInfo.m_bManageScrollbar = FALSE;
g_ShaderEditor.m_EditorInfo.m_Width = 800;
g_ShaderEditor.m_EditorInfo.m_Height = 800;
g_ShaderEditor.m_EditorInfo.m_ToolbarHeight = 0;
//--- Setups only
g_ShaderEditor.m_EditorInfo.m_SetupClassID = 0;
//--- Give the Shader Parameter its construct dialog function
g_ShaderEditor.m_PluginCallback = ShaderEditorPluginCallback;
return CWinApp::InitInstance();
}