22 virtual int operator()(LWItemID light,
const LWDVector lightDir,
const LWDVector lightColour ) = 0;
37 int IlluminationSampler(
void *data, LWItemID light,
const LWDVector dir,
const LWDVector color );
50 LWNodeInputFuncs *globPtr;
57 return globPtr->evaluate(
id, na, value);
61 LWNodeInput(NodeID _id, ConnectionType type,
const std::string name, NodeInputEvent* inp_event,
bool _destroy =
true)
62 : do_destroy(_destroy),
66 id = globPtr->create(node_id, type, name.c_str(), inp_event);
69 : do_destroy(_destroy),
78 if (do_destroy) globPtr->destroy(node_id,
id);
81 NodeInputID
getID(
void)
const {
return id;}
85 return evaluate(na, static_cast<void *>(value));
90 return evaluate(na, static_cast<void *>(value));
95 return evaluate(na, static_cast<void *>(value.
asLWVector()));
100 return evaluate(na, static_cast<void *>(value));
106 int ret = evaluate(na, &i);
113 return evaluate(na, static_cast<void *>(vparm->
asLWVector()));
118 return evaluate(na, static_cast<void *>(mat));
131 return (globPtr->check(
id) != 0);
134 NodeID
node(
void) {
return globPtr->node(
id);}
136 NodeInputID
next() {
return globPtr->next(
id);}
137 NodeInputID
previous() {
return globPtr->previous(
id);}
153 LWNodeOutput(NodeID _id, ConnectionType type, std::string name,
bool _destroy =
true)
154 : do_destroy(_destroy),
158 id =
globPtr->create(node_id, type, name.c_str());
163 if (do_destroy)
globPtr->destroy(node_id,
id);
168 NodeOutputID
getID(
void)
const {
return id;}
169 bool isID(
const NodeOutputID _id)
const {
return id == _id;}
177 virtual LWNodeInput *addInput(ConnectionType type,
const std::string name, NodeInputEvent* inp_event) = 0;
185 return addInput(NOT_COLOR, name, inp_event);
193 return addInput(NOT_SCALAR, name, inp_event);
197 return addInput(NOT_VECTOR, name, inp_event);
201 return addInput(NOT_INTEGER, name, inp_event);
205 return addInput(NOT_FUNCTION, name, inp_event);
209 return addInput(NOT_MATERIAL, name, inp_event);
220 LWNodeInputFuncs *inF;
223 virtual LWNodeInput *addInput(ConnectionType type,
const std::string name, NodeInputEvent* inp_event)
225 return new LWNodeInput(
id, type, name.c_str(), inp_event);
228 LWNodeOutput *addOutput(ConnectionType type,
const std::string name)
232 void setValue( NodeValue val,
void *v) {outF->setValue(val, v);}
233 void disconnect (NodeInputID nid) {inF->disconnect(
id, nid);}
269 return addOutput(NOT_COLOR, name);
277 return addOutput(NOT_SCALAR, name);
281 return addOutput(NOT_VECTOR, name);
285 return addOutput(NOT_INTEGER, name);
289 return addOutput(NOT_FUNCTION, name);
293 return addOutput(NOT_MATERIAL, name);
335 ConnectionType
getType( NodeValue val) {
return outF->getType(val);}
340 void setValue(NodeValue val,
double *v)
342 setValue(val, static_cast<void *>(v));
344 void setValue(NodeValue val, LWDVector *v)
346 setValue(val, static_cast<void *>(v));
348 void setValue(NodeValue val,
double a,
double b,
double c)
354 setValue(val, static_cast<void *>(v));
356 void setValue(NodeValue val,
float v[3])
358 setValue(val, static_cast<double>(v[0]), static_cast<double>(v[1]), static_cast<double>(v[2]));
361 void setValue(NodeValue val,
float v)
367 void setValue(NodeValue val,
double v)
373 void setValue(NodeValue val,
int *v)
375 setValue(val, static_cast<void *>(v));
378 void setValue(NodeValue val,
unsigned int *v)
381 setValue(val, static_cast<void *>(&i));
384 void setValue(NodeValue val,
bool v)
387 setValue(val, static_cast<void *>(&i));
390 void setValue(NodeValue val, LWNodalMaterial *material)
392 setValue(val, static_cast<void *>(material));
401 void *
getValue( NodeValue val) {
return outF->getValue(val);}
411 static void Blend ( LWDVector result, LWDVector bg, LWDVector fg,
double alpha, BlendingMode mode)
413 globPtr->Blend(result, bg, fg, alpha, mode);
415 static void NodeAutosize( NodeID
id, LWDVector scale, LWDVector position )
417 globPtr->NodeAutosize(
id, scale, position);
441 #endif // LWPP_NODES_H