Boost logo

Boost :

Subject: Re: [boost] QVM Review
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2015-12-16 22:01:22


On Wed, Dec 16, 2015 at 8:51 PM, Emil Dotchevski <emildotchevski_at_[hidden]>
wrote:

> On Wed, Dec 16, 2015 at 1:38 PM, Rainer Deyke <rainerd_at_[hidden]> wrote:
>
> > On 16.12.2015 22:21, Emil Dotchevski wrote:
> >
> > > The swizzling syntax must be terse or else it's useless. If you've
> > written
> > > shader code you'll know utterly inadequate it is to require a syntax
> like
> > > swizzle<1,0,3,2>(vec) instead of (vec,YXWZ). At any rate, swizzling is
> > > defined in a separate header, don't include it if you don't want it.
> >
> > YXWZ(vec) is not only much more readable than (vec,YXWZ), it's also one
> > character shorter.
> >
>
> It's less conventional, in GLSL you just use vec.yxwz, and (vec,YXWZ) is
> quite close.
>
> Also, let's say you want to access the X coordinate of a vector, (vec,X) is
> more readable than X(vec).
>
> I do appreciate the concerns about overloading operator comma, I was also
> skeptical since this wasn't my idea. FWIW after years of use in actual
> development this overload hasn't caused any problems.
>
> That said, I'm fine with using a different notation for swizzling.
>

IIRC the conclusion in SG14 was that swizzling is uncommon enough in
regular programming to not warrant out-of-the-way special operators. In
that most cases of its use are in shader languages and not in C++ itself.

Did you consider the the array op: vec[X], vec[YXWZ]? It has the properties
of both you and Rainer's ideas.

-- 
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net
-- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk