Janusz Bossy
b056b84ec6
Fixes errors when `materialOverrides` is not passed to `loadMtl`
2020-07-07 15:58:29 +02:00
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
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
d912e28571
Fix for when specular and diffuse reference the same texture
2019-10-26 20:07:29 -04: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
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
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
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
26db16d892
Fixed normalizing Windows paths
2018-08-30 12:08:12 -04: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
likangning93
365efa10fd
Merge pull request #117 from AnalyticalGraphicsInc/resources-in-root
...
Attempt to load missing resources by looking in the same directory as the obj
2017-12-28 13:19:52 -05:00
Sean Lilley
e2db0ac59d
More accurate error messages
2017-12-21 22:23:28 -05:00
Sean Lilley
57a95a6623
Try to load files in root directory when secure is true
2017-11-29 14:21:59 -05:00
Sean Lilley
2c21105d38
Attempt to load missing resources by looking in the same directory as the obj
2017-11-17 15:11:59 -05:00
Sean Lilley
4b85d87655
Switched texture loading order so diffuse is always first
2017-11-07 09:20:42 -05:00
Tim Knip
bdebfeadee
proper indent
2017-10-10 15:06:45 +02:00
Tim Knip
fab88cfdfa
remove texture options from texture name
2017-10-10 13:23:09 +02:00
Tim Knip
3e41cdc7f6
Fix texture options ending up in texture filename #109
...
This happens when in `*.mtl` a relative texture path does not have a
`./` prefix.
eg: map_bump -bm 0.1 foo.jpg
2017-10-02 01:52:31 +02:00
Tim Knip
3cff129933
fixing merge conflict #109
2017-09-29 20:21:02 +02:00
Tim Knip
3ec919e9c4
better regexp for #109
2017-09-29 20:16:55 +02:00
Tim Knip
ac756bed05
fix texture paths and parse texture map options
...
When the mtl has statements like ```map_Bump -bm 0.2 ./foo.jpg``` then
the options end up in the texture path.
eg: ```./-bm 0.2/foo.jpg```.
This commit fixes the path and parses the options.
2017-09-29 19:31:14 +02:00
Tim Knip
c18f8c49eb
fix texture paths and parse texture map options
...
When the mtl has statements like `map_Bump -bm 0.2 ./foo.jpg` then
the options end up in the texture path.
eg: `/bar/-bm 0.2/foo.jpg`.
This commit fixes the path and parses the options.
2017-09-29 19:26:51 +02:00
Sean Lilley
3c5f055182
Constant lighting added back to materialsCommon
2017-09-21 10:40:44 -04:00
Sean Lilley
e36668ab14
Treat alpha of 0 as 1
2017-09-19 11:59:51 -04:00
Sean Lilley
b2e4fb6deb
Add doc
2017-08-11 12:01:23 -04:00
Sean Lilley
60a080be46
Reorganization of material loading and returning buffer rather than writing file
2017-08-08 15:09:00 -04:00
Sean Lilley
3da691df62
Cleanup overriding images
2017-07-28 17:01:45 -04:00
Sean Lilley
df20748d60
Merge branch 'master' into gltf-2.0
2017-07-17 14:38:20 -04:00
Sean Lilley
86c604826c
Treat alpha as 1.0 - Tr
2017-05-18 09:32:06 -04:00
Sean Lilley
c2af8f5098
Tests
2017-05-10 13:10:59 -04:00
Sean Lilley
c9ad66fcdb
Add metallicRoughness and specularGlosiness output
2017-05-04 14:25:08 -04:00
Sean Lilley
ce5221c80a
2.0
2017-04-19 17:53:10 -04:00
Sean Lilley
37febbcd93
Renaming files
2017-04-12 16:55:03 -04:00