[Fluxus] pdata-op between Pdata "c" end vector(3)

Ted tedr56 at gmail.com
Thu Apr 19 21:29:20 PDT 2012


Hi the list,
I'm experimenting the pdata-op function with particles with simple
velocity.
All was going well.
I even reduce the particles size to disappear.
But I got stuck on operations on colours.

Here are the errors I have:

(pdata-op "+" "c" (vector 0 0.1 0))
>AddOperator has no operator for types:
PN6Fluxus10TypedPDataINS_7dColourEEE and N6Fluxus7dVectorE

(pdata-op "+" "c" (vector 0 0.1 0 1))
>AddOperator has no operator for types:
PN6Fluxus10TypedPDataINS_7dColourEEE and N6Fluxus7dColourE

So, I searched and found this AddOperator function in sources, and tried
to add these specific types.
Here is the corresponding patch for (pdata-op "+" "c" (vector 0 0.1 0))


---------------------- libfluxus/src/PDataArithmetic.cpp
----------------------
index 8879667..99fd974 100644
@@ -79,6 +79,19 @@ PData *AddOperator::Operate(TypedPData<dVector> *a,
TypedPData<dVector> *b)
 	return NULL;
 }
 
+template <>
+PData *AddOperator::Operate(TypedPData<dColour> *a, dVector b)
+{
+	for (vector<dColour,FLX_ALLOC(dColour) >::iterator
i=a->m_Data.begin(); i!=a->m_Data.end(); i++)
+	{
+		i->r+=b.x;
+		i->g+=b.y;
+		i->b+=b.z;
+//		i->A=i.A;
+	}
+	return NULL;
+}
+
 ////////////////////////////////////////////////////////////////////////////
 
 template <>

----------------------- libfluxus/src/PDataArithmetic.h
-----------------------
index fccce02..1ea4f37 100644
@@ -62,6 +62,8 @@ template<>
 PData *AddOperator::Operate(TypedPData<dVector> *a, TypedPData<float>
*b);
 template<>
 PData *AddOperator::Operate(TypedPData<dVector> *a, TypedPData<dVector>
*b);
+template<>
+PData *AddOperator::Operate(TypedPData<dColour> *a, dVector b);
 
 class MultOperator : public PDataOperator
 {




Proud of my creation, I recompile, no compile errors, launch the script,
and I get the same error.
Did I missed a declaration somewhere, or is it totally wrong?

Thanks for any clue on this.


Cheers Ted.


ps: I made a demo for a vj contest with my fluxus work. If you want to
checkout : http://vimeo.com/vjbros/astrobros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20120420/7dbbd4bd/attachment.htm>


More information about the Fluxus mailing list