x3dom / component-editor

A simple 3D component editor, based on X3DOM
Other
79 stars 30 forks source link

import x3d #10

Open zorgglubb opened 5 years ago

zorgglubb commented 5 years ago

Hi, I read the code and i dont know how import x3d with texture as element. It is possible?

Tx

zorgglubb commented 5 years ago

hi i have this error x3dom-full.debug.js:51530 Uncaught TypeError: Cannot read property 'x' of undefined at x3dom.registerNodeType.defineClass.nodeChanged.nodeChanged (x3dom-full.debug.js:51530) at x3dom.NodeNameSpace.setupTree (x3dom-full.debug.js:27428) at x3dom-full.debug.js:27422 at Function.Array.forEach (x3dom-full.debug.js:35) at x3dom.NodeNameSpace.setupTree (x3dom-full.debug.js:27421) at x3dom-full.debug.js:27422 at Function.Array.forEach (x3dom-full.debug.js:35) at x3dom.NodeNameSpace.setupTree (x3dom-full.debug.js:27421) at HTMLUnknownElement.onNodeInserted (x3dom-full.debug.js:10530) at EditorScene.Group.addChild (Group.js:46) nodeChanged @ x3dom-full.debug.js:51530 x3dom.NodeNameSpace.setupTree @ x3dom-full.debug.js:27428 (anonymous) @ x3dom-full.debug.js:27422 Array.forEach @ x3dom-full.debug.js:35 x3dom.NodeNameSpace.setupTree @ x3dom-full.debug.js:27421 (anonymous) @ x3dom-full.debug.js:27422 Array.forEach @ x3dom-full.debug.js:35 x3dom.NodeNameSpace.setupTree @ x3dom-full.debug.js:27421 onNodeInserted @ x3dom-full.debug.js:10530 Group.addChild @ Group.js:46 EditorScene.addSceneObject @ EditorScene.js:115 EditorScene.addNewPrimitive @ EditorScene.js:31 divID.onclick @ VM1189:52 when i put x3d in primitive. `function xx3d() { Primitive.call(this); this.createFromDescription( g_editor.primitiveParameterMap[g_editor.primitiveNamesMap[this.constructor.name]]);

//create x3d

var shaftShape   = document.createElement('Shape');

var appearance = document.createElement('Appearance');
var ImageTexture = document.createElement('ImageTexture');
ImageTexture.setAttribute('url', "aaa.jpg");
appearance.appendChild(ImageTexture);
shaftShape.appendChild(appearance);

var IndexedFaceSet = document.createElement('IndexedFaceSet');
    IndexedFaceSet.setAttribute('coordIndex', '0 1 2 -1 2 1 ....etc
    IndexedFaceSet.setAttribute('solid','false');
IndexedFaceSet.setAttribute('isPickable','true');
var Coordinate = document.createElement('Coordinate');
Coordinate.setAttribute('point', '-1.07365 0.469978 3.` ....etc

IndexedFaceSet.appendChild(Coordinate); var TextureCoordinate = document.createElement('TextureCoordinate'); TextureCoordinate.setAttribute('point', '0.91419...etc IndexedFaceSet.appendChild(TextureCoordinate); shaftShape.appendChild(IndexedFaceSet); this._matrixTransformNode.appendChild(shaftShape); };`