Commit Graph

172 Commits

Author SHA1 Message Date
Janusz Bossy 4251c8491c Changes `var` to `const` 2020-07-07 15:53:23 +02:00
Janusz Bossy 573cdc244f Adds texture overrides for independent materials
Allows passing a `materialOverrides` option to the `loadMtl` function.
When generating a new material parsed from the `.mtl` file the overrides
that are specific to this material are applied first before the global
material overrides already existing in the code. This allows the users
to specify different set of materials to override for a model. Following
is an example value for the `materialOverrides` key:

```
{
  "material1Name": {
    "alphaTexture": "path_to_the_texture_file",
    "ambientTexture": "path_to_the_texture_file",
    "diffuseTexture": "path_to_the_texture_file",
    "emissiveTexture": "path_to_the_texture_file",
    "normalTexture": "path_to_the_texture_file",
    "specularTexture": "path_to_the_texture_file",
    "specularShininessTexture": "path_to_the_texture_file",
  }
}
```

It's possible to define more than one material override. If the `.mtl`
file has materials that were not provided in the `materialOverrides`
option they are loaded from the `.mtl` file without any overrides.
2020-07-07 15:45:28 +02:00
Sean Lilley dd163b77bd
Merge branch 'master' into absolute-paths 2019-10-29 13:59:34 -04:00
Sean Lilley b14a883f95
Merge branch 'master' into fix-texture-sharing 2019-10-29 13:51:19 -04:00
Sean Lilley ff26d5d0ae eslint fixes 2019-10-27 15:28:30 -04:00
Sean Lilley e7bd6d6461 Check for incomplete attributes 2019-10-27 15:00:35 -04:00
Sean Lilley c43fa01a12
Merge branch 'master' into fix-texture-sharing 2019-10-26 20:52:22 -04:00
Sean Lilley f399e82b9d Handle absolute paths properly 2019-10-26 20:42:12 -04:00
Sean Lilley 52ce2938f5 Merge branch 'master' into missing-attributes 2019-10-26 20:17:31 -04:00
Sean Lilley f502b805b8 Handle face signature containing attributes that are missing 2019-10-26 20:15:10 -04:00
Sean Lilley d912e28571 Fix for when specular and diffuse reference the same texture 2019-10-26 20:07:29 -04:00
Sean Lilley fd6e98688d Fix default value in doc 2019-08-26 07:56:03 -04:00
Jesse Vander Does a1b1860da2 Fixed code styling 2019-08-20 10:32:32 -07:00
Jesse Vander Does 876cbefe74 Restored lost code and fixed tests 2019-08-19 16:33:12 -07:00
Sean Lilley 3cf338107d Added up axis options back 2019-08-19 11:01:36 -07:00
Sean Lilley 080f5debf7 Revert some changes from diffuse-alpha-same 2019-07-22 18:39:30 -04:00
Tom Fili 3ba174dd33 Removed unneeded code 2019-07-19 21:03:33 -04:00
Tom Fili 0fa1ec528d Made alpha images work if same as diffuse 2019-07-19 14:52:12 -04:00
Tom Fili b913b0fa5f Added a check to see if diffuse and alpha texture is the same. 2019-07-19 13:07:34 -04:00
Tom Fili abddf4bda4 Merge remote-tracking branch 'origin/master' into fix-negative-indices 2019-06-26 13:57:50 -04:00
Sean Lilley 243f747281 Fix eslint and update node modules 2019-06-22 06:54:09 -04:00
Sean Lilley 2fb661c8cf Fix negative indices 2019-04-07 17:31:22 -04:00
Sean Lilley 73205a874b Don't let separate resources exceed Node buffer size limit 2019-03-19 21:25:42 -04:00
Sean Lilley d979a93745 Merge branch 'master' into newmtl-without-name 2019-02-10 09:45:46 -05:00
Sean Lilley 075beb60d4 var to let/const 2019-02-05 22:03:42 -05:00
Sean Lilley ed54251fec Fix parsing mtl with newmtl without a name 2019-01-03 20:51:39 -05:00
Omar Shehata 56a06eee2d Error if use mutiple material types 2018-12-04 15:05:00 -05:00
Omar Shehata 7e9a7a87b8 Cleanup 2018-12-04 14:34:04 -05:00
Sean Lilley b5da7be229 Merge branch 'master' into unlit 2018-11-24 17:04:09 -05:00
Sean Lilley 5d522daaa8
Merge branch 'master' into material-duplication 2018-11-01 18:43:11 -04:00
Sean Lilley eaca567a25 Updates 2018-10-31 21:12:25 -04:00
Sean Lilley 9cc1ba8ec5 Split incompatible materials 2018-10-29 18:19:55 -04:00
Sean Lilley b3d5407a26 Don't discard primitives that don't match the attribute layout 2018-10-17 21:42:28 -04:00
Sean Lilley 1426d0e43d Update triangulation algorithm 2018-10-11 16:58:54 -04:00
Sean Lilley ce1591c860 Clear vertex cache too 2018-10-11 13:20:50 -04:00
Sean Lilley a87087b0dd Reset vertex count properly 2018-10-10 18:37:52 -04:00
Sean Lilley 30bf9095fa Discard faces that don't have the same attributes 2018-08-30 23:37:03 -04:00
Sean Lilley 0c897a6847 Only assign default material if obj file doesn't call usemtl 2018-08-30 23:04:45 -04:00
Omar Shehata a8dc3ccc23 Fixed linting 2018-08-30 16:02:54 -04:00
Omar Shehata e8fc8ab04e Replaced materialsCommon with unlit 2018-08-30 15:55:32 -04:00
Sean Lilley 574d06db2b Adding position, normals, and uvs to primitive level rather than mesh level 2018-08-30 15:24:34 -04:00
Sean Lilley 26db16d892 Fixed normalizing Windows paths 2018-08-30 12:08:12 -04:00
Sean Lilley af2e6aa43e
Merge branch 'master' into missing-usemtl 2018-03-21 10:21:29 -04:00
Sean Lilley 7d934503ad Normalize normals 2018-03-20 22:38:37 -04:00
Sean Lilley 5730d2371f Set default material if usemtl is missing 2018-03-06 19:22:06 -05:00
Sean Lilley 1140e50987 Merge branch 'master' into diffuse-ambient 2018-01-29 09:28:55 -05:00
Sean Lilley 902e877eca Ignore ambient texture if it is the same as the diffuse texture 2018-01-19 11:02:14 -05:00
Sean Lilley 378479b8f1 Added alpha texture support 2018-01-03 21:01:10 -05:00
Sean Lilley 400dc3227b Better usemtl handling 2017-12-28 16:17:24 -05:00
Sean Lilley 1bebb590ef Updated to version 2.1.0 2017-12-28 14:34:30 -05:00