Comments (5)
Hello.
I just pushed a fix for the actual error, but I'm not sure if you'll be able to re-create your object from JSON. StandardAnimationMaterial (and the other animation materials) all have some extended logic which is not stored in the JSON.
Also, JSON loader has been deprecated. How are you loading / parsing your JSON files?
from three.bas.
actually I just want to parse the toJSON() Object as a string to compare two instances and debug another error I am currently dealing with. Maybe the error might be related to this.
I am trying to clone the mesh to place it multiple times in my scene at different positions. But if I clone the mesh using the StandardAnimationMaterial(), somehow the shadows break. I also tried to add a new customDepthMaterial to the cloned Mesh, but without success.
Further debugging lead me to the point where I wanted to clone only a BasicAnimationMaterial and here it says:
Uncaught TypeError: Cannot read property 'uniformValues' of undefined
from three.bas.
I'm not used to the cloning workflow, so I've never tested it, and I'm not sure what kind of things might break because I don't implement the clone/copy methods on any of the BAS geometries and materials (they just use the method from the THREE.js class they're extending). I can look into adding clone/copy methods, but that may take some time.
If you want to create several meshes, you might be better off either creating a mesh subclass with the geometry and material (like Animation here, and creating instances of that, or working with a factory function.
from three.bas.
I can look into adding clone/copy methods, but that may take some time.
Don't worry, thanks for all your work on this anyway, very helpful to inject built-in THREE Shaders :).
If you want to create several meshes, you might be better off either creating a mesh subclass with the geometry and material (like Animation here, and creating instances of that, or working with a factory function.
The Subclass thing might be an option and actually is kind of close to the way I work around the problem at the moment. I simply create a new THREE.Mesh() Instance each time I used to clone instead. What do you mean by factory function?
from three.bas.
A factory function is just a (pure) function that takes arguments, and returns an object / class instance. Depending on your use case, it can be cleaner than extending Mesh.
Something like:
function createMesh (options) {
const material = new StandardAnimationMaterial({
// defaults + material specific options
}
const geometry = new PrefabBufferGeometry(
// prefab, prefab count
)
const mesh = new Mesh(geometry, material)
return mesh
}
https://en.wikipedia.org/wiki/Factory_method_pattern
This may be what you are already doing though :).
from three.bas.
Related Issues (20)
- Help HOT 3
- Text Animations HOT 1
- Prefab Geometry vs. Instanced Geometry HOT 3
- DepthAnimationMaterial: Problem casting shadows taking alpha into account HOT 9
- Using a normalMap uniformValue along with ToonAnimationMaterial causes shader compile error HOT 5
- PhongAnimationMaterial fragmentSpecular incorrect order? HOT 1
- fragment rendering errors for PrefabBufferGeometry + PhongAnimationMaterial
- Can you support the latest version?Version 109 HOT 1
- Can prefab cast a shadow on other prefabs within one mesh? HOT 2
- Issue working with gsap 3 HOT 2
- Updates for latest r125 HOT 4
- Shader compatibility regarding past examples and newer versions of THREE
- Is this library still supported? HOT 6
- How can I custom texture in Three.bas
- Compatibility with bufferGeometry HOT 2
- Documentation site is down. HOT 2
- Have geometry always face the camera?
- Is it possible for Three.bas to work with the [react-three-fiber] package?
- Most examples are broken on the examples site HOT 3
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 three.bas.