Comments (5)
I'll take a look and get back with you! Thanks!
from webgl-obj-loader.
I've never used AMD before, so I'm still learning, but I've found a couple of things that work.
- Using
require()
works. E.g.const OBJ = require("webgl-obj-loader")
- Based on these docs, you must include a relative path along with file extensions. I got this to work:
import * as OBJ from "./node_modules/webgl-obj-loader/dist/index";
from webgl-obj-loader.
CommonJS works fine for creating "bundle.min.js". I need AMD for publish on Plunker Playground. For example, my sample uses "gl-matrix" to transform (scale, rotation, position) a triangle: https://next.plnkr.co/edit/PkqSZGwhv9zKSnUNSiXo?preview
If glMatrix works then webgl-obj-loader should work too...
from webgl-obj-loader.
That's a good point. I'll keep digging.
from webgl-obj-loader.
I was able to get the linked Plunkr to work by using this require config:
requirejs.config({
baseUrl: ".",
paths: {
"gl-matrix": "https://cdnjs.cloudflare.com/ajax/libs/gl-matrix/2.8.1/gl-matrix-min",
"webgl-obj-loader": "https://cdn.jsdelivr.net/npm/[email protected]/dist/webgl-obj-loader.min"
}
});
and this import
import * as OBJ from "webgl-obj-loader";
console.log(OBJ);
I updated the output of the UMD to not define a name (requireJS would only work for import OBJ from "OBJ";
) and instead exported an OBJ
object from the main output so that it was backward compatible with regular browser-based inclusion. This is released as version 2.0.7
on NPM.
I was never able to figure out why running TS locally with amd
and the import
wasn't working, but const OBJ = require("webgl-obj-loader")
is definitely working, so I'd suggest doing that for things outside of plunkr.
from webgl-obj-loader.
Related Issues (20)
- Documentation / Example for materials HOT 3
- Add support for calculating tangents and bitangents HOT 1
- development example dosen't work well. HOT 1
- Texture bug HOT 1
- version is undefined and OBJ is undefined HOT 2
- UV layout, error in the code. HOT 2
- Missing TypeScript header file HOT 4
- Add submesh support HOT 2
- Clarify attribute indexing documentation HOT 5
- Update triangulate() to provide a better triangulation algorithm
- error HOT 3
- 'window' is not defined in node.js HOT 4
- I get "" in filename on the sponza HOT 2
- Wrong parsing when faces is quade with uv HOT 2
- Write better tests for triangulation HOT 1
- Layout.SPECULAR_EXPONENT Attribute size
- DownloadModels() use. HOT 3
- how do I load a model in webgl2 with multiple material/objects?
- Threejs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webgl-obj-loader.