Re: [Crystal-cvs] SF.net SVN: crystal:[39466] CS/trunk/include/csutil/variant.h

Christian Van Brussel <[email protected]> Tue, 23 Jul 2013 16:45:59 +0200
Newsgroups gmane.comp.graphics.crystalspace.devel
Organization UCL - TELE
Message-ID <1374590759.2342.106.camel@scylla>
On Wed, 2013-07-17 at 00:13 +0200, res wrote:
> So “it's a quaternion” could be seen as a semantic?
> csVariant is probably not the right place for storing that…

Yes, a quaternion is represented in CS through a csVector3 plus a float,
that is 4 float in total, that's pretty much the same as a csVector4. So
“it's a quaternion” could definitively be seen as a semantic, although
the conversion between one and another type is not straightforward.

> AFAIK you're using csVariant for editor purposes. So… is there a
> mechanic to specify a semantic for some variant value in the editor?

The csVariant are used to represent the parameters of a iModifiable, and
the semantic of the parameters are defined through the interface
iModifiableConstraint. There are currently constraints for bounded
values, enums, VFS paths and text entries, and we will probably add much
more in the future. 

> If there is, I would think the approach is to store the “most generic”
> type in a csVariant and have the semantics handled in another layer on top.

OK, then here I would not introduce a variant type for quaternions, but
instead add a new constraint specifying that a csVector4 is a
quaternion.

> Then again, sometimes it's rather cumbersome to go from a generic to a
> special representation – case in point, extracting rotation from a
> matrix. So some less-than-generic types (eg orthogonal transforms) look
> rather practical to have.

OK, I'll let a variant type for csMatrix3 and csTransform, then add
iModifiableConstraint's for rotational matrices and orthogonal
transforms.

Thanks for the insights!


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Crystal-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-develop