Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libgdx decalbatch particles alpha #2

Open
klaszlo8207 opened this issue Mar 24, 2018 · 1 comment
Open

Libgdx decalbatch particles alpha #2

klaszlo8207 opened this issue Mar 24, 2018 · 1 comment

Comments

@klaszlo8207
Copy link

klaszlo8207 commented Mar 24, 2018

How can I use this library to create some 3d decal and change the alphas invidually?
Can you show some code for this?

Thanks,
Leslie

@cypherdare
Copy link
Contributor

You can look at the parts of FlexBatchTest pertaining to Quad3D for an example of usage.

Your question makes me realize I didn't include getColor(), getAlpha(), or setAlpha() methods on the Quad class. So until I add that, you'll need to subclass Quad3D. The RGBA color is stored in a protected 32 bit float. You can add a TMP static final Color object for extracting the values. Then you can add methods like this:

public Color getColor (){
    Color.abgr8888ToColor(TMP, color);
    return TMP;
}

public float getAlpha (){
    return getColor().a;
}

public void setAlpha (float alpha){
    Color.abgr8888ToColor(TMP, color);
    TMP.a = alpha;
    color(TMP);
}

Or if you're not modifying RGB of your decals, you can simply set alpha on a Quad3D like this:

quad3d.color(1, 1, 1, alpha);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants