Giter Site home page Giter Site logo

ogsl's People

Contributors

saharan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ogsl's Issues

Indirect addressing

Hello !
As we are moving all our shaders from agal to ogsl, we encountered a little shortcoming.
In AGAL, we use a vector of constants to store some infos (ex: bones matrices) and then in the shader, we would select the needed constant(or matrix) depending on a vertex attribute.
The vertex attribute would be an index in this vector.
Something like this:

ft0 = fc[va1.x]

We noticed 2 issues :

• You do not allow using a variable as an index, the following code is not valid:
var index:float = 3;
constant[index].x; // <= this line would fail in ogsl

• There is no array/vector type with an arbitrary (but fixed on initialisation of course) number of elements, it would be great if you could add a vecXX type.

With theses 2 additions, our needs would be 100% covered.

What do you think ?

Here's a part of the agal (which is actually Easy Agal) prog i'd like to convert to ogsl (OGSL is so cool and powerful) to give you an idea of our troubles:

We store about 16 matrixs from vc40 to vc(40 + 16 * 4)

// matrix average
add(TEMP[7], TEMP[5], CONST[23]); // +40 for matrices
multiply4x4(TEMP[1], TEMP[0], CONST_byIndex(TEMP[7].x)); // vrt * bone matrix 0
multiply4x4(TEMP[2], TEMP[0], CONST_byIndex(TEMP[7].y)); // vrt * bone matrix 1
multiply4x4(TEMP[3], TEMP[0], CONST_byIndex(TEMP[7].z)); // vrt * bone matrix 2
multiply4x4(TEMP[4], TEMP[0], CONST_byIndex(TEMP[7].w)); // vrt * bone matrix 3

multiply(TEMP[1], TEMP[1], TEMP[6].x); // * weight 0
multiply(TEMP[2], TEMP[2], TEMP[6].y); // * weight 1
multiply(TEMP[3], TEMP[3], TEMP[6].z); // * weight 2
multiply(TEMP[4], TEMP[4], TEMP[6].w); // * weight 3

add(TEMP[1], TEMP[1], TEMP[2]); // TEMP[1] = vrt * bone matrix 0 * weight 0 + vrt * bone matrix 1 * weight 1
add(TEMP[1], TEMP[1], TEMP[3]); // + vrt * bone matrix 2 * weight 2
add(TEMP[1], TEMP[1], TEMP[4]); // + vrt * bone matrix 3 * weight 3

Mix command arguments

Hi Saharan, amazing work, i spent ages looking for something like OGSL. Very happy to have found your excellent project.
I had a crash with the mix command "incorrect number of arguments in calling function mix: expected 2 but given 3"
So I changed in OGSL in analyzeMain()

addBuiltInFunction(OGSLConstants.BUILT_IN_MIX, 2);
to
addBuiltInFunction(OGSLConstants.BUILT_IN_MIX, 3);

works like a charm, i thought I should let you know.
You did a real good work, thanks for making your work available

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.