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

Pass uniforms to material constructor #1185

Closed
1 of 2 tasks
pjcozzi opened this issue Sep 25, 2013 · 5 comments
Closed
1 of 2 tasks

Pass uniforms to material constructor #1185

pjcozzi opened this issue Sep 25, 2013 · 5 comments
Assignees
Labels
cleanup good first issue An opportunity for first time contributors

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 25, 2013

Low-hanging fruit...

  • Part 1

Instead of writing

var polygon = new Polygon();
polygon.material = Material.fromType('Color');
polygon.material.uniforms.color = {
  red : 1.0,
  green : 1.0,
  blue : 0.0
  alpha : 1.0
};
primitives.add(polygon);

I want to be able to pass my overrides for the default uniform values to fromType

var polygon = new Polygon();
polygon.material = Material.fromType('Color', { 
  color : {
    red : 1.0,
    green : 1.0,
    blue : 0.0
    alpha : 1.0
  }
});
primitives.add(polygon);

So that I can construct polygon in one line without needing an instance:

primitives.add(new Polygon({
  material : Material.fromType('Color', { 
    color : {
      red : 1.0,
      green : 1.0,
      blue : 0.0
      alpha : 1.0
    }
  })
}));
  • Part 2

(Part of #640). Replace Material.fromType with a new property in the object literal passed to the Material constructor.

new Material({
  type : 'Color',
  uniforms : {
    color : {
      red : 1.0,
      green : 1.0,
      blue : 0.0
      alpha : 1.0
     }
  }
});

Here type is used to indicate a known material type, as opposed to fabric which allows the entire Fabric JSON.

Add tests and update the Sandcastle examples.

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Sep 25, 2013

We can also consider basically swamping the current constructor and fromType (and renaming it to fromFabric).

@AnandDhoot
Copy link

Hi,
I would like to take up this issue. I have just downloaded and built the codebase on my machine.
Request your guidance on how to proceed on my first bug fix!
Thank you

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Mar 6, 2015

Thanks for the interest, @AnandDhoot. This issue is not very high priority right now. May I suggest you consider #1670?

@AnandDhoot
Copy link

Sure! Thanks for your reply.

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Jun 14, 2017

Insufficient priority.

@pjcozzi pjcozzi closed this as completed Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup good first issue An opportunity for first time contributors
Projects
None yet
Development

No branches or pull requests

2 participants