≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Copying one meshes to another.
Posted by:
(you are not logged in)
Enter the missing letter in: "I?ternational"
(you are not logged in)
Text:
[quote][b][/b] wrote: If you assign the vertices like the one above, then both point to the same array, meaning that if you change one, the other one also changes, because it is actually the same, yes :) You are right, when calling MeshBuffer::createClone(), a new array is created, but actually the same vertices are used. Will be fixed in the new release (about two weeks away). You can fix this yourself, by adding this code and overwriting the wrong implementation in the meantime: [code]CL3D.MeshBuffer.prototype.createClone = function() { var ret = new CL3D.MeshBuffer(); ret.Box = this.Box.clone(); ret.Mat = this.Mat.clone(); if (this.Vertices) { for (var i=0; i<this.Vertices.length; ++i) { var v = new CL3D.Vertex3D(); var vold = this.Vertices[i]; v.Pos = vold.Pos.clone(); v.Normal = vold.Normal.clone(); v.Color = vold.Color; v.TCoords = new CL3D.Vect2d(vold.TCoords.x, vold.TCoords.y); v.TCoords2 = new CL3D.Vect2d(vold.TCoords2.x, vold.TCoords2.y); ret.Vertices.push(v); } } if (this.Indices) { for (var i=0; i<this.Indices.length; ++i) ret.Indices.push(this.Indices[i]); } if (this.Tangents) { for (var i=0; i<this.Tangents.length; ++i) ret.Tangents.push(this.Tangents[i]); } if (this.Binormals) { for (var i=0; i<this.Binormals.length; ++i) ret.Binormals.push(this.Binormals[i]); } return ret; }[/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact