Code refactor: nodify object and mesh, but not used for XML yet.
Differential Revision: https://developer.blender.org/D2016
This commit is contained in:
parent
c96a4c8a2a
commit
001ba5bdf5
|
@ -75,19 +75,42 @@ void Mesh::Curve::bounds_grow(const int k, const float3 *curve_keys, const float
|
|||
|
||||
/* Mesh */
|
||||
|
||||
NODE_DEFINE(Mesh)
|
||||
{
|
||||
NodeType* type = NodeType::add("mesh", create);
|
||||
|
||||
static NodeEnum displacement_method_enum;
|
||||
displacement_method_enum.insert("bump", DISPLACE_BUMP);
|
||||
displacement_method_enum.insert("true", DISPLACE_TRUE);
|
||||
displacement_method_enum.insert("both", DISPLACE_BOTH);
|
||||
SOCKET_ENUM(displacement_method, "Displacement Method", displacement_method_enum, DISPLACE_BUMP);
|
||||
|
||||
SOCKET_INT(motion_steps, "Motion Steps", 3);
|
||||
SOCKET_BOOLEAN(use_motion_blur, "Use Motion Blur", false);
|
||||
|
||||
SOCKET_INT_ARRAY(triangles, "Triangles", array<int>());
|
||||
SOCKET_POINT_ARRAY(verts, "Vertices", array<float3>());
|
||||
SOCKET_INT_ARRAY(shader, "Shader", array<int>());
|
||||
SOCKET_BOOLEAN_ARRAY(smooth, "Smooth", array<bool>());
|
||||
|
||||
SOCKET_POINT_ARRAY(curve_keys, "Curve Keys", array<float3>());
|
||||
SOCKET_FLOAT_ARRAY(curve_radius, "Curve Radius", array<float>());
|
||||
SOCKET_INT_ARRAY(curve_first_key, "Curve First Key", array<int>());
|
||||
SOCKET_INT_ARRAY(curve_shader, "Curve Shader", array<int>());
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
Mesh::Mesh()
|
||||
: Node(node_type)
|
||||
{
|
||||
need_update = true;
|
||||
need_update_rebuild = false;
|
||||
transform_applied = false;
|
||||
transform_negative_scaled = false;
|
||||
transform_normal = transform_identity();
|
||||
displacement_method = DISPLACE_BUMP;
|
||||
bounds = BoundBox::empty;
|
||||
|
||||
motion_steps = 3;
|
||||
use_motion_blur = false;
|
||||
|
||||
bvh = NULL;
|
||||
|
||||
tri_offset = 0;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define __MESH_H__
|
||||
|
||||
#include "attribute.h"
|
||||
#include "node.h"
|
||||
#include "shader.h"
|
||||
|
||||
#include "util_boundbox.h"
|
||||
|
@ -42,8 +43,10 @@ class DiagSplit;
|
|||
|
||||
/* Mesh */
|
||||
|
||||
class Mesh {
|
||||
class Mesh : public Node {
|
||||
public:
|
||||
NODE_DECLARE;
|
||||
|
||||
/* Mesh Triangle */
|
||||
struct Triangle {
|
||||
int v[3];
|
||||
|
@ -95,8 +98,6 @@ public:
|
|||
DISPLACE_NUM_METHODS,
|
||||
};
|
||||
|
||||
ustring name;
|
||||
|
||||
/* Mesh Data */
|
||||
enum GeometryFlags {
|
||||
GEOMETRY_NONE = 0,
|
||||
|
|
|
@ -33,14 +33,25 @@ CCL_NAMESPACE_BEGIN
|
|||
|
||||
/* Object */
|
||||
|
||||
Object::Object()
|
||||
NODE_DEFINE(Object)
|
||||
{
|
||||
NodeType* type = NodeType::add("object", create);
|
||||
|
||||
SOCKET_NODE(mesh, "Mesh", &Mesh::node_type);
|
||||
SOCKET_TRANSFORM(tfm, "Transform", transform_identity());
|
||||
SOCKET_INT(visibility, "Visibility", ~0);
|
||||
SOCKET_INT(random_id, "Random ID", 0);
|
||||
SOCKET_INT(pass_id, "Pass ID", 0);
|
||||
SOCKET_BOOLEAN(use_holdout, "Use Holdout", false);
|
||||
SOCKET_POINT(dupli_generated, "Dupli Generated", make_float3(0.0f, 0.0f, 0.0f));
|
||||
SOCKET_POINT2(dupli_uv, "Dupli UV", make_float2(0.0f, 0.0f));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
Object::Object()
|
||||
: Node(node_type)
|
||||
{
|
||||
name = "";
|
||||
mesh = NULL;
|
||||
tfm = transform_identity();
|
||||
visibility = ~0;
|
||||
random_id = 0;
|
||||
pass_id = 0;
|
||||
particle_system = NULL;
|
||||
particle_index = 0;
|
||||
bounds = BoundBox::empty;
|
||||
|
@ -48,9 +59,6 @@ Object::Object()
|
|||
motion.mid = transform_identity();
|
||||
motion.post = transform_identity();
|
||||
use_motion = false;
|
||||
use_holdout = false;
|
||||
dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
|
||||
dupli_uv = make_float2(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
Object::~Object()
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef __OBJECT_H__
|
||||
#define __OBJECT_H__
|
||||
|
||||
#include "node.h"
|
||||
#include "scene.h"
|
||||
|
||||
#include "util_boundbox.h"
|
||||
|
@ -37,12 +38,13 @@ struct Transform;
|
|||
|
||||
/* Object */
|
||||
|
||||
class Object {
|
||||
class Object : public Node {
|
||||
public:
|
||||
NODE_DECLARE;
|
||||
|
||||
Mesh *mesh;
|
||||
Transform tfm;
|
||||
BoundBox bounds;
|
||||
ustring name;
|
||||
uint random_id;
|
||||
int pass_id;
|
||||
vector<ParamValue> attributes;
|
||||
|
|
Loading…
Reference in New Issue