|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Dicing user-specified params (GSoC)In curves.cpp I've overridden CqSurface::Dice() as we discussed and I would like to begin the rework of the dicing of the user-specified params.
Where I will be writing new code is inside this loop:
std::vector<CqParameter*>::iterator iUP; std::vector<CqParameter*>::iterator end = m_aUserParams.end(); for ( iUP = m_aUserParams.begin(); iUP != end ; iUP++ ) { ...}
To summarize my understanding of the problem: We can't use SetArgument (what exactly is an "argument" ? ) because further down the line that leads to a Dice call (on a primvar) which assumes bilinear interp instead of linear. So, instead we need to do a pShader->FindArgument to get to the IqShaderData* and then, lerping begins along v: we compute the appropriate offset and then do a IqShaderData::SetValue(foo, offset) call. Also, a detail: I guess we need to do a big switch (a la NaturalDice) on *iUP to tell what type of parameter it is, then do (for example):
CqParameterTyped<TqFloat, TqFloat>* pTParam = static_cast<CqParameterTyped<TqFloat, TqFloat>*>(*iUP); before finally calling the appropriate SetValue function.
... Finally, to my question: how should I use FindArgument? I see that it wants a string as the "argument" name. Where do I get this value? A wild guess: (*iUP)->strName() ?
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Aqsis-development mailing list Aqsis-development@... https://lists.sourceforge.net/lists/listinfo/aqsis-development |
|
|
Re: Dicing user-specified params (GSoC)On Wed, Aug 12, 2009 at 7:57 AM, Trevor Lovett<trevlovett@...> wrote:
> In curves.cpp I've overridden CqSurface::Dice() as we discussed and I would > like to begin the rework of the dicing of the user-specified params. > > Where I will be writing new code is inside this loop: > std::vector<CqParameter*>::iterator iUP; > std::vector<CqParameter*>::iterator end = m_aUserParams.end(); > for ( iUP = m_aUserParams.begin(); iUP != end ; iUP++ ) > { ...} > > To summarize my understanding of the problem: > We can't use SetArgument (what exactly is an "argument" ? ) An "argument" is a formal parameter to a shader function (in the RISpec I think they call this an "instance variable" for the shader). That is, in the shader surface my_surf(color col = (1,0,0)) { /*...*/ } "col" is an "argument". > because further > down the line that leads to a Dice call (on a primvar) which assumes > bilinear interp instead of linear. Correct. > So, instead we need to do > a pShader->FindArgument to get to the IqShaderData* and then, lerping begins > along v: we compute the appropriate offset and then do a > IqShaderData::SetValue(foo, offset) call. Actually, for efficiency I'd try to avoid SetValue and instead set values directly through a pointer. SetValue involves calling at least one virtual function call (yuck, yes this interface should go away in future!). That is, call GetValuePtr to get a raw pointer to the data instead. > Also, a detail: I guess we need > to do a big switch (a la NaturalDice) on *iUP to tell what type of parameter > it is, then do (for example): > CqParameterTyped<TqFloat, TqFloat>* pTParam = > static_cast<CqParameterTyped<TqFloat, TqFloat>*>(*iUP); > before finally calling the appropriate SetValue function. > ... Yes, you're going to need a big switch, possibly like in CqSurface::NaturalDice. Have a read of that function, and you'll see that I factored all the type-specific stuff into a function "surfaceNaturalDice". Depending on the details, that's probably the right thing to do. > Finally, to my question: how should I use FindArgument? I see that it > wants a string as the "argument" name. Where do I get this value? > A wild guess: (*iUP)->strName() ? Correct! Just look inside CqShaderVM::SetArgument() and you'll see the analogous thing. Cheers, ~Chris. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Aqsis-development mailing list Aqsis-development@... https://lists.sourceforge.net/lists/listinfo/aqsis-development |
| Free embeddable forum powered by Nabble | Forum Help |