API: Plain Three 1.0 (Deprecated)

API Uses canvas Graphics libraries AB framework Worlds using this API Starter Worlds
Plain Three 1.0 (Deprecated) Yes Three.js No 0 Worlds Starter Worlds


This API is for Three.js Worlds. It has no Ancient Brain framework. Anything written in Three.js should run using this API without change.

This API has the following features:

  • Includes Three.js release 80.
  • Includes the following libraries for loading 3D models:
  • Includes jQuery 1.12.4.

  • No Ancient Brain framework.
  • World has to do everything. It has to make its own canvas. It has to do its own camera control.
  • Run header on RHS. Many JS worlds use fixed small dimension canvas, which will go in top LHS. So this API puts run header on RHS.
  • If World uses Minds, World author must call the Mind themselves:
     ABRun.mind.getAction ( state );  

Related APIs



Optional: The "ABWorld" object

This API defines the following "ABWorld" global variable. World authors can ignore the existence of ABWorld entirely.
 

	ABWorld;                 // instance of class ABWorldClass  
 
// Data and methods of ABWorld:
 
	ABWorld.canvas;          // to point to the canvas  		
 
	// useful functions for creating/resizing canvas:

	ABWorld.fullwidth();     // return full width of window on desktop / screen on mobile 
	ABWorld.fullheight();    // return full height of window on desktop / screen on mobile

The AB system will find the canvas automatically (e.g. when it needs to do a screenshot). If the AB system fails to find the canvas, you can help it out by assigning the canvas to ABWorld.canvas.


Optional: Set preserveDrawingBuffer for better performance

This API uses an edited version of Three.js with the THREE.WebGLRenderer property "preserveDrawingBuffer" set to true. This is needed to allow the site generate a World image screenshot from the canvas. This may lead to lower performance, though.

If you are concerned about performance, you can set preserveDrawingBuffer to be false:

 
  renderer = new THREE.WebGLRenderer ( { preserveDrawingBuffer: false } );
But then your World cannot have a screenshot. So a better approach is to set it to true for "generate image" runs and false for normal runs, which can be done as follows:
 
 if ( AB.isScreenshotRun() ) renderer = new THREE.WebGLRenderer ( { preserveDrawingBuffer : true } );
 else                        renderer = new THREE.WebGLRenderer ( { preserveDrawingBuffer : false } );

Templates


Examples

Examples of Worlds that use this API:


No Starter Worlds found.


The background is a program, showing the JavaScript graphics used on this site.
 
Font:

© Ancient Brain Ltd. All rights reserved.

Ancient Brain ™ is a trademark of Ancient Brain Ltd.

Beta      Bug bounty      Contact      Stats      The name      Terms and conditions