Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
node.addComponent(transform);
/* Create and load texture. */
const texture = new Texture2D(this._context, 'Texture');
texture.initialize(1, 1, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE);
texture.fetch('./data/concrete_floor_02_diff_1k.webp', false).then(() => {
this.invalidate(true);
});
/* Create material */
const material = new SceneExampleMaterial(this._context, 'ExampleMaterial1');
material.texture = texture;
material.textured = true;
/* Create geometry. */
const geometry = new GeosphereGeometry(
this._context,
'mesh',
1.0,
true);
geometry.initialize(this._aMeshVertex, this._aMeshTexCoord);
const sphere = new GeometryComponent();
sphere.geometry = geometry;
sphere.material = material;
node.addComponent(sphere);
return node;
}
node.addComponent(transform);
/* Create and load texture. */
const texture = new Texture2D(this._context, 'Texture');
texture.initialize(1, 1, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE);
texture.fetch('./data/concrete_floor_02_diff_1k.webp', false).then(() => {
this.invalidate(true);
});
/* Create material */
const material = new SceneExampleMaterial(this._context, 'ExampleMaterial1');
material.texture = texture;
material.textured = true;
/* Create geometry. */
const geometry = new GeosphereGeometry(
this._context,
'mesh',
1.0,
true);
geometry.initialize(this._aMeshVertex, this._aMeshTexCoord);
const sphere = new GeometryComponent();
sphere.geometry = geometry;
sphere.material = material;
node.addComponent(sphere);
return node;
}
protected generateSphere2Node(parent: SceneNode): SceneNode {
/* Create node and transform */
const node = parent.addNode(new SceneNode('mesh'));
const translate = mat4.fromTranslation(mat4.create(), vec3.fromValues(1.0, 0.0, 0.0));
const scale = mat4.fromScaling(mat4.create(), vec3.fromValues(0.4, 0.4, 0.4));
const transformMatrix = mat4.multiply(mat4.create(), translate, scale);
const transform = new TransformComponent(transformMatrix);
node.addComponent(transform);
/* Create material */
const material = new SceneExampleMaterial(this._context, 'ExampleMaterial2');
material.textured = false;
/* Create geometry. */
const geometry = new GeosphereGeometry(
this._context,
'mesh',
1.0,
true);
geometry.initialize(this._aMeshVertex, this._aMeshTexCoord);
const sphere = new GeometryComponent();
sphere.geometry = geometry;
sphere.material = material;
node.addComponent(sphere);
return node;
}
protected generateSphere2Node(parent: SceneNode): SceneNode {
/* Create node and transform */
const node = parent.addNode(new SceneNode('mesh'));
const translate = mat4.fromTranslation(mat4.create(), vec3.fromValues(1.0, 0.0, 0.0));
const scale = mat4.fromScaling(mat4.create(), vec3.fromValues(0.4, 0.4, 0.4));
const transformMatrix = mat4.multiply(mat4.create(), translate, scale);
const transform = new TransformComponent(transformMatrix);
node.addComponent(transform);
/* Create material */
const material = new SceneExampleMaterial(this._context, 'ExampleMaterial2');
material.textured = false;
/* Create geometry. */
const geometry = new GeosphereGeometry(
this._context,
'mesh',
1.0,
true);
geometry.initialize(this._aMeshVertex, this._aMeshTexCoord);
const sphere = new GeometryComponent();
sphere.geometry = geometry;
sphere.material = material;
node.addComponent(sphere);
return node;
}
mouseEventProvider: MouseEventProvider,
/* keyEventProvider: KeyEventProvider, */
/* touchEventProvider: TouchEventProvider */): boolean {
this._promises = new Array();
this.showSpinner();
this._isLoaded = false;
this._defaultFBO = new DefaultFramebuffer(context, 'DefaultFBO');
this._defaultFBO.initialize();
this._defaultFBO.bind();
const gl = context.gl;
this._sphere = new GeosphereGeometry(context, 'Sphere');
this._sphere.initialize();
const vert = new Shader(context, gl.VERTEX_SHADER, 'mesh.vert');
vert.initialize(require('./data/mesh.vert'));
const frag = new Shader(context, gl.FRAGMENT_SHADER, 'imagebasedlighting.frag');
frag.initialize(require('./data/imagebasedlighting.frag'));
this._program = new Program(context, 'CubeProgram');
this._program.initialize([vert, frag], false);
this._program.attribute('a_vertex', this._sphere.vertexLocation);
this._program.attribute('a_texCoord', this._sphere.texCoordLocation);
this._program.link();
this._program.bind();
this._uViewProjection = this._program.uniform('u_viewProjection');