JuanCarlosAragon / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

GeometryBatchFactory should use Material.equals() #336

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create two identical materials and assign them to geoemtries
2. Try to batch the geometries
3. It will fail because material1 != material2

What is the expected output? What do you see instead?
I expect the material equality to be checked based on parameter values, not 
based on reference.

Original issue reported on code.google.com by ShadowIs...@gmail.com on 20 Apr 2011 at 12:33

GoogleCodeExporter commented 8 years ago
Hi, first time poster/contributor :).

The problem occurs because GeometryBatchFactory uses a HashMap to combine 
geometries with the same Materials. Material doesn't have an overrided 
hashCode() method, so all HashMap does is compare references.

The question is whether changing this this is a good idea. A batched Geometry 
with duplicate materials means that if one material is changed later on, the 
other won't be. Keeping it the way it is could discourage bad practice.

Original comment by whizoma...@gmail.com on 24 Apr 2011 at 1:12

GoogleCodeExporter commented 8 years ago

Original comment by ShadowIs...@gmail.com on 1 Jun 2012 at 10:41