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
@@ -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";
@@ -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 };