Hosting code to git for the first time.

This commit is contained in:
2023-02-02 17:29:05 +08:00
parent 398469ebe4
commit c8fe5854ab
57 changed files with 2419 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
{
"name": "@ray-lab/renderer-virtual",
"version": "1.0.0",
"description": "Renderer Common Interface.",
"scripts": {
"build": "rollup -c rollup.config.js"
},
"type": "module",
"types": "./build/virtual-renderer.d.ts",
"keywords": [
"renderer-virtual",
"renderer"
],
"author": "MrKBear",
"devDependencies": {
"rollup": "^3.9.1",
"rollup-plugin-ts": "^3.0.2",
"typescript": "^4.9.4"
}
}
@@ -0,0 +1,20 @@
import tsPlugin from "rollup-plugin-ts";
/**
* @type {import("rollup").RollupOptions}
*/
const rollupConfig = {
input: "./source/virtual-renderer.ts",
output: [
{
file: "./build/virtual-renderer.d.ts",
format: "esm"
}
],
plugins: [tsPlugin()],
};
export default rollupConfig;
@@ -0,0 +1,9 @@
import type { Command } from "./Command";
import type { CommandType } from "./CommandType";
interface ClearCommand extends Command {
type: CommandType.Clear
}
export type { ClearCommand };
@@ -0,0 +1,16 @@
import type { CommandTypeSet } from "./CommandType";
interface Command {
/**
* Define the type of command.
*/
type: CommandTypeSet;
/**
* Unique identification of the command for feedback.
*/
id?: string | number;
}
export type { Command };
@@ -0,0 +1,6 @@
import type { RenderCommand } from "./RenderCommand";
import type { ClearCommand } from "./ClearCommand";
type CommandSet = RenderCommand | ClearCommand;
export type { CommandSet };
@@ -0,0 +1,15 @@
namespace CommandType {
export type Render = "RENDER" | 100_001;
export type Resource = "RESOURCE" | 100_002;
export type Clear = "CLEAR" | 100_003;
export type Execute = "EXECUTE" | 100_004;
}
type CommandTypeSet = CommandType.Render | CommandType.Resource | CommandType.Clear | CommandType.Execute;
export type { CommandType, CommandTypeSet };
@@ -0,0 +1,12 @@
import type { Command } from "./Command";
import type { CommandType } from "./CommandType";
/**
* Rendering command are used to execute gl programs.
*/
interface RenderCommand extends Command {
type: CommandType.Render
}
export type { RenderCommand };
@@ -0,0 +1,8 @@
import type { CommandSet } from "command/CommandSet"
interface Renderer {
executeCommand: (commands: CommandSet[] | CommandSet) => void;
}
export type { Renderer };
@@ -0,0 +1,10 @@
import type { ResourceSet } from "./ResourceType";
interface Resource {
type: ResourceSet;
id: string | number;
}
export type { Resource };
@@ -0,0 +1,9 @@
namespace ResourceType {
export type Shader = "SHADER" | 100_001;
}
type ResourceSet = ResourceType.Shader;
export type { ResourceType, ResourceSet };
@@ -0,0 +1,7 @@
export * from "command/Command";
export * from "command/CommandSet";
export * from "command/CommandType";
export * from "command/RenderCommand";
export * from "command/ClearCommand";
export * from "resource/Resource";
export * from "resource/ResourceType";
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"strict": true,
"declaration": true,
"declarationDir": "build",
"baseUrl": "./",
"lib": [
"ESNext"
],
"paths": {
"command/*": ["./source/command/*"],
"common/*": ["./source/common/*"],
"resource/*": ["./source/resource/*"],
"renderer/*": ["./source/renderer/*"]
}
},
"include": [
"./source/**/*"
],
"exclude": [
"node_modules",
"build"
]
}