How to use the cesium.Matrix3 function in cesium

To help you get started, we’ve selected a few cesium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrincessGod / objTo3d-tiles / lib / loadObj.js View on Github external
var Cesium = require('cesium');
var path = require('path');
var Promise = require('bluebird');

var ArrayStorage = require('./ArrayStorage');
var loadMtl = require('./loadMtl');
var outsideDirectory = require('./outsideDirectory');
var readLines = require('./readLines');

var Cartesian2 = Cesium.Cartesian2;
var Cartesian3 = Cesium.Cartesian3;
var ComponentDatatype = Cesium.ComponentDatatype;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var IntersectionTests = Cesium.IntersectionTests;
var Matrix3 = Cesium.Matrix3;
var OrientedBoundingBox = Cesium.OrientedBoundingBox;
var Plane = Cesium.Plane;
var PolygonPipeline = Cesium.PolygonPipeline;
var Ray = Cesium.Ray;
var RuntimeError = Cesium.RuntimeError;
var WindingOrder = Cesium.WindingOrder;

module.exports = loadObj;

// Object name (o) -> node
// Group name (g) -> mesh
// Material name (usemtl) -> primitive

function Node() {
    this.name = undefined;
    this.meshes = [];
github AnalyticalGraphicsInc / 3d-tiles-tools / validator / lib / validateTileset.js View on Github external
var Promise = require('bluebird');
var Cesium = require('cesium');
var path = require('path');
var isTile = require('../lib/isTile');
var readTile = require('../lib/readTile');
var readTileset = require('../lib/readTileset');
var utility = require('../lib/utility');
var validateTile = require('../lib/validateTile');

var regionInsideRegion = utility.regionInsideRegion;
var sphereInsideSphere = utility.sphereInsideSphere;
var boxInsideBox = utility.boxInsideBox;
var boxInsideSphere = utility.boxInsideSphere;
var Matrix4 = Cesium.Matrix4;
var Cartesian3 = Cesium.Cartesian3;
var Matrix3 = Cesium.Matrix3;
var sphereInsideBox = utility.sphereInsideBox;
var defined = Cesium.defined;

module.exports = validateTileset;

/**
 * Check if a tileset is valid, including the tileset JSON and all tiles referenced within.
 *
 * @param {Object} tileset The tileset JSON.
 * @param {String} tilesetDirectory The directory that all paths in the tileset JSON are relative to.
 * @return {Promise} A promise that resolves when the validation completes. If the validation fails, the promise will resolve to an error message.
 */
function validateTileset(tileset, tilesetDirectory) {
    var message = validateTopLevel(tileset);
    if (defined(message)) {
        return Promise.resolve(message);
github PrincessGod / objTo3d-tiles / lib / obj2Tileset.js View on Github external
'use strict';
var path = require('path');
var Cesium = require('cesium');
var createSingleTileset = require('./createSingleTileset');
var tilesetOptionsUtility = require('./tilesetOptionsUtility');
var obj2B3dm = require('./obj2B3dm');
var obj2I3dm = require('./obj2I3dm');
var Cartesian3 = Cesium.Cartesian3;
var Matrix3 = Cesium.Matrix3;
var CMath = Cesium.Math;

var defaultValue = Cesium.defaultValue;
var getPoint3MinMax = tilesetOptionsUtility.getPoint3MinMax;

module.exports = obj2Tileset;

function obj2Tileset(objPath, outputpath, options) {
    var folder = path.dirname(outputpath);
    var tileFullName = path.basename(outputpath);
    var folderPrifix = options.b3dm ? 'Batched' : 'Instanced';
    var tilesetFolderName = folderPrifix + path.basename(objPath, '.obj');
    var tilePath = path.join(folder, tilesetFolderName, tileFullName);
    var tilesetPath = path.join(folder, tilesetFolderName, 'tileset.json');
    var tilesetOptions = options.tilesetOptions || {};
    if (options.b3dm) {
github AnalyticalGraphicsInc / gltf-pipeline / lib / packArray.js View on Github external
'use strict';
var Cesium = require('cesium');
var Cartesian2 = Cesium.Cartesian2;
var Cartesian3 = Cesium.Cartesian3;
var Cartesian4 = Cesium.Cartesian4;
var Matrix2 = Cesium.Matrix2;
var Matrix3 = Cesium.Matrix3;
var Matrix4 = Cesium.Matrix4;
var WebGLConstants = Cesium.WebGLConstants;

module.exports = packArray;

/**
 * Packs Cesium types into an array of values.
 *
 * @param {Array} data An array of Cesium types to pack.
 * @param {Number|String} type The WebGL type to use for packing (e.g. WebGLConstants.FLOAT_VEC3 for Cartesian3), or a glTF accessor type (e.g. 'SCALAR', 'VEC3')
 * @returns {Array} An array containing the packed data.
 */
function packArray(data, type) {
    var length = data.length;
    var packFunction;
    var packedLength;
github PrincessGod / objTo3d-tiles / lib / obj2I3dm.js View on Github external
'use strict';

var Cesium = require('cesium');

var createI3dm = require('./createI3dm');
var obj2gltf = require('./obj2gltf');
var defaultValue = Cesium.defaultValue;
var Cartesian3 = Cesium.Cartesian3;
var Matrix3 = Cesium.Matrix3;
var CMath = Cesium.Math;

module.exports = obj2I3dm;

var sizeOfUint8 = 1;
var sizeOfUint16 = 2;
var sizeOfUint32 = 4;
var sizeOfFloat32 = 4;

/**
 * Convert obj file to i3dm with custon FeatureTable and BatchTable.
 * 
 * @param {String} objPath The obj file path. 
 * @param {Object} options Optional parameters.
 */
function obj2I3dm(objPath, options){
github AnalyticalGraphicsInc / gltf-pipeline / lib / readAccessor.js View on Github external
'use strict';
var Cesium = require('cesium');

var Cartesian2 = Cesium.Cartesian2;
var Cartesian3 = Cesium.Cartesian3;
var Cartesian4 = Cesium.Cartesian4;
var Matrix2 = Cesium.Matrix2;
var Matrix3 = Cesium.Matrix3;
var Matrix4 = Cesium.Matrix4;
var WebGLConstants = Cesium.WebGLConstants;
var defaultValue = Cesium.defaultValue;

var AccessorReader = require('./AccessorReader');

module.exports = readAccessor;

/**
 * Reads data from
 *
 * @param {Object} gltf
 * @param {Object} accessor
 * @param {Array} results
 * @param {Boolean} [generateAttributes=false]
 * @returns {Number}
github AnalyticalGraphicsInc / gltf-pipeline / specs / lib / packArraySpec.js View on Github external
'use strict';
var packArray = require('../../lib/packArray');
var Cesium = require('cesium');
var Cartesian2 = Cesium.Cartesian2;
var Cartesian3 = Cesium.Cartesian3;
var Cartesian4 = Cesium.Cartesian4;
var Matrix2 = Cesium.Matrix2;
var Matrix3 = Cesium.Matrix3;
var Matrix4 = Cesium.Matrix4;
var WebGLConstants = Cesium.WebGLConstants;

var cartesian2 = [new Cartesian2(0, 1), new Cartesian2(2, 3), new Cartesian2(4, 5),
    new Cartesian2(6, 7), new Cartesian2(8, 9), new Cartesian2(10, 11)];
var cartesian3 = [new Cartesian3(0, 1, 2), new Cartesian3(3, 4, 5),
    new Cartesian3(6, 7, 8), new Cartesian3(9, 10, 11)];
var cartesian4 = [new Cartesian4(0, 1, 2, 3), new Cartesian4(4, 5, 6, 7),
    new Cartesian4(8, 9, 10, 11)];

var packedCartesians = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];

var matrix2 = [new Matrix2(0, 2,
                           1, 3)];
var matrix3 = [new Matrix3(0, 3, 6,
                           1, 4, 7,
github AnalyticalGraphicsInc / gltf-pipeline / lib / bakeAmbientOcclusion.js View on Github external
'use strict';
var Cesium = require('cesium');
var clone = require('clone');

var baryCentricCoordinates = Cesium.barycentricCoordinates;
var Cartesian2 = Cesium.Cartesian2;
var Cartesian3 = Cesium.Cartesian3;
var CesiumMath = Cesium.Math;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var DeveloperError = Cesium.DeveloperError;
var Matrix3 = Cesium.Matrix3;
var Matrix4 = Cesium.Matrix4;
var Quaternion = Cesium.Quaternion;
var Ray = Cesium.Ray;
var ShaderSource = Cesium.ShaderSource;
var WebGLConstants = Cesium.WebGLConstants;
var IntersectionTests = Cesium.IntersectionTests;

var GeometryMath = require('./GeometryMath');
var getUniqueId = require('./getUniqueId');
var Jimp = require('jimp');
var NodeHelpers = require('./NodeHelpers');
var readAccessor = require('./readAccessor');
var StaticUniformGrid = require('./StaticUniformGrid');

var scratchRay = new Ray();
var barycentricCoordinateScratch = new Cartesian3();