Comparing version 0.4.0 to 0.5.0
{ | ||
"name": "pixi3d", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Render in 3D using PixiJS", | ||
@@ -5,0 +5,0 @@ "main": "dist/pixi3d.js", |
@@ -15,3 +15,3 @@ # Pixi3D | ||
## Getting started | ||
Let's create a simple application which renders a rotating cube. Start by [getting the latest version of Pixi3D](https://github.com/jnsmalm/pixi3d/releases). Also [get an up-to-date version of PixiJS](https://github.com/pixijs/pixi.js/releases) (v5.2+) which is needed to use Pixi3D. | ||
Let's create a simple application which renders a rotating cube. Start by [getting the latest version of Pixi3D](https://github.com/jnsmalm/pixi3d/releases). Also [get an up-to-date version of PixiJS](https://github.com/pixijs/pixi.js/releases) (v5.3+) which is needed to use Pixi3D. | ||
@@ -28,2 +28,5 @@ Next, create a file *app.js* with the following contents. | ||
let light = Object.assign(new PIXI3D.Light(), { x: -1, z: 3 }) | ||
PIXI3D.LightingEnvironment.main.lights.push(light) | ||
let rotation = 0 | ||
@@ -30,0 +33,0 @@ app.ticker.add(() => { |
@@ -25,5 +25,5 @@ import * as PIXI from "pixi.js"; | ||
* @param y Screen y coordinate. | ||
* @param z Value between -1 and 1 (near clipping plane to far clipping plane). | ||
* @param distance Distance from the camera. | ||
*/ | ||
screenToWorld(x: number, y: number, z: number): { | ||
screenToWorld(x: number, y: number, distance: number): { | ||
x: number; | ||
@@ -30,0 +30,0 @@ y: number; |
@@ -1,2 +0,2 @@ | ||
export { glTFLoader } from "./gltf/loader"; | ||
export { glTFLoader } from "./gltf/gltf-loader"; | ||
export { glTFBufferLoader } from "./gltf/buffer-loader"; | ||
@@ -11,5 +11,10 @@ export { ObservablePoint3D } from "./point"; | ||
export { MeshGeometry } from "./mesh/mesh-geometry"; | ||
export { MeshShader } from "./mesh/mesh-shader"; | ||
export { Model3D } from "./model"; | ||
export { LightType } from "./lighting/light-type"; | ||
export { Light } from "./lighting/light"; | ||
export { LightingEnvironment } from "./lighting/lighting-environment"; | ||
export { Mesh3DRenderer } from "./mesh/mesh-renderer"; | ||
export { MeshRenderer } from "./renderer/mesh-renderer"; | ||
export { MaterialRenderPass } from "./renderer/material-renderpass"; | ||
export { FilterRenderPass } from "./renderer/filter-renderpass"; | ||
export { Material } from "./material"; | ||
@@ -16,0 +21,0 @@ export { CubeMapLoader } from "./cubemap/cubemap-loader"; |
import { ImageBasedLighting } from "./ibl"; | ||
import { Light } from "./light"; | ||
/** | ||
@@ -9,4 +10,5 @@ * A lighting environment represents the different lighting conditions for a | ||
ibl?: ImageBasedLighting; | ||
lights: Light[]; | ||
/** The main lighting environment which is used by default. */ | ||
static main: LightingEnvironment; | ||
} |
import * as PIXI from "pixi.js"; | ||
import { Mesh3D } from "./mesh/mesh"; | ||
import { MeshGeometry } from "./mesh/mesh-geometry"; | ||
import { MeshShader } from "./mesh/mesh-shader"; | ||
/** | ||
@@ -15,9 +15,3 @@ * Factory for creating materials. | ||
export declare abstract class Material { | ||
protected _shader?: PIXI.Shader; | ||
/** State used to render a mesh. */ | ||
state: PIXI.State & { | ||
culling: boolean; | ||
clockwiseFrontFace: boolean; | ||
depthTest: boolean; | ||
}; | ||
protected _shader?: MeshShader; | ||
/** Value indicating if the material is valid to render. */ | ||
@@ -29,3 +23,4 @@ get valid(): boolean; | ||
transparent: boolean; | ||
get name(): string; | ||
/** Value indicating if the material is double sided. */ | ||
doubleSided: boolean; | ||
/** | ||
@@ -36,3 +31,3 @@ * Creates a shader used to render a mesh. | ||
*/ | ||
abstract createShader(mesh: Mesh3D, renderer: PIXI.Renderer): PIXI.Shader; | ||
abstract createShader(mesh: Mesh3D, renderer: PIXI.Renderer): MeshShader; | ||
/** | ||
@@ -43,10 +38,10 @@ * Updates the uniforms for the specified shader. | ||
*/ | ||
abstract updateUniforms?(mesh: Mesh3D, shader: PIXI.Shader): void; | ||
addGeometryAttributes(geometry: MeshGeometry): void; | ||
abstract updateUniforms?(mesh: Mesh3D, shader: MeshShader): void; | ||
/** | ||
* Renders the specified mesh. | ||
* Renders the specified mesh with this material. | ||
* @param mesh Mesh to render. | ||
* @param renderer Renderer to use. | ||
* @param state The state to use. | ||
*/ | ||
render(mesh: Mesh3D, renderer: PIXI.Renderer): void; | ||
render(mesh: Mesh3D, renderer: PIXI.Renderer, state?: PIXI.State): void; | ||
} |
import * as PIXI from "pixi.js"; | ||
import { Material } from "../material"; | ||
import { MeshShader } from "./mesh-shader"; | ||
export interface MeshGeometryAttribute { | ||
@@ -8,3 +8,3 @@ buffer: ArrayBuffer; | ||
export declare class MeshGeometry extends PIXI.Geometry { | ||
private _materials; | ||
private _shaders; | ||
indices?: MeshGeometryAttribute; | ||
@@ -23,4 +23,4 @@ positions?: MeshGeometryAttribute; | ||
addIndex(buffer?: PIXI.Buffer | number[]): MeshGeometry; | ||
addMaterialAttributes(material: Material): void; | ||
hasMaterialAttributes(material: Material): boolean; | ||
addShaderAttributes(shader: MeshShader): void; | ||
hasShaderAttributes(material: MeshShader): boolean; | ||
} |
@@ -7,9 +7,12 @@ import * as PIXI from "pixi.js"; | ||
geometry: MeshGeometry; | ||
material: Material; | ||
material?: Material | undefined; | ||
pluginName: string; | ||
constructor(geometry: MeshGeometry, material: Material); | ||
/** Names of the passes used for rendering the mesh. */ | ||
renderPasses: string[]; | ||
constructor(geometry: MeshGeometry, material?: Material | undefined); | ||
_render(renderer: PIXI.Renderer): void; | ||
isInteractive(object?: PIXI.DisplayObject): boolean; | ||
static createPlane(materialFactory?: MaterialFactory): Mesh3D; | ||
static createCube(materialFactory?: MaterialFactory): Mesh3D; | ||
static createSphere(materialFactory?: MaterialFactory): Mesh3D; | ||
} |
@@ -12,4 +12,2 @@ import * as PIXI from "pixi.js"; | ||
export declare class Model3D extends Container3D { | ||
/** Animations for the model. */ | ||
animations: Animation[]; | ||
/** | ||
@@ -22,3 +20,10 @@ * Creates a new model from a source. | ||
static from(source: glTFResource | string, materialFactory?: MaterialFactory): Model3D; | ||
/** Animations for the model. */ | ||
animations: Animation[]; | ||
/** | ||
* Allows for easier access to the meshes. Note that this list and the actual | ||
* childen are not automatically synchronized after the model has been loaded. | ||
*/ | ||
meshes: Mesh3D[]; | ||
/** | ||
* Gets an animation by it's name. | ||
@@ -25,0 +30,0 @@ * @param name Name of the animation. |
@@ -29,3 +29,5 @@ export declare enum PhysicallyBasedShaderFeature { | ||
texLod = "USE_TEX_LOD 1", | ||
morphing = "USE_MORPHING 1" | ||
morphing = "USE_MORPHING 1", | ||
punctual = "USE_PUNCTUAL 1", | ||
lightCount = "LIGHT_COUNT {0}" | ||
} |
import * as PIXI from "pixi.js"; | ||
import { PhysicallyBasedMeshShader } from "./pbr-shader"; | ||
import { Material } from "../material"; | ||
@@ -6,2 +7,5 @@ import { LightingEnvironment } from "../lighting/lighting-environment"; | ||
import { MeshGeometry } from "../mesh/mesh-geometry"; | ||
export interface PhysicallyBasedMaterialOptions { | ||
unlit?: boolean; | ||
} | ||
export declare enum PhysicallyBasedMaterialAlphaMode { | ||
@@ -13,5 +17,5 @@ opaque = "opaque", | ||
export declare class PhysicallyBasedMaterial extends Material { | ||
private _doubleSided; | ||
private _valid; | ||
private _lighting?; | ||
private _unlit; | ||
roughness: number; | ||
@@ -27,13 +31,25 @@ metallic: number; | ||
alphaMode: PhysicallyBasedMaterialAlphaMode; | ||
exposure: number; | ||
get name(): string; | ||
get lighting(): LightingEnvironment; | ||
get valid(): boolean; | ||
get doubleSided(): boolean; | ||
set doubleSided(value: boolean); | ||
get unlit(): boolean; | ||
set unlit(value: boolean); | ||
/** | ||
* Creates a physically based material factory. | ||
* @param options Options when creating the material. | ||
*/ | ||
static factory(options?: PhysicallyBasedMaterialOptions): { | ||
create: (source: unknown) => PhysicallyBasedMaterial & { | ||
unlit: boolean; | ||
}; | ||
}; | ||
/** | ||
* Creates a new physically based material from the specified source. | ||
* @param source Source from which the material is created. | ||
*/ | ||
static create(source: unknown): PhysicallyBasedMaterial; | ||
addGeometryAttributes(geometry: MeshGeometry): void; | ||
createShader(mesh: Mesh3D, renderer: PIXI.Renderer): PIXI.Shader; | ||
createFeatures(vertexData: MeshGeometry): string[]; | ||
createShader(mesh: Mesh3D, renderer: PIXI.Renderer): PhysicallyBasedMeshShader; | ||
createFeatures(geometry: MeshGeometry): string[]; | ||
updateUniforms(mesh: Mesh3D, shader: PIXI.Shader): void; | ||
render(mesh: Mesh3D, renderer: PIXI.Renderer): void; | ||
} |
import * as PIXI from "pixi.js"; | ||
export declare namespace PhysicallyBasedShader { | ||
function build(renderer: PIXI.Renderer, features: string[]): PIXI.Shader; | ||
import { MeshGeometry } from "../mesh/mesh-geometry"; | ||
import { MeshShader } from "../mesh/mesh-shader"; | ||
export declare class PhysicallyBasedMeshShader extends MeshShader { | ||
static build(renderer: PIXI.Renderer, features: string[]): PhysicallyBasedMeshShader; | ||
addShaderAttributes(geometry: MeshGeometry): void; | ||
} |
import * as PIXI from "pixi.js"; | ||
import { Material } from "../material"; | ||
import { Mesh3D } from "../mesh/mesh"; | ||
import { MeshShader } from "../mesh/mesh-shader"; | ||
export declare class ColorMaterial extends Material { | ||
private color; | ||
constructor(color: Uint8Array); | ||
createShader(): PIXI.Shader; | ||
createShader(): MeshShader; | ||
updateUniforms(mesh: Mesh3D, shader: PIXI.Shader): void; | ||
} |
@@ -1,5 +0,5 @@ | ||
import * as PIXI from "pixi.js"; | ||
import { Mesh3D } from "../mesh/mesh"; | ||
import { Material, MaterialFactory } from "../material"; | ||
import { CubeMipMapTexture } from "../cubemap/cube-mipmap"; | ||
import { MeshShader } from "../mesh/mesh-shader"; | ||
export declare class SkyboxMaterialFactory implements MaterialFactory { | ||
@@ -15,4 +15,4 @@ texture: CubeMipMapTexture; | ||
get valid(): boolean; | ||
updateUniforms(mesh: Mesh3D, shader: PIXI.Shader): void; | ||
createShader(): PIXI.Shader; | ||
updateUniforms(mesh: Mesh3D, shader: MeshShader): void; | ||
createShader(): MeshShader; | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
402742
57
1189
139
15