*
This commit is contained in:
@@ -0,0 +1,597 @@
|
||||
#include "Editor.h"
|
||||
|
||||
#include <gui/GUIPlane.h>
|
||||
#include <gui/GUISplitPanel.h>
|
||||
#include <gui/GUIScrollablePlane.h>
|
||||
#include <gui/GUICheckBox.h>
|
||||
#include <gui/GUIRadioButton.h>
|
||||
#include <gui/GUITab.h>
|
||||
#include <gui/GUITreeView.h>
|
||||
#include <gui/GUIComboBox.h>
|
||||
#include <gui/GUITextInput.h>
|
||||
#include <gui/CImage.h>
|
||||
#include <gui/GUIProgress.h>
|
||||
#include "gui/GUIToolStrip.h"
|
||||
#include "gui/GUIToolStripButton.h"
|
||||
#include <gui/GUIToolStripImage.h>
|
||||
#include <gui/GUIToolStripMenu.h>
|
||||
#include <gui/GUIMenu.h>
|
||||
#include <gui/GUIFileBrowserDialog.h>
|
||||
|
||||
#include "EditorShared.h"
|
||||
#include <shaders/IShaderGraphNode.h>
|
||||
#include <shaders/IShaderGraphNodeFactory.h>
|
||||
#include <shaders/IShaderGraphCompiler.h>
|
||||
#include <shaders/IShaderFactorySource.h>
|
||||
#include <shaders/ShaderGraphCompilerHLSL.h>
|
||||
|
||||
#include <vfs/pak/IPakFileContentProvider.h>
|
||||
#include <shaders/IShaderGraph.h>
|
||||
|
||||
#include "GUIShaderNode.h"
|
||||
#include "GUIShaderNodeIO.h"
|
||||
|
||||
#include <gui/GUIForm.h>
|
||||
|
||||
Editor::Editor()
|
||||
:bRunning(false)
|
||||
{
|
||||
}
|
||||
Editor::~Editor()
|
||||
{
|
||||
}
|
||||
void Editor::menu_exit(GUIMenuItem* m)
|
||||
{
|
||||
printf("Exit!!!!!!!\n");
|
||||
exit(0);
|
||||
}
|
||||
void Editor::AddShaderLink(GUIShaderNodeIO* left, GUIShaderNodeIO* right)
|
||||
{
|
||||
//make spline link
|
||||
nodeContainer->MakeLink(left, right);
|
||||
|
||||
if(right->IsInput())
|
||||
{
|
||||
GUIShaderNodeIO* tmp = right;
|
||||
right = left;
|
||||
left = tmp;
|
||||
}
|
||||
|
||||
//do shader graph connection
|
||||
IShaderGraphNode* leftNode = left->Owner->GetGraphicsNode();
|
||||
IShaderGraphNode* rightNode = right->Owner->GetGraphicsNode();
|
||||
|
||||
IShaderGraphNodePort* leftPort = leftNode->Inputs[left->id];
|
||||
IShaderGraphNodePort* rightPort = rightNode->Outputs[right->id];
|
||||
leftPort->MakeLink(leftPort, rightPort);
|
||||
}
|
||||
void Editor::OnButtonClick(GUIWindow* wnd, int key)
|
||||
{
|
||||
GUIButton* b = reinterpret_cast<GUIButton*>(wnd);
|
||||
b->SetCaption(b->GetCaption() + STR("/"));
|
||||
}
|
||||
void Editor::OnScroll(GUIScroll* wnd, int key)
|
||||
{
|
||||
char buf[32];
|
||||
int val = wnd->GetValue();
|
||||
itoa(val, &buf[0], 10);
|
||||
String s(buf);
|
||||
b2->SetCaption(s);
|
||||
}
|
||||
void Editor::SwitchPlayback(GUIWindow* wnd, int t)
|
||||
{
|
||||
if(snd->IsPlaying())
|
||||
{
|
||||
snd->Stop();
|
||||
reinterpret_cast<GUIButton*>(wnd)->SetCaption(STR("Play"));
|
||||
}
|
||||
else
|
||||
{
|
||||
snd->Play();
|
||||
reinterpret_cast<GUIButton*>(wnd)->SetCaption(STR("Stop"));
|
||||
}
|
||||
}
|
||||
void Editor::OnResizeOutput(GUIWindow* wnd)
|
||||
{
|
||||
printf("!!!!!!!!OMG!!! OUTPUT RESIZE!!!!\n");
|
||||
Rect2i r = sceneOutput->GetClientRectangleAbs();
|
||||
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->ResizeOutput(r.width, r.height);
|
||||
|
||||
CImage* img = (CImage*)sceneOutput->GetPicture();
|
||||
if(img)
|
||||
{
|
||||
img->Reset(pGraphics->GetSceneManager()->GetActiveScene()->GetOutput().ptr());
|
||||
sceneOutput->SetPicture(img);
|
||||
}
|
||||
}
|
||||
|
||||
GUIShaderNode* Editor::AddNode(const String& name)
|
||||
{
|
||||
GUIShaderNode* node = nodeContainer->AddNode(name);
|
||||
node->SetPosition(Vec2i(10,10));
|
||||
node->Event_Attach += NewDelegate(this, &Editor::AddShaderLink);
|
||||
return node;
|
||||
}
|
||||
void Editor::OnAddNode( GUIWindow* w, const String& s, void* d)
|
||||
{
|
||||
int id = (int)d;
|
||||
NodeInfo* info = node_info[id];
|
||||
GUIShaderNode* node = this->AddNode(info->ClassName);
|
||||
node->SetCaption(info->Name);
|
||||
}
|
||||
|
||||
void Editor::OnSaveGraph(GUIWindow* wnd, int p)
|
||||
{
|
||||
Core::IFile* graph_file;
|
||||
Core::IFile* gui_file;
|
||||
|
||||
//save shader graph
|
||||
if(ResourceManager::me()->getFileSystem()->GetFile("root/Data/MyMaterial.sg", &graph_file) != SC_OK){
|
||||
ResourceManager::me()->getFileSystem()->NewFile("root/Data/MyMaterial.sg", 0);
|
||||
ResourceManager::me()->getFileSystem()->GetFile("root/Data/MyMaterial.sg", &graph_file);
|
||||
}
|
||||
IDataStreamPtr stm = graph_file->OpenWrite(0);
|
||||
IMemoryStream mem_stm(1024*128);
|
||||
sg->Serialize(&mem_stm);
|
||||
stm->Write(mem_stm.GetData(), mem_stm.Tell());
|
||||
stm->Close();
|
||||
|
||||
//save GUI extra graph data
|
||||
if(ResourceManager::me()->getFileSystem()->GetFile("root/Data/MyMaterial.ext", &gui_file) != SC_OK){
|
||||
ResourceManager::me()->getFileSystem()->NewFile("root/Data/MyMaterial.ext", 0);
|
||||
ResourceManager::me()->getFileSystem()->GetFile("root/Data/MyMaterial.ext", &gui_file);
|
||||
}
|
||||
stm = gui_file->OpenWrite(0);
|
||||
mem_stm.Seek(0);
|
||||
nodeContainer->Serialize(&mem_stm);
|
||||
stm->Write(mem_stm.GetData(), mem_stm.Tell());
|
||||
stm->Close();
|
||||
|
||||
}
|
||||
|
||||
void Editor::OnGraphNodeDelete(GUINodeContainer* container, GUIShaderNode* node)
|
||||
{
|
||||
if(EditorShared::me()->propGrid->GetTarget() ==
|
||||
(Core::IPropertyHolder*)node)
|
||||
{
|
||||
EditorShared::me()->propGrid->SetTarget(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::OnLoadGraph(GUIWindow* wnd, int p)
|
||||
{
|
||||
Core::IFile* graph_file ;
|
||||
if(ResourceManager::me()->getFileSystem()->GetFile("root/Data/MyMaterial.sg", &graph_file) != SC_OK)
|
||||
return;
|
||||
IDataStreamPtr stm = graph_file->OpenRead();
|
||||
char* buffer = new char[stm->Length()];
|
||||
stm->Read(buffer, stm->Length());
|
||||
IMemoryStream mem_stm(stm->Length());
|
||||
mem_stm.Write(buffer, stm->Length());
|
||||
mem_stm.Seek(0);
|
||||
sg->Clear();
|
||||
sg->Deserialize(&mem_stm);
|
||||
nodeContainer->RebuildGraph();
|
||||
int cnt = nodeContainer->GetNodeCount();
|
||||
for(int i = 0; i < cnt; i++){
|
||||
nodeContainer->getNode(i)->Event_Attach += NewDelegate(this, &Editor::AddShaderLink);
|
||||
}
|
||||
stm->Close();
|
||||
delete[] buffer;
|
||||
Core::IFile* gui_file ;
|
||||
if(ResourceManager::me()->getFileSystem()->GetFile("root/Data/MyMaterial.ext", &gui_file) != SC_OK)
|
||||
return;
|
||||
stm = gui_file->OpenRead();
|
||||
buffer = new char[stm->Length()];
|
||||
stm->Read(buffer, stm->Length());
|
||||
IMemoryStream ext_stm(stm->Length());
|
||||
ext_stm.Write(buffer, stm->Length());
|
||||
ext_stm.Seek(0);
|
||||
nodeContainer->Deserialize(&ext_stm);
|
||||
stm->Close();
|
||||
delete[] buffer;
|
||||
}
|
||||
void Editor::OnCompileShader(GUIWindow* wnd, int p)
|
||||
{
|
||||
IMaterial* mat = new IMaterial(sg, new ShaderGraphCompilerHLSL());
|
||||
|
||||
NodeCollection* texNodes = nodeContainer->GetTextureUnits();
|
||||
for(int i = 0; i < (*texNodes).size(); i++)
|
||||
{
|
||||
GUIShaderNodeTexture* tex = (GUIShaderNodeTexture*)((*texNodes)[i]);
|
||||
texture_ptr texture = ResourceManager::me()->GetTexture(tex->GetFilename());
|
||||
mat->SetTexture(tex->GetGraphicsNode()->id, texture);
|
||||
}
|
||||
|
||||
|
||||
tower->setMaterial(mat, 0, false);
|
||||
//tower->getMaterial(0)->
|
||||
//assert(false && "Not implemented yet");
|
||||
/*ShaderGraphCompilerHLSL* shaderCompiler = new ShaderGraphCompilerHLSL();
|
||||
String ps, vs;
|
||||
shaderCompiler->CompileNode(sg->GetNodeByID(0), NULL, ps, vs);
|
||||
|
||||
IShader* pixelShader = CG::me()->GetRenderer()->CompilePixelShader(ps.c_str(), ps.length());
|
||||
IShader* vertexShader = CG::me()->GetRenderer()->CompileVertexShader(vs.c_str(), vs.length());
|
||||
|
||||
//grab texture info from graph
|
||||
IMaterial* mat = new IMaterial();
|
||||
mat->g_buffer_pass_ps = pixelShader;
|
||||
mat->g_buffer_pass_vs = vertexShader;
|
||||
|
||||
NodeCollection* texNodes = nodeContainer->GetTextureUnits();
|
||||
for(int i = 0; i < (*texNodes).size(); i++)
|
||||
{
|
||||
GUIShaderNodeTexture* tex = (GUIShaderNodeTexture*)((*texNodes)[i]);
|
||||
texture_ptr texture = ResourceManager::me()->GetTexture(tex->FileName());
|
||||
mat->SetTexture(texture, tex->GraphicsNode->resource_id);
|
||||
}
|
||||
|
||||
tower->setMaterial(mat, 0, false);*/
|
||||
}
|
||||
void Editor::Run()
|
||||
{
|
||||
node_info.push_back(new NodeInfo(STR("Float1"), STR("ConstFloat1")));
|
||||
node_info.push_back(new NodeInfo(STR("Float2"), STR("ConstFloat2")));
|
||||
node_info.push_back(new NodeInfo(STR("Float3"), STR("ConstFloat3")));
|
||||
node_info.push_back(new NodeInfo(STR("Float4"), STR("ConstFloat4")));
|
||||
|
||||
node_info.push_back(new NodeInfo(STR("Add"), STR("OpAdd")));
|
||||
node_info.push_back(new NodeInfo(STR("Sub"), STR("OpSub")));
|
||||
node_info.push_back(new NodeInfo(STR("Mul"), STR("OpMul")));
|
||||
node_info.push_back(new NodeInfo(STR("Div"), STR("OpDiv")));
|
||||
node_info.push_back(new NodeInfo(STR("Lerp"), STR("OpLerp")));
|
||||
node_info.push_back(new NodeInfo(STR("Normalize"), STR("OpNormalize")));
|
||||
node_info.push_back(new NodeInfo(STR("Saturate"), STR("OpSaturate")));
|
||||
node_info.push_back(new NodeInfo(STR("Power"), STR("OpPow")));
|
||||
node_info.push_back(new NodeInfo(STR("Texture2D"), STR("SrcTex2D")));
|
||||
node_info.push_back(new NodeInfo(STR("TEXCOORD"), STR("SrcUV")));
|
||||
node_info.push_back(new NodeInfo(STR("DecodeNormal"), STR("DecodeNormal")));
|
||||
node_info.push_back(new NodeInfo(STR("Time"), STR("Time")));
|
||||
|
||||
IShaderGraphNodeFactory* shaderFactory = IShaderGraphNodeFactory::me();
|
||||
IShaderFactorySource::Register(shaderFactory);
|
||||
sg = new IShaderGraph(shaderFactory);
|
||||
|
||||
|
||||
|
||||
//getchar();
|
||||
//SetCurrentDirectory("C:\\development\\LifeProject\\Release");
|
||||
/*CLog::me()->LogToConsole(true);
|
||||
ResourceManager::me()->SetCentralDirectory(STR("Resources\\"));
|
||||
|
||||
IFile* f;
|
||||
|
||||
if(SC_OK != ResourceManager::me()->getFileSystem()->GetFile("root/Resources/Data.pak", &f))
|
||||
{
|
||||
printf("Can not load Data.pak!");
|
||||
system("pause");
|
||||
return;
|
||||
}
|
||||
|
||||
IDataStreamPtr pr = f->OpenRead();
|
||||
|
||||
IPakFileContentProvider pp(pr.get(), STR("Data")); //pp() _text("Data.pak"), STR("Data")
|
||||
String mp(_text("root"));
|
||||
ResourceManager::me()->MountContentProvider(&pp, mp);*/
|
||||
ResourceManager::me()->SetCentralDirectory(STR("D:\\development\\Programming\\Projects\\Data\\"));
|
||||
|
||||
pWindow = new RenderWindowWin();
|
||||
pWindow->SetSize(900, 600);
|
||||
pWindow->CenterWindow();
|
||||
pWindow->SetCursorVisible(false);
|
||||
|
||||
pInput = new InputSystemOIS();
|
||||
pInput->Init(900, 600, false, pWindow->GetWindowHandle());
|
||||
pInput->AddListener(this);
|
||||
|
||||
Video::RenderParams params;
|
||||
params.AllowSwitchToSoftware = false;
|
||||
params.ForceWideScreen = false;
|
||||
params.ScreenWidth = 900;
|
||||
params.ScreenHeight = 600;
|
||||
params.Window = pWindow;
|
||||
params.Windowed = true;
|
||||
|
||||
pGraphics = new LifeEngine();
|
||||
pGraphics->Init(RT_DIRECTX_11, params);
|
||||
|
||||
pGraphics->GetGUI()->AddOverlay("GUI");
|
||||
|
||||
GUIOverlay* ovrl = pGraphics->GetGUI()->GetOverlay("GUI");
|
||||
|
||||
|
||||
nodeContainer = new GUINodeContainer(sg);
|
||||
nodeContainer->Event_DeleteNode += NewDelegate(this, &Editor::OnGraphNodeDelete);
|
||||
|
||||
GUIToolStrip* strp = new GUIToolStrip();
|
||||
strp->SetDock(DOCK_TOP);
|
||||
strp->SetHeight(20);
|
||||
strp->SetWidth(20);
|
||||
ovrl->AddChild(strp);
|
||||
//strp->SetBackColor(Vec4f(0.9f, 0.5f, 0.5f, 1.0f));
|
||||
|
||||
GUIToolStripMenu* fileMenu = new GUIToolStripMenu();
|
||||
|
||||
fileMenu->SetCaption(STR("File"));
|
||||
|
||||
GUIMenu* fm = fileMenu->GetMenu();
|
||||
GUIMenu* fm2;
|
||||
fm->AddItem(STR("Open"), false);
|
||||
fm2 = fm->AddItem(STR("Save as"), true)->GetSubmenu();
|
||||
fm->AddItem(STR("Recent"), false);
|
||||
fm->AddItem(STR("Exit"), false)->Event_Select += NewDelegate(this, &Editor::menu_exit);
|
||||
|
||||
fm2->AddItem(STR("BMP"), false);
|
||||
fm2->AddItem(STR("DDS"), false);
|
||||
fm2->AddItem(STR("OMG"), false);
|
||||
|
||||
strp->AddItem(fileMenu);
|
||||
|
||||
GUIToolStripButton* tsb = new GUIToolStripButton();
|
||||
tsb->AsButton()->SetCaption("Compile shader");
|
||||
tsb->AsButton()->Event_MouseClick += NewDelegate(this, &Editor::OnCompileShader);
|
||||
strp->AddItem(tsb);
|
||||
|
||||
GUIToolStripButton* tsb2 = new GUIToolStripButton();
|
||||
strp->AddItem(tsb2);
|
||||
|
||||
GUIToolStripButton* tsb3 = new GUIToolStripButton();
|
||||
strp->AddItem(tsb3);
|
||||
|
||||
GUIToolStripImage* tsim = new GUIToolStripImage();
|
||||
strp->AddItem(tsim);
|
||||
|
||||
GUIPicture* pic = (GUIPicture*)tsim->GetInternalWindow();
|
||||
pic->SetPicture(GUIManager::me()->GetRenderer()->GetImage(STR("save_icn.bmp")));
|
||||
|
||||
|
||||
GUIToolStripButton* save_button = new GUIToolStripButton();
|
||||
save_button->AsButton()->SetCaption("Save");
|
||||
save_button->AsButton()->Event_MouseClick += NewDelegate(this, &Editor::OnSaveGraph);
|
||||
strp->AddItem(save_button);
|
||||
|
||||
|
||||
GUIToolStripButton* load_button = new GUIToolStripButton();
|
||||
load_button->AsButton()->SetCaption("Load");
|
||||
load_button->AsButton()->Event_MouseClick += NewDelegate(this, &Editor::OnLoadGraph);
|
||||
strp->AddItem(load_button);
|
||||
|
||||
|
||||
GUIScrollablePlane* p11 = new GUIScrollablePlane();
|
||||
p11->SetWidth(900);
|
||||
p11->SetHeight(600);
|
||||
p11->SetDock(DOCK_FILL);
|
||||
p11->SetPosition(LifeMath::Vec2i(0, 0));
|
||||
ovrl->AddChild(p11);
|
||||
p11->GetVScroll()->Event_Scroll += NewDelegate(this, &Editor::OnScroll);
|
||||
p11->SetBorderEnabled(false);
|
||||
|
||||
sndSystem = new Sound::SoundSystem();
|
||||
if(sndSystem->Init(ResourceManager::me()->getFileSystem()) != 0)
|
||||
{
|
||||
printf("Error initializing sound system!");
|
||||
}
|
||||
else
|
||||
printf("Sound system ready!\n");
|
||||
|
||||
snd = sndSystem->getSound(STR("root/Data/Sounds/Wwise_Main_Menu_Streaming.005.ogg"), Sound::SM_ENABLED);
|
||||
|
||||
GUINodeList* node_list = new GUINodeList();
|
||||
node_list->SetDock(DOCK_RIGHT);
|
||||
node_list->SetWidth(150);
|
||||
node_list->Event_ItemSelected += NewDelegate(this, &Editor::OnAddNode);
|
||||
|
||||
int node_cnt = node_info.size();
|
||||
for(int i = 0; i < node_cnt; i++)
|
||||
{
|
||||
node_list->AddItem(node_info[i]->Name, (void*)i);
|
||||
}
|
||||
|
||||
AddNode(STR("Material"))->SetCaption(STR("Material"));;
|
||||
p11->AddChild(node_list);
|
||||
|
||||
GUISplitPanel* sp = new GUISplitPanel();
|
||||
p11->AddChild(sp);
|
||||
sp->SetWidth(900);
|
||||
sp->SetHeight(600);
|
||||
sp->SetDock(DOCK_FILL);
|
||||
sp->SetPosition(Vec2i(0,0));
|
||||
sp->SetSplitterHorisontal(false);
|
||||
sp->SetRealtimeResize(true);
|
||||
sp->SetSplitterPosition(450);
|
||||
|
||||
GUISplitPanel* sp2 = new GUISplitPanel();
|
||||
sp->GetContainer1()->AddChild(sp2);
|
||||
sp2->SetWidth(300);
|
||||
sp2->SetHeight(300);
|
||||
sp2->SetPosition(Vec2i(80,80));
|
||||
sp2->SetSplitterHorisontal(true);
|
||||
sp2->SetRealtimeResize(true);
|
||||
sp2->SetDock(Video::DOCK_FILL);
|
||||
sp2->SetBorderEnabled(false);
|
||||
sp->SetBorderEnabled(false);
|
||||
|
||||
sp->GetContainer2()->AddChild(nodeContainer);
|
||||
nodeContainer->SetDock(DOCK_FILL);
|
||||
|
||||
sceneOutput = new GUIPicture();
|
||||
sceneOutput->SetPosition(Vec2i(2,2));
|
||||
sceneOutput->SetWidth(200);
|
||||
sceneOutput->SetHeight(160);
|
||||
sceneOutput->SetDock(DOCK_FILL);
|
||||
sceneOutput->Event_Resize += NewDelegate(this, &Editor::OnResizeOutput);
|
||||
sp2->GetContainer1()->AddChild(sceneOutput);
|
||||
|
||||
|
||||
sp2->GetContainer1()->SetBackColor(Vec4f(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
sp2->GetContainer2()->SetBackColor(Vec4f(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
sp->GetContainer1()->SetBackColor(Vec4f(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
sp->GetContainer2()->SetBackColor(Vec4f(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
|
||||
|
||||
CImage* img = CImage::FromTexture(ResourceManager::me()->GetTexture(STR("root/Data/Textures/me_small.jpg")).ptr());
|
||||
sceneOutput->SetPicture(img);
|
||||
sceneOutput->SetWidth(img->GetWidth() + 2);
|
||||
sceneOutput->SetHeight(img->GetHeight() + 2);
|
||||
sceneOutput->SetBackColor(Vec4f(0,0,0,1));
|
||||
|
||||
tower = new Video::IObjectMesh("root/Data/Objects/Tower_opt.vmf");
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->PushNode(tower);
|
||||
tower->getTransform()->SetPosition(Vec3f(0,0,0));
|
||||
|
||||
Video::Light* l = new Video::Light(Video::LT_POINT);
|
||||
l->setRange(20);
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->PushNode(l);
|
||||
l->getTransform()->SetPosition(Vec3f(4,0.5f,-4.0f));
|
||||
l->color = Vec3f(1,0,0);
|
||||
l->intensity = 1.0f;
|
||||
|
||||
propGrid = new GUIPropertyGrid();
|
||||
propGrid->SetWidth(300);
|
||||
propGrid->SetHeight(300);
|
||||
propGrid->AddEditor(new GUIFilePathPropertyEditor(propGrid));
|
||||
propGrid->SetDock(DOCK_FILL);
|
||||
|
||||
sp2->GetContainer2()->AddChild(propGrid);
|
||||
EditorShared::me()->propGrid = propGrid;
|
||||
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->mainCam->setAspect(1.3333f);
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->mainCam->setFar(100.0f);
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->mainCam->setNear(0.1f);
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->mainCam->setFov(3.1415f / 3.0f);
|
||||
|
||||
/*GUIList* testList = new GUIList();
|
||||
|
||||
for(int i = 0; i < 50; i++)
|
||||
{
|
||||
testList->AddItem(STR("Trololo1"), 0);
|
||||
}
|
||||
ovrl->AddChild(testList);
|
||||
testList->SetWidth(200);
|
||||
testList->SetHeight(200);
|
||||
*/
|
||||
|
||||
//pGraphics->GetSceneManager()->GetActiveScene()->mainCam->setPosition(0,1,-20);
|
||||
|
||||
bRunning = true;
|
||||
float angle = 0.0f;
|
||||
while(bRunning)
|
||||
{
|
||||
angle += 0.001f;
|
||||
DoLogics();
|
||||
DoRendering();
|
||||
frame_counter.OnFrameEnd();
|
||||
if(frame_counter.GetFrameId() % 500 == 0)
|
||||
{
|
||||
printf("Average FPS: %f GUIBatch size=%i\r", frame_counter.GetFpsAvg(), sizeof(GUIVertex));
|
||||
}
|
||||
|
||||
tower->getTransform()->SetRotation(Vec3f(0,1,0), angle);
|
||||
if(frame_counter.GetFrameId() % 100 == 0)
|
||||
{
|
||||
//float val = (float)(snd->GetTimePosition() / snd->GetTimeLength());
|
||||
//slider->SetValue(val);
|
||||
//progress->SetValue(val);
|
||||
//int time = snd->GetTimePosition();
|
||||
//char tmp[128];
|
||||
|
||||
//sprintf(&tmp[0], "Playback time: %i m %i s", time / 60, time % 60);
|
||||
//time_info->SetText(String(tmp));
|
||||
}
|
||||
}
|
||||
|
||||
DoCleanup();
|
||||
}
|
||||
|
||||
void Editor::SetTrackPosition(GUIWindow* sender, int args)
|
||||
{
|
||||
double d = snd->GetTimeLength();
|
||||
snd->SeekTime(snd->GetTimeLength() * slider->GetValue());
|
||||
}
|
||||
|
||||
void Editor::DoLogics()
|
||||
{
|
||||
pWindow->Update();
|
||||
|
||||
if(bRunning)
|
||||
{
|
||||
sndSystem->Update();
|
||||
if(pWindow->IsActive())
|
||||
pInput->Capture();
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->Update(frame_counter.GetTimeElapled());
|
||||
}
|
||||
}
|
||||
void Editor::DoRendering()
|
||||
{
|
||||
if(bRunning)
|
||||
{
|
||||
pGraphics->GetMainRenderer()->SetDefaultTargets();
|
||||
pGraphics->GetMainRenderer()->ClearBuffers(CF_COLOR_TARGET, 0xffffffff, 1.0f, 0);
|
||||
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->mainCam->setPosition(0.0f, 0.6f, -0.5f);
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->mainCam->setDirection(Vec3f(0,0.3f,0));
|
||||
|
||||
pGraphics->GetSceneManager()->GetActiveScene()->Render();
|
||||
|
||||
pGraphics->GetGUI()->Render();
|
||||
|
||||
/*Video::DebugVertex lines[2];
|
||||
lines[0].position = Vec3f(10, 10, 0);
|
||||
lines[1].position = Vec3f(210, 210, 0);
|
||||
|
||||
lines[0].color = Vec3f(1, 1, 1);
|
||||
lines[1].color = Vec3f(1, 1, 1);
|
||||
|
||||
pGraphics->GetMainRenderer()->SetScissorRectangle(LifeMath::Rect2i(640, 480));*/
|
||||
|
||||
/*Video::DebugVertex pts[4];
|
||||
pts[0].color = LifeMath::Vec3f(1,0,0);
|
||||
pts[0].position = LifeMath::Vec3f(10,90,1);
|
||||
|
||||
pts[1].color = LifeMath::Vec3f(0,1,0);
|
||||
pts[1].position = LifeMath::Vec3f(80,90,1);
|
||||
|
||||
pts[2].color = LifeMath::Vec3f(0,0,1);
|
||||
pts[2].position = LifeMath::Vec3f(20,310,1);
|
||||
|
||||
pts[3].color = LifeMath::Vec3f(1,1,0);
|
||||
pts[3].position = LifeMath::Vec3f(90,310,1);*/
|
||||
|
||||
// for(int i = 0; i < 100; i++)
|
||||
//pGraphics->debugDrawer->DrawSpline2D(pts, 20);
|
||||
//pGraphics->debugDrawer->DrawLines2D(lines, 1);
|
||||
|
||||
pGraphics->GetMainRenderer()->SwapBuffers();
|
||||
pGraphics->FrameEnd();
|
||||
}
|
||||
}
|
||||
void Editor::DoCleanup()
|
||||
{
|
||||
}
|
||||
|
||||
bool Editor::KeyDown( Key key, unsigned int text, const std::string& str )
|
||||
{
|
||||
pGraphics->GetGUI()->KeyDown(key, text, str);
|
||||
return true;
|
||||
}
|
||||
bool Editor::KeyUp( Key key, unsigned int text, const std::string& str )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool Editor::MouseMove( int absX, int relX, int absY, int relY)
|
||||
{
|
||||
pGraphics->GetGUI()->MouseMove(absX, relX, absY, relY);
|
||||
return true;
|
||||
}
|
||||
bool Editor::MousePressed(Core::MouseKey key)
|
||||
{
|
||||
pGraphics->GetGUI()->MousePressed(key);
|
||||
return true;
|
||||
}
|
||||
bool Editor::MouseReleased(Core::MouseKey key)
|
||||
{
|
||||
pGraphics->GetGUI()->MouseReleased(key);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#ifndef Editor_h__
|
||||
#define Editor_h__
|
||||
|
||||
#include <LifeEngine.h>
|
||||
#include <RenderWindow.h>
|
||||
#include <vfs/IFileSystem.h>
|
||||
#include <vfs/fs_win/IFSContentProvider.h>
|
||||
#include <FrameCounter.h>
|
||||
#include <gui/GUIPicture.h>
|
||||
#include <InputSystemOIS.h>
|
||||
#include <gui/GUIScroll.h>
|
||||
#include <gui/GUIButton.h>
|
||||
#include "GUINodeContainer.h"
|
||||
#include "GUIShaderNode.h"
|
||||
#include <gui/GUISlider.h>
|
||||
#include <gui/GUIMenu.h>
|
||||
#include <gui/GUIProgress.h>
|
||||
#include <vector>
|
||||
#include <SoundSystem.h>
|
||||
#include <ISound.h>
|
||||
#include "GUINodeList.h"
|
||||
#include <gui/GUIPropertyGrid.h>
|
||||
|
||||
struct NodeInfo
|
||||
{
|
||||
String Name;
|
||||
String ClassName;
|
||||
NodeInfo(const String& name, const String& className)
|
||||
{
|
||||
Name = name;
|
||||
ClassName = className;
|
||||
}
|
||||
};
|
||||
|
||||
class Editor : public IKeyListener
|
||||
{
|
||||
public:
|
||||
Editor();
|
||||
~Editor();
|
||||
void Run();
|
||||
|
||||
bool KeyDown( Key key, unsigned int text, const std::string& str );
|
||||
bool KeyUp( Key key, unsigned int text, const std::string& str );
|
||||
bool MouseMove( int absX, int relX, int absY, int relY);
|
||||
bool MousePressed(Core::MouseKey key);
|
||||
bool MouseReleased(Core::MouseKey key);
|
||||
|
||||
private:
|
||||
void OnCompileShader(GUIWindow* wnd, int p);
|
||||
void OnSaveGraph(GUIWindow* wnd, int p);
|
||||
void OnLoadGraph(GUIWindow* wnd, int p);
|
||||
void OnGraphNodeDelete(GUINodeContainer* container, GUIShaderNode* node);
|
||||
|
||||
std::vector<NodeInfo*> node_info;
|
||||
GUINodeList* node_list;
|
||||
|
||||
IShaderGraph* sg;
|
||||
texture_ptr material_textures[16];
|
||||
GUIShaderNode* AddNode(const String& name);
|
||||
void OnAddNode( GUIWindow* w, const String& s, void* d);
|
||||
void OnResizeOutput(GUIWindow* wnd);
|
||||
void menu_exit(GUIMenuItem* m);
|
||||
GUIProgress* progress;
|
||||
GUISlider* slider;
|
||||
GUIText* time_info;
|
||||
void SwitchPlayback(GUIWindow* wnd, int t);
|
||||
Sound::SoundSystem* sndSystem;
|
||||
Sound::ISound* snd;
|
||||
void AddShaderLink(GUIShaderNodeIO* left, GUIShaderNodeIO* right);
|
||||
void OnButtonClick(GUIWindow* wnd, int key);
|
||||
void OnScroll(GUIScroll* wnd, int key);
|
||||
LifeEngine* pGraphics;
|
||||
RenderWindowWin* pWindow;
|
||||
void DoLogics();
|
||||
void DoRendering();
|
||||
void DoCleanup();
|
||||
void SetTrackPosition(GUIWindow* sender, int args);
|
||||
bool bRunning;
|
||||
Core::IFileSystem* fileSystem;
|
||||
FrameCounter frame_counter;
|
||||
GUIButton* b2;
|
||||
GUIPicture* sceneOutput;
|
||||
GUINodeContainer* nodeContainer;
|
||||
InputSystemOIS* pInput;
|
||||
Video::IObjectMesh* tower;
|
||||
GUIPropertyGrid* propGrid;
|
||||
};
|
||||
#endif // Editor_h__
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef EditorShared_h__
|
||||
#define EditorShared_h__
|
||||
|
||||
#include <Singleton.h>
|
||||
#include <gui/GUIPropertyGrid.h>
|
||||
|
||||
class EditorShared;
|
||||
class EditorShared : public Singleton<EditorShared>
|
||||
{
|
||||
public:
|
||||
GUIPropertyGrid* propGrid;
|
||||
};
|
||||
#endif // EditorShared_h__
|
||||
@@ -0,0 +1,531 @@
|
||||
#include "GUINodeContainer.h"
|
||||
#include <gui/GUIManager.h>
|
||||
#include <math/Spline.h>
|
||||
#include <Property.h>
|
||||
#include <gui/PropertyItemFile.h>
|
||||
#include "GUIShaderNodeTexture.h"
|
||||
#include "EditorShared.h"
|
||||
|
||||
GUINodeContainer::GUINodeContainer(IShaderGraph* graph)
|
||||
:cache_length(0)
|
||||
{
|
||||
graphics_graph = graph;
|
||||
//skip_mouse = true;
|
||||
menu = new GUIMenu(true);
|
||||
}
|
||||
|
||||
GUIShaderNode* GUINodeContainer::FindNodeByGraphicsID(int id)
|
||||
{
|
||||
int node_count = GetNodeCount();
|
||||
for(int i = 0; i < node_count; i++){
|
||||
GUIShaderNode* node = nodes[i];
|
||||
if(node->GetGraphicsNode()->id == id)
|
||||
return node;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
bool GUINodeContainer::Serialize(Core::IMemoryStream* stm)
|
||||
{
|
||||
int node_count = GetNodeCount();
|
||||
stm->Write(node_count);
|
||||
|
||||
for(int i = 0; i < node_count; i++){
|
||||
GUIShaderNode* node = nodes[i];
|
||||
stm->Write(node->GetGraphicsNode()->id);
|
||||
stm->Write(node->GetPosition().X);
|
||||
stm->Write(node->GetPosition().Y);
|
||||
stm->Write(node->GetWidth());
|
||||
stm->Write(node->GetHeight());
|
||||
StringSerialize(node->GetCaption(), stm);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool GUINodeContainer::Deserialize(Core::IMemoryStream* stm)
|
||||
{
|
||||
int node_count;
|
||||
stm->ReadInt32(node_count);
|
||||
|
||||
for(int i = 0; i < node_count; i++){
|
||||
int graphics_id;
|
||||
int pos_x, pos_y;
|
||||
int node_width, node_height;
|
||||
String caption;
|
||||
GUIShaderNode* node;
|
||||
|
||||
stm->ReadInt32(graphics_id);
|
||||
stm->ReadInt32(pos_x);
|
||||
stm->ReadInt32(pos_y);
|
||||
stm->ReadInt32(node_width);
|
||||
stm->ReadInt32(node_height);
|
||||
caption = StringDeserialize(stm);
|
||||
|
||||
node = FindNodeByGraphicsID(graphics_id);
|
||||
|
||||
if(node != nullptr){
|
||||
node->SetPosition(Vec2i(pos_x, pos_y));
|
||||
node->SetWidth(node_width);
|
||||
node->SetHeight(node_height);
|
||||
node->SetCaption(caption);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void GUINodeContainer::MakeLink(GUIShaderNodeIO* left, GUIShaderNodeIO* right)
|
||||
{
|
||||
LinkInfo info;
|
||||
info.left = left;
|
||||
info.right = right;
|
||||
links.push_back(info);
|
||||
Invalidate();
|
||||
}
|
||||
void GUINodeContainer::BreakLink(GUIShaderNodeIO* left, GUIShaderNodeIO* right)
|
||||
{
|
||||
for(LinksCollectionItr it = links.begin(); it != links.end(); ++it)
|
||||
{
|
||||
LinkInfo info = *it;
|
||||
if((info.left == left && info.right == right) ||
|
||||
(info.left == right && info.right == left))
|
||||
{
|
||||
links.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GUINodeContainer::OnNodeSelect(GUIShaderNode* node)
|
||||
{
|
||||
EditorShared::me()->propGrid->SetTarget(node);
|
||||
}
|
||||
NodeCollection* GUINodeContainer::GetTextureUnits()
|
||||
{
|
||||
return &texNodes;
|
||||
}
|
||||
void GUINodeContainer::SetSelection(GUIShaderNode* node)
|
||||
{
|
||||
selection = node;
|
||||
}
|
||||
void GUINodeContainer::OnNodeHeaderMouseClick(GUIWindow* wnd, int param)
|
||||
{
|
||||
if(param == KEY_MOUSE_RIGHT)
|
||||
{
|
||||
this->SetSelection((GUIShaderNode*)wnd);
|
||||
menu->RemoveItems();
|
||||
menu->AddItem(STR("Delete node"), false)->Event_Select += NewDelegate(this, &GUINodeContainer::OnDeleteNode);
|
||||
menu->SetPosition(FindOverlay()->cursorPos);
|
||||
|
||||
|
||||
FindOverlay()->AddChild(menu);
|
||||
FindOverlay()->SetFocusWindow(menu);
|
||||
}
|
||||
}
|
||||
|
||||
void GUINodeContainer::OnDeleteNode(GUIMenuItem* itm)
|
||||
{
|
||||
DeleteNode(selection);
|
||||
}
|
||||
void GUINodeContainer::DeleteNode(GUIShaderNode* node)
|
||||
{
|
||||
Event_DeleteNode.Invoke(this, node);
|
||||
this->RemoveChild(node->hwnd);
|
||||
graphics_graph->DeleteNode(node->GetGraphicsNode()->id);
|
||||
|
||||
|
||||
restart_delete_links:
|
||||
for(LinksCollectionItr it = links.begin(); it != links.end(); ++it)
|
||||
{
|
||||
if((*it).left->Owner == node || (*it).right->Owner == node)
|
||||
{
|
||||
links.erase(it);
|
||||
goto restart_delete_links;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(NodeCollectionItr it = nodes.begin(); it != nodes.end(); it++)
|
||||
{
|
||||
if((*it)->ID == node->ID)
|
||||
{
|
||||
nodes.erase(it);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
done:
|
||||
delete node;
|
||||
Invalidate();
|
||||
}
|
||||
void GUINodeContainer::RegisterNewNode(GUIShaderNode* node)
|
||||
{
|
||||
nodes.push_back(node);
|
||||
node->Event_HeaderClick += NewDelegate(this, &GUINodeContainer::OnNodeHeaderMouseClick);
|
||||
}
|
||||
void GUINodeContainer::RebuildGraph()
|
||||
{
|
||||
//remove all nodes firstly
|
||||
for(NodeCollectionItr it = nodes.begin(); it != nodes.end(); it++)
|
||||
{
|
||||
//Event_DeleteNode.Invoke(this, node);
|
||||
this->RemoveChild((*it)->hwnd);
|
||||
delete (*it);
|
||||
}
|
||||
nodes.clear();
|
||||
|
||||
links.clear();
|
||||
|
||||
|
||||
int cnt = graphics_graph->GetNodeCount();
|
||||
|
||||
//build nodes
|
||||
for(int k = 0; k < cnt; k++)
|
||||
{
|
||||
IShaderGraphNode* gn = graphics_graph->GetNodeByArrayID(k);
|
||||
GUIShaderNode* node;
|
||||
|
||||
if(gn->Name == STR("SrcTex2D")){
|
||||
node = new GUIShaderNodeTexture(gn);
|
||||
texNodes.push_back(node);
|
||||
}
|
||||
else
|
||||
node = new GUIShaderNode(gn);
|
||||
|
||||
//copy all properties =)
|
||||
PropertyCollection* props = gn->GetProperties();
|
||||
for(int i = 0; i < props->size(); i++)
|
||||
{
|
||||
IProperty* prop = (*props)[i];
|
||||
prop->Event_ValueChanged.Invoke();
|
||||
node->RegisterProperty(prop);
|
||||
}
|
||||
|
||||
node->Event_Select += NewDelegate(this, &GUINodeContainer::OnNodeSelect);
|
||||
|
||||
node->SetCaption(gn->Name);
|
||||
int in_count = gn->Inputs.size();
|
||||
int out_count = gn->Outputs.size();
|
||||
|
||||
//create input ports
|
||||
for(int i = 0; i < in_count; i++)
|
||||
{
|
||||
IShaderGraphNodePort* port = gn->Inputs[i];
|
||||
GUIShaderNodeIO* io = new GUIShaderNodeIO(node);
|
||||
io->SetCaption(port->Name);
|
||||
node->AddInput(io);
|
||||
io->GraphicsPort = port;
|
||||
io->Event_PortClick += NewDelegate(this, &GUINodeContainer::OnNodePortMouseClick);
|
||||
}
|
||||
|
||||
//create output ports
|
||||
for(int i = 0; i < out_count; i++)
|
||||
{
|
||||
IShaderGraphNodePort* port = gn->Outputs[i];
|
||||
GUIShaderNodeIO* io = new GUIShaderNodeIO(node);
|
||||
io->SetCaption(port->Name);
|
||||
io->GraphicsPort = port;
|
||||
io->Event_PortClick += NewDelegate(this, &GUINodeContainer::OnNodePortMouseClick);
|
||||
node->AddOutput(io);
|
||||
}
|
||||
|
||||
if(name == STR("Material"))
|
||||
{
|
||||
materialNode = node;
|
||||
}
|
||||
AddChild(node);
|
||||
RegisterNewNode(node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//build links
|
||||
cnt = nodes.size();
|
||||
for(int k = 0; k < cnt; k++)
|
||||
{
|
||||
GUIShaderNode* node = nodes[k];
|
||||
IShaderGraphNode* n = node->GetGraphicsNode();
|
||||
int inc = n->Inputs.size();
|
||||
|
||||
for(int c = 0; c < inc; c++)
|
||||
{
|
||||
//make link
|
||||
if(n->Inputs[c]->GetLinkCount())
|
||||
{
|
||||
IShaderGraphNodePort* right_port = n->Inputs[c]->GetLink(0);
|
||||
//get right node
|
||||
GUIShaderNode* rn = this->FindNode(right_port->Parent->id);
|
||||
|
||||
int roc = rn->GetOutputCount();
|
||||
|
||||
int rightId = -1;
|
||||
for(int m = 0; m < roc; m++)
|
||||
{
|
||||
if(rn->GetGraphicsNode()->GetOutputPortByID(m) == right_port)
|
||||
{
|
||||
rightId = m;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//found right side link - make it!
|
||||
if(rightId >=0)
|
||||
{
|
||||
MakeLink(node->GetInput(c), rn->GetOutput(rightId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String GUINodeContainer::GetTexNameByID(int id)
|
||||
{
|
||||
int cnt = nodes.size();
|
||||
for(int i = 0; i < cnt; i++)
|
||||
{
|
||||
if(nodes[i]->GetGraphicsNode()->id == id)
|
||||
{
|
||||
GUIShaderNodeTexture* tn = (GUIShaderNodeTexture*)nodes[i];
|
||||
return tn->GetFilename();
|
||||
}
|
||||
}
|
||||
return "TexNotFound";
|
||||
}
|
||||
GUIShaderNode* GUINodeContainer::FindNode(int id)
|
||||
{
|
||||
int cnt = nodes.size();
|
||||
for(int k = 0; k < cnt; k++)
|
||||
{
|
||||
GUIShaderNode* node = nodes[k];
|
||||
if(node->GetGraphicsNode()->id == id)
|
||||
return node;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
GUIShaderNode* GUINodeContainer::AddNode(const String& name)
|
||||
{
|
||||
IShaderGraphNode* gn = graphics_graph->AddNode(name);
|
||||
GUIShaderNode* node;
|
||||
|
||||
if(name == STR("SrcTex2D"))
|
||||
{
|
||||
node = new GUIShaderNodeTexture(gn);
|
||||
texNodes.push_back(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = new GUIShaderNode(gn);
|
||||
}
|
||||
|
||||
//copy all properties =)
|
||||
PropertyCollection* props = gn->GetProperties();
|
||||
for(int i = 0; i < props->size(); i++)
|
||||
{
|
||||
IProperty* prop = (*props)[i];
|
||||
node->RegisterProperty(prop);
|
||||
}
|
||||
|
||||
node->Event_Select += NewDelegate(this, &GUINodeContainer::OnNodeSelect);
|
||||
|
||||
int in_count = gn->Inputs.size();
|
||||
int out_count = gn->Outputs.size();
|
||||
|
||||
//create input ports
|
||||
for(int i = 0; i < in_count; i++)
|
||||
{
|
||||
IShaderGraphNodePort* port = gn->Inputs[i];
|
||||
GUIShaderNodeIO* io = new GUIShaderNodeIO(node);
|
||||
io->SetCaption(port->Name);
|
||||
node->AddInput(io);
|
||||
io->GraphicsPort = port;
|
||||
io->Event_PortClick += NewDelegate(this, &GUINodeContainer::OnNodePortMouseClick);
|
||||
}
|
||||
|
||||
//create output ports
|
||||
for(int i = 0; i < out_count; i++)
|
||||
{
|
||||
IShaderGraphNodePort* port = gn->Outputs[i];
|
||||
GUIShaderNodeIO* io = new GUIShaderNodeIO(node);
|
||||
io->SetCaption(port->Name);
|
||||
node->AddOutput(io);
|
||||
io->GraphicsPort = port;
|
||||
io->Event_PortClick += NewDelegate(this, &GUINodeContainer::OnNodePortMouseClick);
|
||||
}
|
||||
|
||||
if(name == STR("Material"))
|
||||
{
|
||||
materialNode = node;
|
||||
}
|
||||
AddChild(node);
|
||||
RegisterNewNode(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
void GUINodeContainer::OnDeleteLink(GUIMenuItem* itm)
|
||||
{
|
||||
selected_port->GraphicsPort->BreakLink();
|
||||
|
||||
restart_delete_links:
|
||||
for(LinksCollectionItr it = links.begin(); it != links.end(); ++it)
|
||||
{
|
||||
if((*it).left == selected_port || (*it).right == selected_port)
|
||||
{
|
||||
links.erase(it);
|
||||
goto restart_delete_links;
|
||||
}
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
void GUINodeContainer::OnNodePortMouseClick(GUIWindow* wnd, int param)
|
||||
{
|
||||
//right click on node IO port
|
||||
if(param == KEY_MOUSE_RIGHT)
|
||||
{
|
||||
menu->RemoveItems();
|
||||
selected_port = (GUIShaderNodeIO*)wnd;
|
||||
menu->AddItem("Delete links", false)->Event_Select += NewDelegate(this, &GUINodeContainer::OnDeleteLink);
|
||||
menu->SetPosition(FindOverlay()->cursorPos);
|
||||
FindOverlay()->AddChild(menu);
|
||||
FindOverlay()->SetFocusWindow(menu);
|
||||
}
|
||||
}
|
||||
void GUINodeContainer::OnNodeLayoutUpdate()
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
GUINodeContainer::~GUINodeContainer()
|
||||
{
|
||||
}
|
||||
void GUINodeContainer::SetBackColor(const Vec4f& color)
|
||||
{
|
||||
}
|
||||
void GUINodeContainer::GenGeom()
|
||||
{
|
||||
cache_length = 0;
|
||||
|
||||
int lc = links.size();
|
||||
|
||||
for(int i = 0; i < lc; i++)
|
||||
{
|
||||
LinkInfo info = links[i];
|
||||
Vec2i p1 = info.left->GetAttachPoint();
|
||||
Vec2i p2;
|
||||
Vec2i p3;
|
||||
Vec2i p4 = info.right->GetAttachPoint();
|
||||
|
||||
//if input - shift to right
|
||||
if(info.left->IsInput())
|
||||
{
|
||||
p2 = p1 + Vec2i(50, 0);
|
||||
p3 = p4 + Vec2i(-50, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = p1 + Vec2i(-50, 0);
|
||||
p3 = p4 + Vec2i(50, 0);
|
||||
}
|
||||
|
||||
GUIVertex points[4];
|
||||
points[0].Color = Vec4f(1,1,1,1);
|
||||
points[1].Color = Vec4f(1,1,1,1);
|
||||
points[2].Color = Vec4f(1,1,1,1);
|
||||
points[3].Color = Vec4f(1,1,1,1);
|
||||
|
||||
points[0].Position = Vec3f((float)p1.X, (float)p1.Y, 0);
|
||||
points[1].Position = Vec3f((float)p2.X, (float)p2.Y, 0);
|
||||
points[2].Position = Vec3f((float)p3.X, (float)p3.Y, 0);
|
||||
points[3].Position = Vec3f((float)p4.X, (float)p4.Y, 0);
|
||||
|
||||
//we have 4 points! now we have to convert them to cubic spline
|
||||
int offset = 0;
|
||||
GUIVertex prev;
|
||||
prev = points[0];
|
||||
for(int i = 1; i <= SPLINE_FREQ; i++)
|
||||
{
|
||||
GUIVertex newP = Core::CubicBezier<GUIVertex>((1.0f / (float)SPLINE_FREQ) * (float)i, points[0], points[1], points[2], points[3]);
|
||||
cache[offset++] = prev;
|
||||
cache[offset++] = newP;
|
||||
|
||||
prev = newP;
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
|
||||
Rect2i sc = GetScissor();
|
||||
|
||||
GUIVertex tmp;
|
||||
//all spline points generated! Now it's time to cut them by owner's client rectangle
|
||||
for(int i = 0; i < SPLINE_FREQ; i++)
|
||||
{
|
||||
GUIVertex v1 = cache[i * 2];
|
||||
GUIVertex v2 = cache[i * 2 + 1];
|
||||
|
||||
//test is vertices are visible
|
||||
if(v1.Position.X < sc.x && v2.Position.X < sc.x) continue;
|
||||
if(v1.Position.X > sc.GetMaxX() && v2.Position.X > sc.GetMaxX()) continue;
|
||||
if(v1.Position.Y < sc.y && v2.Position.Y < sc.y) continue;
|
||||
if(v1.Position.Y > sc.GetMaxY() && v2.Position.Y > sc.GetMaxY()) continue;
|
||||
|
||||
//sort vertices
|
||||
if(v1.Position.X > v2.Position.X)
|
||||
{
|
||||
tmp = v1;
|
||||
v1 = v2;
|
||||
v2 = tmp;
|
||||
}
|
||||
//crop right side
|
||||
if(v2.Position.X > sc.GetMaxX())
|
||||
{
|
||||
float slope = (v2.Position.Y - v1.Position.Y) / (v2.Position.X - v1.Position.X);
|
||||
float xd = v2.Position.X - float(sc.GetMaxX());
|
||||
v2.Position.X -= xd;
|
||||
v2.Position.Y -= xd * slope;
|
||||
}
|
||||
//crop left side
|
||||
if(v1.Position.X < sc.x)
|
||||
{
|
||||
float slope = (v2.Position.Y - v1.Position.Y) / (v2.Position.X - v1.Position.X);
|
||||
float xd = sc.x - v1.Position.X;
|
||||
v1.Position.X += xd;
|
||||
v1.Position.Y += xd * slope;
|
||||
}
|
||||
|
||||
//sort vertices
|
||||
if(v1.Position.Y > v2.Position.Y)
|
||||
{
|
||||
tmp = v1;
|
||||
v1 = v2;
|
||||
v2 = tmp;
|
||||
}
|
||||
//crop bottom side
|
||||
if(v2.Position.Y > sc.GetMaxY())
|
||||
{
|
||||
float slope = (v2.Position.X - v1.Position.X) / (v2.Position.Y - v1.Position.Y);
|
||||
float yd = v2.Position.Y - float(sc.GetMaxY());
|
||||
v2.Position.X -= yd * slope;
|
||||
v2.Position.Y -= yd;
|
||||
}
|
||||
//crop top side
|
||||
if(v1.Position.Y < sc.y)
|
||||
{
|
||||
float slope = (v2.Position.X - v1.Position.X) / (v2.Position.Y - v1.Position.Y);
|
||||
float yd = sc.y - v1.Position.Y;
|
||||
v1.Position.X += yd * slope;
|
||||
v1.Position.Y += yd;
|
||||
}
|
||||
|
||||
cache2[cache_length++] = v1;
|
||||
cache2[cache_length++] = v2;
|
||||
}
|
||||
}
|
||||
invalid = false;
|
||||
}
|
||||
void GUINodeContainer::RenderSelf()
|
||||
{
|
||||
if(invalid)
|
||||
GenGeom();
|
||||
|
||||
if(cache_length)
|
||||
{
|
||||
Video::IGUIRenderer* renderer = GUIManager::me()->GetRenderer();
|
||||
renderer->SetTexture(GUIManager::me()->DIFF, 0, true);
|
||||
renderer->Write(&cache2[0], cache_length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
#ifndef GUINodeContainer_h__
|
||||
#define GUINodeContainer_h__
|
||||
|
||||
#include <gui/GUIWindow.h>
|
||||
#include <gui/GUIManager.h>
|
||||
#include <gui/GUIMenu.h>
|
||||
#include "GUIShaderNode.h"
|
||||
#include "GUIShaderNodeTexture.h"
|
||||
#include <shaders/IShaderGraph.h>
|
||||
#include <vector>
|
||||
#include <ISerializable.h>
|
||||
#include <delegate/Delegate.h>
|
||||
|
||||
struct LinkInfo
|
||||
{
|
||||
GUIShaderNodeIO* left;
|
||||
GUIShaderNodeIO* right;
|
||||
};
|
||||
|
||||
#define SPLINE_FREQ 20
|
||||
typedef std::vector<GUIShaderNode*> NodeCollection;
|
||||
typedef std::vector<GUIShaderNode*>::iterator NodeCollectionItr;
|
||||
|
||||
class GUINodeContainer : public GUIWindow, public ISerializable
|
||||
{
|
||||
public:
|
||||
EVENT2(GUINodeContainer_NodeEvent, GUINodeContainer*, GUIShaderNode*);
|
||||
GUINodeContainer_NodeEvent Event_DeleteNode;
|
||||
|
||||
GUINodeContainer(IShaderGraph* graph);
|
||||
~GUINodeContainer();
|
||||
bool Serialize(Core::IMemoryStream* stm);
|
||||
bool Deserialize(Core::IMemoryStream* stm);
|
||||
|
||||
//void AddChild(GUIWindow* val);
|
||||
void MakeLink(GUIShaderNodeIO* left, GUIShaderNodeIO* right);
|
||||
void BreakLink(GUIShaderNodeIO* left, GUIShaderNodeIO* right);
|
||||
|
||||
void SetBackColor(const Vec4f& color);
|
||||
void RenderSelf();
|
||||
GUIShaderNode* FindNode(int id);
|
||||
GUIShaderNode* AddNode(const String& name);
|
||||
void Invalidate()
|
||||
{
|
||||
GUIWindow::Invalidate();
|
||||
invalid = true;
|
||||
}
|
||||
GUIShaderNode* GetMaterialNode()
|
||||
{
|
||||
return materialNode;
|
||||
}
|
||||
NodeCollection* GetTextureUnits();
|
||||
void RebuildGraph();
|
||||
size_t GetNodeCount()
|
||||
{
|
||||
return nodes.size();
|
||||
}
|
||||
GUIShaderNode* getNode(int id)
|
||||
{
|
||||
return nodes[id];
|
||||
}
|
||||
String GetTexNameByID(int id);
|
||||
private:
|
||||
void OnNodeSelect(GUIShaderNode* node);
|
||||
void GenGeom();
|
||||
void OnNodeLayoutUpdate();
|
||||
void SetSelection(GUIShaderNode* node);
|
||||
void DeleteNode(GUIShaderNode* node);
|
||||
void OnNodeHeaderMouseClick(GUIWindow* wnd, int param);
|
||||
void OnNodePortMouseClick(GUIWindow* wnd, int param);
|
||||
|
||||
|
||||
void OnDeleteLink(GUIMenuItem* itm);
|
||||
|
||||
void OnDeleteNode(GUIMenuItem* itm);
|
||||
|
||||
void RegisterNewNode(GUIShaderNode* node);
|
||||
|
||||
GUIShaderNode* FindNodeByGraphicsID(int id);
|
||||
GUIShaderNode* selection;
|
||||
GUIShaderNodeIO* selected_port;
|
||||
GUIMenu* menu;
|
||||
NodeCollection nodes;
|
||||
NodeCollection texNodes;
|
||||
GUIShaderNode* materialNode;
|
||||
bool invalid;
|
||||
IShaderGraph* graphics_graph;
|
||||
typedef std::vector<LinkInfo> LinksCollection;
|
||||
typedef std::vector<LinkInfo>::iterator LinksCollectionItr;
|
||||
LinksCollection links;
|
||||
int cache_length;
|
||||
GUIVertex cache[SPLINE_FREQ * 2];
|
||||
GUIVertex cache2[SPLINE_FREQ * 2 * 128]; //128 splines cache
|
||||
};
|
||||
#endif // GUINodeContainer_h__
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef GUINodeList_h__
|
||||
#define GUINodeList_h__
|
||||
|
||||
#include <gui/GUIPlane.h>
|
||||
#include <gui/GUIButton.h>
|
||||
#include <gui/GUIList.h>
|
||||
|
||||
class GUINodeList : public GUIList
|
||||
{
|
||||
};
|
||||
#endif // GUINodeList_h__
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "GUINodePort.h"
|
||||
#include <gui/GUIOverlay.h>
|
||||
|
||||
GUINodePort::GUINodePort()
|
||||
:input_mode(false)
|
||||
{
|
||||
allowDrop = true;
|
||||
allowDrag = true;
|
||||
can_drag = false;
|
||||
}
|
||||
GUINodePort::~GUINodePort()
|
||||
{
|
||||
}
|
||||
void GUINodePort::FinishDrag()
|
||||
{
|
||||
}
|
||||
bool GUINodePort::DragEnter(DragInfo* info)
|
||||
{
|
||||
if(this->input_mode == true && info->Name == STR("Shader_Output"))
|
||||
return true;
|
||||
if(this->input_mode == false && info->Name == STR("Shader_Input"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
void GUINodePort::AcceptDrop(DragInfo* info)
|
||||
{
|
||||
Event_Link.Invoke(this, reinterpret_cast<GUINodePort*>(info->data));
|
||||
}
|
||||
void GUINodePort::OnMouseMove(int abs_x, int abs_y, int rel_x, int rel_y)
|
||||
{
|
||||
if(can_drag)
|
||||
{
|
||||
can_drag = false;
|
||||
if(input_mode)
|
||||
info.Name = STR("Shader_Input");
|
||||
else
|
||||
info.Name = STR("Shader_Output");
|
||||
|
||||
info.data = this;
|
||||
FindOverlay()->BeginDrag(this, &info);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIPlane::OnMouseMove(abs_x, abs_y, rel_x, rel_y);
|
||||
}
|
||||
}
|
||||
|
||||
void GUINodePort::OnMousePress(int x, int y, int key)
|
||||
{
|
||||
can_drag = true;
|
||||
GUIPlane::OnMousePress(x, y, key);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef GUINodePort_h__
|
||||
#define GUINodePort_h__
|
||||
|
||||
#include <gui/GUIPlane.h>
|
||||
|
||||
class GUINodePort : public Video::GUIPlane
|
||||
{
|
||||
public:
|
||||
EVENT2(PortEvent, GUINodePort*, GUINodePort*);
|
||||
PortEvent Event_Link;
|
||||
GUINodePort();
|
||||
~GUINodePort();
|
||||
void FinishDrag();
|
||||
bool DragEnter(DragInfo* info);
|
||||
void AcceptDrop(DragInfo* info);
|
||||
void OnMouseMove(int abs_x, int abs_y, int rel_x, int rel_y);
|
||||
void OnMousePress(int x, int y, int key);
|
||||
void SetMode(bool isInput)
|
||||
{
|
||||
input_mode = isInput;
|
||||
}
|
||||
void* user_data;
|
||||
private:
|
||||
|
||||
bool input_mode;
|
||||
bool can_drag;
|
||||
DragInfo info;
|
||||
};
|
||||
#endif // GUINodePort_h__
|
||||
@@ -0,0 +1,318 @@
|
||||
#include "GUIShaderNode.h"
|
||||
|
||||
GUIShaderNode::GUIShaderNode(IShaderGraphNode* src)
|
||||
:resizing(false), moving(false), GraphicsNode(src)
|
||||
{
|
||||
skip_mouse = true;
|
||||
size_min = Vec2i(100, 50);
|
||||
size_max = Vec2i(250, 250);
|
||||
|
||||
header = new GUIPlane();
|
||||
header->SetPosition(Vec2i(0, 0));
|
||||
header->SetWidth(120);
|
||||
header->SetHeight(25);
|
||||
header->SetBackColor(Vec4f(0.16f,0.16f,0.16f,1));
|
||||
header->SetBorderColor(Vec4f(0.016f,0.016f,0.016f,1));
|
||||
|
||||
body = new GUIPlane();
|
||||
body->SetPosition(Vec2i(0, 25));
|
||||
body->SetWidth(120);
|
||||
body->SetHeight(120);
|
||||
body->SetBackColor(Vec4f(0.25f,0.0f,0.0f,1));
|
||||
body->SetBorderColor(Vec4f(0.016f,0.016f,0.016f,1));
|
||||
|
||||
display = new GUIPicture();
|
||||
body->AddChild(display);
|
||||
display->SetPosition(Vec2i(2,2));
|
||||
back = new GUIPlane();
|
||||
back->SetPosition(Vec2i(0, 0));
|
||||
back->SetWidth(width);
|
||||
back->SetHeight(height);
|
||||
back->SetBackColor(Vec4f(0.9f,0.25f,0.25f,1));
|
||||
back->SetBorderColor(Vec4f(0.9f,0.016f,0.016f,1));
|
||||
|
||||
mover = new GUIPlane();
|
||||
mover->SetPosition(Vec2i(115, 140));
|
||||
mover->SetWidth(10);
|
||||
mover->SetHeight(10);
|
||||
mover->SetBackColor(Vec4f(0.75f,0.75f,0.75f,0.5f));
|
||||
mover->SetBorderColor(Vec4f(0.016f,0.016f,0.016f,1));
|
||||
mover->cursor = STR("Size_d1");
|
||||
|
||||
header_text = new GUIText();
|
||||
header->AddChild(header_text);
|
||||
header_text->SetDock(Video::DOCK_FILL);
|
||||
header_text->SetHAlign(HA_CENTER);
|
||||
header_text->SetVAlign(VA_CENTER);
|
||||
header_text->SetText("Invert (1-x)");
|
||||
header_text->SetBackColor(Vec4f(0.0f,0.0f,0.0f,0.0f));
|
||||
header_text->SetForeColor(Vec4f(0.8f,0.8f,0.8f,1.0f));
|
||||
header_text->mouseEnabled = false;
|
||||
|
||||
mover->Event_MouseDown += NewDelegate(this, &GUIShaderNode::OnBeginResize);
|
||||
mover->Event_MouseUp += NewDelegate(this, &GUIShaderNode::OnEndResize);
|
||||
mover->Event_MouseMove += NewDelegate(this, &GUIShaderNode::OnDoResize);
|
||||
|
||||
header->Event_MouseDown += NewDelegate(this, &GUIShaderNode::OnHeaderMouseDown);
|
||||
header->Event_MouseUp += NewDelegate(this, &GUIShaderNode::OnHeaderMouseUp);
|
||||
header->Event_MouseMove += NewDelegate(this, &GUIShaderNode::OnHeaderMouseMove);
|
||||
header->Event_MouseClick += NewDelegate(this, &GUIShaderNode::OnHeaderMouseClick);
|
||||
|
||||
menu = new GUIMenu(true);
|
||||
menu->AddItem("Delete node", false);
|
||||
|
||||
//AddChild(back);
|
||||
AddChild(body);
|
||||
AddChild(mover);
|
||||
AddChild(header);
|
||||
}
|
||||
void GUIShaderNode::OnHeaderRightClick(GUIWindow* wnd, int param)
|
||||
{
|
||||
printf("Right click on header!\n");
|
||||
}
|
||||
|
||||
void GUIShaderNode::OnHeaderMouseClick(GUIWindow* wnd, int param)
|
||||
{
|
||||
Event_HeaderClick.Invoke(this, param);
|
||||
}
|
||||
void GUIShaderNode::SetDisplayImage(texture_ptr tex)
|
||||
{
|
||||
displayImage = tex;
|
||||
display->SetPicture(CImage::FromTexture(displayImage.ptr()));
|
||||
}
|
||||
void GUIShaderNode::SetCaption(const String& text)
|
||||
{
|
||||
header_text->SetText(text);
|
||||
}
|
||||
const String& GUIShaderNode::GetCaption()
|
||||
{
|
||||
return header_text->GetText();
|
||||
}
|
||||
GUIShaderNode::~GUIShaderNode()
|
||||
{
|
||||
}
|
||||
void GUIShaderNode::OnBeginResize(GUIWindow* wnd, int param)
|
||||
{
|
||||
resizing = true;
|
||||
FindOverlay()->GrabMouse(wnd);
|
||||
size_pos = body->GetRectangleAbs().GetMax() - FindOverlay()->cursorPos;
|
||||
}
|
||||
void GUIShaderNode::OnDoResize(GUIWindow* wnd, int param)
|
||||
{
|
||||
if(resizing)
|
||||
{
|
||||
Vec2i newPos = FindOverlay()->cursorPos + size_pos;
|
||||
Vec2i diff = newPos - body->GetRectangleAbs().GetMin();
|
||||
|
||||
if(diff.X < size_min.X)
|
||||
diff.X = size_min.X;
|
||||
if(diff.Y < size_min.Y)
|
||||
diff.Y = size_min.Y;
|
||||
|
||||
if(diff.X > size_max.X)
|
||||
diff.X = size_max.X;
|
||||
if(diff.Y > size_max.Y)
|
||||
diff.Y = size_max.Y;
|
||||
|
||||
body->SetWidth(diff.X);
|
||||
body->SetHeight(diff.Y);
|
||||
header->SetWidth(diff.X);
|
||||
|
||||
display->SetWidth(body->GetClientRectangle().width - 4);
|
||||
display->SetHeight(body->GetClientRectangle().height - 4);
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
void GUIShaderNode::OnEndResize(GUIWindow* wnd, int param)
|
||||
{
|
||||
resizing = false;
|
||||
FindOverlay()->ReleaseMouse();
|
||||
}
|
||||
|
||||
void GUIShaderNode::OnHeaderMouseDown(GUIWindow* wnd, int param)
|
||||
{
|
||||
if(param == KEY_MOUSE_LEFT)
|
||||
{
|
||||
OnSelect();
|
||||
moving = true;
|
||||
FindOverlay()->GrabMouse(wnd);
|
||||
size_pos = this->GetRectangleAbs().GetMin() - FindOverlay()->cursorPos;
|
||||
}
|
||||
|
||||
}
|
||||
void GUIShaderNode::OnHeaderMouseMove(GUIWindow* wnd, int param)
|
||||
{
|
||||
if(moving)
|
||||
{
|
||||
Vec2i new_pos = parent->CursorToLocal(FindOverlay()->cursorPos + size_pos);
|
||||
this->SetPosition(new_pos);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
void GUIShaderNode::OnHeaderMouseUp(GUIWindow* wnd, int param)
|
||||
{
|
||||
if(param == KEY_MOUSE_LEFT)
|
||||
{
|
||||
FindOverlay()->ReleaseMouse();
|
||||
moving = false;
|
||||
}
|
||||
}
|
||||
void GUIShaderNode::ProcessLink(GUIShaderNodeIO* my, GUIShaderNodeIO* other)
|
||||
{
|
||||
if(my->Owner != other->Owner)
|
||||
{
|
||||
Event_Attach.Invoke(my, other);
|
||||
}
|
||||
}
|
||||
void GUIShaderNode::FormatInputs()
|
||||
{
|
||||
int cnt = inputs.size();
|
||||
int spacing = 5;
|
||||
|
||||
if(!cnt) return;
|
||||
|
||||
int totalSize = spacing * (cnt - 1) + inputs[0]->GetHeight() * cnt;
|
||||
|
||||
int step = totalSize / cnt;
|
||||
|
||||
int h = body->GetHeight();
|
||||
int start = (h - totalSize) / 2 + body->GetPosition().Y;
|
||||
|
||||
for(int i = 0; i < cnt; i++)
|
||||
{
|
||||
Vec2i pos = inputs[i]->GetPosition();
|
||||
int newX = body->GetRectangle().GetMaxX();
|
||||
if(pos.X != newX)
|
||||
Invalidate();
|
||||
pos.X = newX;
|
||||
|
||||
pos.Y = start + (step * i);
|
||||
inputs[i]->SetPosition(pos);
|
||||
}
|
||||
}
|
||||
void GUIShaderNode::FormatOutputs()
|
||||
{
|
||||
int cnt = outputs.size();
|
||||
int spacing = 5;
|
||||
|
||||
if(!cnt) return;
|
||||
|
||||
int totalSize = spacing * (cnt - 1) + outputs[0]->GetHeight() * cnt;
|
||||
|
||||
int step = totalSize / cnt;
|
||||
|
||||
int h = body->GetHeight();
|
||||
int start = (h - totalSize) / 2 + body->GetPosition().Y;
|
||||
|
||||
for(int i = 0; i < cnt; i++)
|
||||
{
|
||||
Vec2i pos = outputs[i]->GetPosition();
|
||||
int newX = body->GetPosition().X - outputs[i]->GetWidth();
|
||||
if(pos.X != newX)
|
||||
Invalidate();
|
||||
pos.X = newX;
|
||||
pos.Y = start + (step * i);
|
||||
outputs[i]->SetPosition(pos);
|
||||
}
|
||||
}
|
||||
void GUIShaderNode::AddInput(GUIShaderNodeIO* node)
|
||||
{
|
||||
node->SetMode(true);
|
||||
node->Event_Link += NewDelegate(this, &GUIShaderNode::ProcessLink);
|
||||
node->Event_Resize += NewDelegate(this, &GUIShaderNode::OnIOResize);
|
||||
node->id = inputs.size();
|
||||
inputs.push_back(node);
|
||||
node->Owner = this;
|
||||
AddChild(node);
|
||||
FormatInputs();
|
||||
}
|
||||
void GUIShaderNode::OnIOResize(GUIWindow* wnd)
|
||||
{
|
||||
this->Invalidate();
|
||||
}
|
||||
void GUIShaderNode::AddOutput(GUIShaderNodeIO* node)
|
||||
{
|
||||
node->SetMode(false);
|
||||
node->Event_Link += NewDelegate(this, &GUIShaderNode::ProcessLink);
|
||||
node->Event_Resize += NewDelegate(this, &GUIShaderNode::OnIOResize);
|
||||
AddChild(node);
|
||||
node->Owner = this;
|
||||
node->id = outputs.size();
|
||||
outputs.push_back(node);
|
||||
FormatOutputs();
|
||||
}
|
||||
size_t GUIShaderNode::GetInputCount()
|
||||
{
|
||||
return inputs.size();
|
||||
}
|
||||
size_t GUIShaderNode::GetOutputCount()
|
||||
{
|
||||
return outputs.size();
|
||||
}
|
||||
GUIShaderNodeIO* GUIShaderNode::GetInput(int id)
|
||||
{
|
||||
return inputs[id];
|
||||
}
|
||||
GUIShaderNodeIO* GUIShaderNode::GetOutput(int id)
|
||||
{
|
||||
return outputs[id];
|
||||
}
|
||||
|
||||
|
||||
void GUIShaderNode::OnSelect()
|
||||
{
|
||||
Event_Select.Invoke(this);
|
||||
}
|
||||
void GUIShaderNode::RenderSelf()
|
||||
{
|
||||
if(invalid)
|
||||
{
|
||||
LifeMath::Rect2i tr = childs[0]->GetRectangle();
|
||||
|
||||
//find all childs bounding rectangle
|
||||
for(WindowList::iterator it = childs.begin(); it!= childs.end(); ++it)
|
||||
{
|
||||
GUIWindow* w = (*it);
|
||||
tr.Merge(w->GetRectangle());
|
||||
}
|
||||
|
||||
int new_width = tr.width;
|
||||
int new_height = tr.height;
|
||||
|
||||
if(this->width != new_width)
|
||||
this->SetWidth(new_width);
|
||||
|
||||
if(this->height != new_height)
|
||||
this->SetHeight(new_height);
|
||||
|
||||
mover->SetPosition(body->GetRectangle().GetMax() - Vec2i(5,5));
|
||||
|
||||
//need to move all childs
|
||||
if(tr.x !=0 || tr.y !=0)
|
||||
{
|
||||
for(WindowList::iterator it = childs.begin(); it!= childs.end(); ++it)
|
||||
{
|
||||
GUIWindow* w = (*it);
|
||||
Vec2i pp = w->GetPosition();
|
||||
w->SetPosition(Vec2i(pp.X - tr.x, pp.Y - tr.y));
|
||||
}
|
||||
}
|
||||
FormatInputs();
|
||||
FormatOutputs();
|
||||
invalid = false;
|
||||
|
||||
if(parent)
|
||||
parent->Invalidate();
|
||||
}
|
||||
}
|
||||
void GUIShaderNode::Update(float dt)
|
||||
{
|
||||
}
|
||||
void GUIShaderNode::SetBackColor(const Vec4f& color)
|
||||
{
|
||||
}
|
||||
bool GUIShaderNode::ProcessMessage(GUIMessageType mt, GUIMessageParam mp, IMessageArgs* args)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
#ifndef GUIShaderNode_h__
|
||||
#define GUIShaderNode_h__
|
||||
#include <gui/GUIWindow.h>
|
||||
#include <gui/GUIPlane.h>
|
||||
#include <gui/GUIText.h>
|
||||
#include <gui/GUIMenu.h>
|
||||
#include <gui/GUIManager.h>
|
||||
#include "GUIShaderNodeIO.h"
|
||||
#include <gui/GUIPicture.h>
|
||||
#include <shaders/IShaderGraphNode.h>
|
||||
#include <vector>
|
||||
#include <IPropertyHolder.h>
|
||||
|
||||
class GUIShaderNode : public GUIWindow, public Core::IPropertyHolder
|
||||
{
|
||||
public:
|
||||
|
||||
EVENT(LayoutEvent);
|
||||
LayoutEvent Event_LayoutChanged;
|
||||
|
||||
EVENT1(ShaderNodeEvent, GUIShaderNode*);
|
||||
ShaderNodeEvent Event_Select;
|
||||
|
||||
EVENT2(ShaderNodeNouseEvent, GUIShaderNode*, int);
|
||||
ShaderNodeNouseEvent Event_HeaderClick;
|
||||
|
||||
EVENT2(NodeEvent, GUIShaderNodeIO*, GUIShaderNodeIO*);
|
||||
NodeEvent Event_Attach;
|
||||
GUIShaderNode(IShaderGraphNode* src);
|
||||
~GUIShaderNode();
|
||||
void SetCaption(const String& text);
|
||||
const String& GetCaption();
|
||||
void Update(float dt);
|
||||
void RenderSelf();
|
||||
void SetBackColor(const Vec4f& color);
|
||||
void AddInput(GUIShaderNodeIO* node);
|
||||
void AddOutput(GUIShaderNodeIO* node);
|
||||
size_t GetInputCount();
|
||||
size_t GetOutputCount();
|
||||
GUIShaderNodeIO* GetInput(int id);
|
||||
GUIShaderNodeIO* GetOutput(int id);
|
||||
|
||||
bool ProcessMessage(GUIMessageType mt, GUIMessageParam mp, IMessageArgs* args);
|
||||
void* UserData;
|
||||
|
||||
IShaderGraphNode* GetGraphicsNode()
|
||||
{
|
||||
return GraphicsNode;
|
||||
}
|
||||
void Invalidate()
|
||||
{
|
||||
GUIWindow::Invalidate();
|
||||
invalid = true;
|
||||
}
|
||||
private:
|
||||
GUIMenu* menu;
|
||||
IShaderGraphNode* GraphicsNode;
|
||||
bool invalid;
|
||||
GUIPicture* display;
|
||||
|
||||
bool resizing;
|
||||
bool moving;
|
||||
Vec2i size_pos;
|
||||
Vec2i size_min;
|
||||
Vec2i size_max;
|
||||
|
||||
void OnHeaderRightClick(GUIWindow* wnd, int param);
|
||||
void OnBeginResize(GUIWindow* wnd, int param);
|
||||
void OnDoResize(GUIWindow* wnd, int param);
|
||||
void OnEndResize(GUIWindow* wnd, int param);
|
||||
|
||||
void OnHeaderMouseDown(GUIWindow* wnd, int param);
|
||||
void OnHeaderMouseMove(GUIWindow* wnd, int param);
|
||||
void OnHeaderMouseUp(GUIWindow* wnd, int param);
|
||||
void OnHeaderMouseClick(GUIWindow* wnd, int param);
|
||||
|
||||
void OnSelect();
|
||||
void ProcessLink(GUIShaderNodeIO* my, GUIShaderNodeIO* other);
|
||||
void FormatInputs();
|
||||
void FormatOutputs();
|
||||
void OnIOResize(GUIWindow* wnd);
|
||||
GUIPlane* header;
|
||||
GUIText* header_text;
|
||||
GUIPlane* body;
|
||||
GUIPlane* mover;
|
||||
GUIPlane* back;
|
||||
typedef std::vector<GUIShaderNodeIO*> IoVector;
|
||||
IoVector inputs;
|
||||
IoVector outputs;
|
||||
|
||||
protected:
|
||||
void SetDisplayImage(texture_ptr tex);
|
||||
texture_ptr displayImage;
|
||||
};
|
||||
|
||||
#endif // GUIShaderNode_h__
|
||||
@@ -0,0 +1,98 @@
|
||||
#include "GUIShaderNodeIO.h"
|
||||
#include <gui/GUIManager.h>
|
||||
|
||||
GUIShaderNodeIO::GUIShaderNodeIO(GUIShaderNode* _parent)
|
||||
:mode_input(true), can_drag(false)
|
||||
{
|
||||
Owner = _parent;
|
||||
skip_mouse = true;
|
||||
arrow = new GUINodePort();
|
||||
arrow->SetWidth(14);
|
||||
arrow->SetHeight(10);
|
||||
arrow->SetBackColor(Vec4f(0,0,1,1));
|
||||
arrow->user_data = this;
|
||||
arrow->SetMode(mode_input);
|
||||
AddChild(arrow);
|
||||
|
||||
caption = new GUIText();
|
||||
caption->SetAutoSize(true);
|
||||
caption->SetText("UV");
|
||||
caption->SetBackColor(Vec4f(1,1,1,0.1f));
|
||||
caption->SetForeColor(Vec4f(0,0,0,1.0f));
|
||||
AddChild(caption);
|
||||
|
||||
arrow->Event_MouseDown += NewDelegate(this, &GUIShaderNodeIO::OnArrowPress);
|
||||
arrow->Event_MouseClick += NewDelegate(this, &GUIShaderNodeIO::OnArrowClick);
|
||||
arrow->Event_Link += NewDelegate(this, &GUIShaderNodeIO::AcceptLink);
|
||||
}
|
||||
Vec2i GUIShaderNodeIO::GetAttachPoint()
|
||||
{
|
||||
Vec2i pos = arrow->GetPositionAbs();
|
||||
pos.Y += arrow->GetHeight() / 2;
|
||||
|
||||
if(IsInput())
|
||||
{
|
||||
pos.X += arrow->GetWidth();
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
GUIShaderNodeIO::~GUIShaderNodeIO()
|
||||
{
|
||||
}
|
||||
void GUIShaderNodeIO::AcceptLink(GUINodePort* me, GUINodePort* other)
|
||||
{
|
||||
Event_Link.Invoke(this, reinterpret_cast<GUIShaderNodeIO*>(other->user_data));
|
||||
}
|
||||
void GUIShaderNodeIO::SetCaption(const String& _caption)
|
||||
{
|
||||
caption->SetText(_caption);
|
||||
}
|
||||
void GUIShaderNodeIO::SetMode(bool input)
|
||||
{
|
||||
mode_input = input;
|
||||
arrow->SetMode(mode_input);
|
||||
}
|
||||
void GUIShaderNodeIO::Update(float dt)
|
||||
{
|
||||
}
|
||||
void GUIShaderNodeIO::RenderSelf()
|
||||
{
|
||||
int caption_offset = 3;
|
||||
|
||||
if(this->GetWidth() != (caption->GetWidth() + arrow->GetWidth() + caption_offset))
|
||||
{
|
||||
this->SetWidth(caption->GetWidth() + arrow->GetWidth() + caption_offset);
|
||||
}
|
||||
|
||||
int h = 0;
|
||||
if(caption->GetHeight() > arrow->GetHeight())
|
||||
h = caption->GetHeight();
|
||||
else
|
||||
h = arrow->GetHeight();
|
||||
|
||||
if(this->GetHeight() != h)
|
||||
this->SetHeight(h);
|
||||
|
||||
if(mode_input)
|
||||
{
|
||||
arrow->SetPosition(Vec2i(0,(caption->GetHeight() - arrow->GetHeight()) / 2 ));
|
||||
caption->SetPosition(Vec2i(arrow->GetWidth() + caption_offset, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
caption->SetPosition(Vec2i(0,0));
|
||||
arrow->SetPosition(Vec2i(caption->GetWidth() + caption_offset, (caption->GetHeight() - arrow->GetHeight()) / 2 ));
|
||||
}
|
||||
}
|
||||
void GUIShaderNodeIO::SetBackColor(const Vec4f& color)
|
||||
{
|
||||
}
|
||||
void GUIShaderNodeIO::OnArrowPress(GUIWindow* w, int arg)
|
||||
{
|
||||
if(arg == KEY_MOUSE_LEFT)
|
||||
can_drag = true;
|
||||
}
|
||||
void GUIShaderNodeIO::OnArrowClick(GUIWindow* w, int arg)
|
||||
{
|
||||
Event_PortClick.Invoke(this, arg);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef GUIShaderNodeIO_h__
|
||||
#define GUIShaderNodeIO_h__
|
||||
|
||||
#include <gui/GUIWindow.h>
|
||||
#include <gui/GUIPlane.h>
|
||||
#include <gui/GUIText.h>
|
||||
#include "GUINodePort.h"
|
||||
#include <shaders/IShaderGraphNodePort.h>
|
||||
|
||||
class GUIShaderNode;
|
||||
class GUIShaderNodeIO : public GUIWindow
|
||||
{
|
||||
friend class GUIShaderNode;
|
||||
public:
|
||||
EVENT2(IOEvent, GUIShaderNodeIO*, GUIShaderNodeIO*);
|
||||
IOEvent Event_Link;
|
||||
|
||||
MouseEvent Event_PortClick;
|
||||
|
||||
GUIShaderNodeIO(GUIShaderNode* _parent);
|
||||
~GUIShaderNodeIO();
|
||||
int id;
|
||||
void SetMode(bool input);
|
||||
void Update(float dt);
|
||||
void RenderSelf();
|
||||
void SetBackColor(const Vec4f& color);
|
||||
void SetCaption(const String& _caption);
|
||||
bool IsInput(){return mode_input;}
|
||||
Vec2i GetAttachPoint();
|
||||
GUIShaderNode* Owner;
|
||||
IShaderGraphNodePort* GraphicsPort;
|
||||
private:
|
||||
void AcceptLink(GUINodePort* me, GUINodePort* other);
|
||||
bool can_drag;
|
||||
void OnArrowPress(GUIWindow* w, int arg);
|
||||
void OnArrowClick(GUIWindow* w, int arg);
|
||||
GUINodePort* arrow;
|
||||
GUIText* caption;
|
||||
bool mode_input;
|
||||
};
|
||||
#endif // GUIShaderNodeIO_h__
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef GUIShaderNodeTexture_h__
|
||||
#define GUIShaderNodeTexture_h__
|
||||
|
||||
#include "GUIShaderNode.h"
|
||||
#include <ResourceManager.h>
|
||||
#include "Property.h"
|
||||
|
||||
class GUIShaderNodeTexture : public GUIShaderNode
|
||||
{
|
||||
public:
|
||||
GUIShaderNodeTexture(IShaderGraphNode* src)
|
||||
:GUIShaderNode(src)
|
||||
{
|
||||
tex = 0;
|
||||
|
||||
if(src->GetPropertyByAttribute("Name", "FilePath", &file_prop))
|
||||
{
|
||||
|
||||
file_prop->Event_ValueChanged += NewDelegate(this, &GUIShaderNodeTexture::OnTexturePathChanged);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
String GetFilename()
|
||||
{
|
||||
return file_prop->ToString();
|
||||
}
|
||||
private:
|
||||
Core::IProperty* file_prop;
|
||||
void OnTexturePathChanged()
|
||||
{
|
||||
//if(tex.ptr())
|
||||
//delete tex.ptr();
|
||||
printf("Try get texture\n");
|
||||
if(file_prop->ToString() != STR("")){
|
||||
tex = ResourceManager::me()->GetTexture(file_prop->ToString());
|
||||
printf("End try get texture\n");
|
||||
SetDisplayImage(tex);
|
||||
printf("End set display image\n");
|
||||
}
|
||||
}
|
||||
texture_ptr tex;
|
||||
};
|
||||
#endif // GUIShaderNodeTexture_h__
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "Editor.h"
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
Editor e;
|
||||
e.Run();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4B98EC02-E239-4EA6-9D7A-FC5743184D67}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>LifeMaterialEditor</RootNamespace>
|
||||
<SccProjectName><Project Location In Database></SccProjectName>
|
||||
<SccAuxPath><Source Control Database></SccAuxPath>
|
||||
<SccLocalPath><Local Binding Root of Project></SccLocalPath>
|
||||
<SccProvider>Mercurial Source Control Package</SccProvider>
|
||||
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\LifeEngine\include;$(SolutionDir)\LifeCore\include;$(SolutionDir)\LifeSound\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(SolutionDir)\LifeCore\lib;$(SolutionDir)\LifeEngine\lib;$(SolutionDir)\LifeSound\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>LifeEngine_d.lib;LifeSound_d.lib;LifeCore_d.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\LifeEngine\include;$(SolutionDir)\LifeCore\include;$(SolutionDir)\LifeSound\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(SolutionDir)\LifeCore\lib;$(SolutionDir)\LifeEngine\lib;$(SolutionDir)\LifeSound\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>LifeEngine_d.lib;LifeSound_d.lib;LifeCore_d.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\LifeEngine\include;$(SolutionDir)\LifeCore\include;$(SolutionDir)\LifeSound\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(SolutionDir)\LifeCore\lib;$(SolutionDir)\LifeEngine\lib;$(SolutionDir)\LifeSound\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>LifeEngine.lib;LifeSound.lib;LifeCore.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\LifeEngine\include;$(SolutionDir)\LifeCore\include;$(SolutionDir)\LifeSound\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(DXSDK_DIR)\Lib\x86;$(SolutionDir)\LifeCore\lib;$(SolutionDir)\LifeEngine\lib;$(SolutionDir)\LifeSound\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>LifeEngine.lib;LifeSound.lib;LifeCore.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Editor.h" />
|
||||
<ClInclude Include="EditorShared.h" />
|
||||
<ClInclude Include="GUINodeContainer.h" />
|
||||
<ClInclude Include="GUINodeList.h" />
|
||||
<ClInclude Include="GUINodePort.h" />
|
||||
<ClInclude Include="GUIShaderNode.h" />
|
||||
<ClInclude Include="GUIShaderNodeIO.h" />
|
||||
<ClInclude Include="GUIShaderNodeTexture.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Editor.cpp" />
|
||||
<ClCompile Include="GUINodeContainer.cpp" />
|
||||
<ClCompile Include="GUINodeList.cpp" />
|
||||
<ClCompile Include="GUINodePort.cpp" />
|
||||
<ClCompile Include="GUIShaderNode.cpp" />
|
||||
<ClCompile Include="GUIShaderNodeIO.cpp" />
|
||||
<ClCompile Include="LifeMaterialEditor.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// LifeMaterialEditor.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
@@ -0,0 +1,13 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user