Newer
Older
invertedlogic / InvertedLogic / iLFramework / toolkit / include / GL / Nodes.h
@John Ryland John Ryland on 10 Nov 2019 1 KB rename
#ifndef NODES_H
#define NODES_H


#include <cstdint>
#include <vector>
#include "GL/Math.h"
#include "GL/Panel.h"


#include "Namespace.h"
BEGIN_NAMESPACE


enum ValueType
{
	VT_Float,
	VT_Int,
	VT_Color,
	VT_Vec4,
	VT_Mat4
};


struct Value
{
	const char*   m_name;
	ValueType     m_type;
	union
	{
		float	  m_float;
		int32_t   m_int;
		uint32_t  m_color;
		Vec4f	  m_vec4;
		Mat4x4f   m_mat4x4;
	};
};


struct Node
{
	const char*        m_name;
	float              m_x, m_y;
	std::vector<Value> m_inputs;
	std::vector<Value> m_outputs;
};


class NodePanel : public Panel
{
public:
	NodePanel(int a_x, int a_y, int a_w, int a_h, const char* a_name);
	void draw();
	void addInput(const char* a_input);
	void addOutput(const char* a_output);
	void GetInputSlotPosition(int slot, int &a_x, int &a_y);
	void GetOutputSlotPosition(int slot, int &a_x, int &a_y);

//private:
	int xDragStart, yDragStart;
	std::vector<std::string> m_inputs;
	std::vector<std::string> m_outputs;
};


struct Connection
{
	Connection(NodePanel* a_outputPanel, int a_output, NodePanel* a_inputPanel, int a_input);
	void draw();

	NodePanel* outputPanel;
	NodePanel* inputPanel;
	int output;
	int input;
};


END_NAMESPACE


#endif // NODES_H