Thread overview | |||||
---|---|---|---|---|---|
|
May 07, 2004 opCmp not powerful enough for Cg | ||||
---|---|---|---|---|
| ||||
So I'm trying to port the Cg internal types (float2,float3,float4)to D right now. I'm almost done, but I ran into three problems on the way. First of all, it's impossible to do componentwise operator overloading for the less and equality operators. in cg float4(0,2,4,6) < float4(1,3,3,3) returns float4(1,1,0,0) given the way opCmp is structured I can only accomplish this in C++ by overloading the individual operators. the same problem is given with the equality comparison being componentwise. the last problem is of course the overloadable ?: operator--but I guess users will just have to call a member function... I guess the same rule applies to letting users use < and > and == operators it would be nice if we were allowed to specify our return types for *all* operators rather than just *most* of them :-) the rest of the syntax looks JUST like cg. you can do float4(1,2,3).zyx = float2(1,2,3).xxx*4*float3(2,3,4); and other such odd Cg syntax --Daniel check out http://cvs.sourceforge.net/viewcvs.py/deliria/deliria/vec.d for how it works :-) |
May 07, 2004 Re: opCmp not powerful enough for Cg | ||||
---|---|---|---|---|
| ||||
Posted in reply to hellcatv | hellcatv@hotmail.com wrote: > So I'm trying to port the Cg internal types (float2,float3,float4)to D right > now. > I'm almost done, but I ran into three problems on the way. What's Cg? > First of all, it's impossible to do componentwise operator overloading for the > less and equality operators. You could always define your own function to do this. <snip> > it would be nice if we were allowed to specify our return types for *all* > operators rather than just *most* of them :-) <snip> So, how would one sort or binary search using a comparator that returns something other than a number? Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. |
May 07, 2004 Re: opCmp not powerful enough for Cg | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Stewart Gordon wrote: > hellcatv@hotmail.com wrote: > >> So I'm trying to port the Cg internal types (float2,float3,float4)to D right >> now. >> I'm almost done, but I ran into three problems on the way. > > > What's Cg? Yeah are you talking about computer graphics or C graphics (which is Nvidia's, C like shading language). -- -Anderson: http://badmama.com.au/~anderson/ |
Copyright © 1999-2021 by the D Language Foundation