diff --git a/demo/client/html/integration-test.html.hbs b/demo/client/html/integration-test.html.hbs new file mode 100644 index 00000000..a02cf9c2 --- /dev/null +++ b/demo/client/html/integration-test.html.hbs @@ -0,0 +1,19 @@ + + + + Integration Test — Pathfinder + + {{>partials/header.html}} + + + + {{>partials/navbar.html isTool=true}} +
+
+ Font +
+
+ + + + diff --git a/demo/client/html/partials/navbar.html.hbs b/demo/client/html/partials/navbar.html.hbs index 99389d8d..d5127b5d 100644 --- a/demo/client/html/partials/navbar.html.hbs +++ b/demo/client/html/partials/navbar.html.hbs @@ -19,6 +19,7 @@ ref="/" aria-haspopup="true" aria-expanded="false">Tools diff --git a/demo/client/src/integration-test.ts b/demo/client/src/integration-test.ts new file mode 100644 index 00000000..c278dd95 --- /dev/null +++ b/demo/client/src/integration-test.ts @@ -0,0 +1,104 @@ +// pathfinder/client/src/integration-test.ts +// +// Copyright © 2017 The Pathfinder Project Developers. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +import * as glmatrix from 'gl-matrix'; + +import {AntialiasingStrategy, AntialiasingStrategyName, NoAAStrategy} from './aa-strategy'; +import {SubpixelAAType} from './aa-strategy'; +import {DemoAppController} from "./app-controller"; +import {OrthographicCamera} from './camera'; +import {UniformMap} from './gl-utils'; +import {Renderer} from "./renderer"; +import {ShaderMap} from "./shader-loader"; +import SSAAStrategy from './ssaa-strategy'; +import {DemoView} from "./view"; +import {AdaptiveMonochromeXCAAStrategy} from './xcaa-strategy'; + +const ANTIALIASING_STRATEGIES: AntialiasingStrategyTable = { + none: NoAAStrategy, + ssaa: SSAAStrategy, + xcaa: AdaptiveMonochromeXCAAStrategy, +}; + +interface AntialiasingStrategyTable { + none: typeof NoAAStrategy; + ssaa: typeof SSAAStrategy; + xcaa: typeof AdaptiveMonochromeXCAAStrategy; +} + +class IntegrationTestAppController extends DemoAppController { + protected builtinFileURI: string; + protected defaultFile: string; + protected createView(): IntegrationTestView { + throw new Error("Method not implemented."); + } + protected fileLoaded(data: ArrayBuffer, builtinName: string | null): void { + throw new Error("Method not implemented."); + } +} + +class IntegrationTestView extends DemoView { + get camera(): OrthographicCamera { + return this.renderer.camera; + } + readonly renderer: IntegrationTestRenderer; +} + +class IntegrationTestRenderer extends Renderer { + camera: OrthographicCamera; + destFramebuffer: WebGLFramebuffer | null; + destAllocatedSize: glmatrix.vec2; + destUsedSize: glmatrix.vec2; + protected objectCount: number; + protected usedSizeFactor: glmatrix.vec2; + protected worldTransform: glmatrix.mat4; + + pathBoundingRects(objectIndex: number): Float32Array { + throw new Error("Method not implemented."); + } + + setHintsUniform(uniforms: UniformMap): void { + throw new Error("Method not implemented."); + } + + protected createAAStrategy(aaType: AntialiasingStrategyName, + aaLevel: number, + subpixelAA: SubpixelAAType): + AntialiasingStrategy { + return new (ANTIALIASING_STRATEGIES[aaType])(aaLevel, subpixelAA); + } + + protected compositeIfNecessary(): void { + throw new Error("Method not implemented."); + } + + protected pathColorsForObject(objectIndex: number): Uint8Array { + throw new Error("Method not implemented."); + } + + protected pathTransformsForObject(objectIndex: number): Float32Array { + throw new Error("Method not implemented."); + } + + protected directCurveProgramName(): keyof ShaderMap { + return 'directCurve'; + } + + protected directInteriorProgramName(): keyof ShaderMap { + return 'directInterior'; + } +} + +function main() { + const controller = new IntegrationTestAppController; + window.addEventListener('load', () => controller.start(), false); +} + +main(); diff --git a/demo/client/webpack.config.js b/demo/client/webpack.config.js index 0a5cdadc..ba71c331 100644 --- a/demo/client/webpack.config.js +++ b/demo/client/webpack.config.js @@ -8,6 +8,7 @@ module.exports = { '3d-demo': "./src/3d-demo.ts", 'svg-demo': "./src/svg-demo.ts", 'text-demo': "./src/text-demo.ts", + 'integration-test': "./src/integration-test.ts", 'benchmark': "./src/benchmark.ts", 'mesh-debugger': "./src/mesh-debugger.ts", }, diff --git a/demo/server/src/main.rs b/demo/server/src/main.rs index eba4c10a..b0ee2495 100644 --- a/demo/server/src/main.rs +++ b/demo/server/src/main.rs @@ -67,6 +67,7 @@ static STATIC_TEXT_DEMO_PATH: &'static str = "../client/text-demo.html"; static STATIC_SVG_DEMO_PATH: &'static str = "../client/svg-demo.html"; static STATIC_3D_DEMO_PATH: &'static str = "../client/3d-demo.html"; static STATIC_TOOLS_BENCHMARK_PATH: &'static str = "../client/benchmark.html"; +static STATIC_TOOLS_INTEGRATION_TEST_PATH: &'static str = "../client/integration-test.html"; static STATIC_TOOLS_MESH_DEBUGGER_PATH: &'static str = "../client/mesh-debugger.html"; static STATIC_DOC_API_PATH: &'static str = "../../font-renderer/target/doc"; static STATIC_CSS_BOOTSTRAP_PATH: &'static str = "../client/node_modules/bootstrap/dist/css"; @@ -437,6 +438,10 @@ fn static_demo_3d() -> io::Result { fn static_tools_benchmark() -> io::Result { NamedFile::open(STATIC_TOOLS_BENCHMARK_PATH) } +#[get("/tools/integration-test")] +fn static_tools_integration_test() -> io::Result { + NamedFile::open(STATIC_TOOLS_INTEGRATION_TEST_PATH) +} #[get("/tools/mesh-debugger")] fn static_tools_mesh_debugger() -> io::Result { NamedFile::open(STATIC_TOOLS_MESH_DEBUGGER_PATH) @@ -553,6 +558,7 @@ fn main() { static_demo_svg, static_demo_3d, static_tools_benchmark, + static_tools_integration_test, static_tools_mesh_debugger, static_doc_api_index, static_doc_api,