Initial step for connectivity refactor.
Instead of wiring up pointers with prepareNodeEval() and finishNodeEval() use for each connection a single memory block where outputs and inputs point to.
This commit is contained in:
@@ -18,9 +18,11 @@ struct AnimGraph {
|
||||
std::vector<AnimNode*> m_eval_ordered_nodes;
|
||||
std::vector<std::vector<AnimGraphConnection> > m_node_input_connections;
|
||||
std::vector<std::vector<AnimGraphConnection> > m_node_output_connections;
|
||||
NodeSocketAccessorBase* m_socket_accessor;
|
||||
std::vector<AnimData*> m_animdata_blocks;
|
||||
NodeDescriptorBase* m_socket_accessor;
|
||||
char* m_input_buffer = nullptr;
|
||||
char* m_output_buffer = nullptr;
|
||||
char* m_connection_data_storage = nullptr;
|
||||
|
||||
std::vector<Socket>& getGraphOutputs() { return m_socket_accessor->m_inputs; }
|
||||
std::vector<Socket>& getGraphInputs() { return m_socket_accessor->m_outputs; }
|
||||
@@ -31,48 +33,17 @@ struct AnimGraph {
|
||||
|
||||
bool init(AnimGraphContext& context);
|
||||
void dealloc() {
|
||||
if (m_node_input_connections.size() > 0) {
|
||||
std::vector<AnimGraphConnection>& graph_outputs =
|
||||
m_node_input_connections[0];
|
||||
|
||||
for (size_t i = 0, n = graph_outputs.size(); i < n; i++) {
|
||||
AnimGraphConnection& connection = graph_outputs[i];
|
||||
if (connection.m_target_socket.m_type
|
||||
== SocketType::SocketTypeAnimation) {
|
||||
AnimData* graph_anim_output = static_cast<AnimData*>(
|
||||
connection.m_target_socket.m_reference.ptr);
|
||||
assert(graph_anim_output != nullptr);
|
||||
|
||||
// we have to explicitly call the destructor as the AnimData* was
|
||||
// initialized using a placement new operator.
|
||||
graph_anim_output->m_local_matrices.vector::~vector();
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < m_animdata_blocks.size(); i++) {
|
||||
m_animdata_blocks[i]->m_local_matrices.vector::~vector();
|
||||
}
|
||||
m_animdata_blocks.clear();
|
||||
|
||||
m_node_input_connections.clear();
|
||||
|
||||
if (m_node_output_connections.size() > 0) {
|
||||
std::vector<AnimGraphConnection>& graph_inputs =
|
||||
m_node_output_connections[0];
|
||||
|
||||
for (size_t i = 0, n = graph_inputs.size(); i < n; i++) {
|
||||
AnimGraphConnection& connection = graph_inputs[i];
|
||||
if (connection.m_target_socket.m_type
|
||||
== SocketType::SocketTypeAnimation) {
|
||||
AnimData* graph_anim_output = static_cast<AnimData*>(
|
||||
connection.m_target_socket.m_reference.ptr);
|
||||
assert(graph_anim_output != nullptr);
|
||||
|
||||
// we have to explicitly call the destructor as the AnimData* was
|
||||
// initialized using a placement new operator.
|
||||
graph_anim_output->m_local_matrices.vector::~vector();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_node_output_connections.clear();
|
||||
|
||||
delete[] m_input_buffer;
|
||||
delete[] m_output_buffer;
|
||||
delete[] m_connection_data_storage;
|
||||
|
||||
for (int i = 0; i < m_nodes.size(); i++) {
|
||||
delete m_nodes[i];
|
||||
|
||||
Reference in New Issue
Block a user