Compare commits
No commits in common. "80173d580ef77498ab560aacbd0a47950c155375" and "c49415698395c42ffe4082aaebab1d8406604a73" have entirely different histories.
80173d580e
...
c494156983
@ -1,18 +1,10 @@
|
||||
|
||||
type ResourceNameType = string | number;
|
||||
type ResourceIdType = string | number | symbol;
|
||||
import type { ResourceSet } from "./ResourceType";
|
||||
|
||||
interface Resource {
|
||||
|
||||
/**
|
||||
* Unique identification of resource type.
|
||||
*/
|
||||
type: ResourceNameType;
|
||||
type: ResourceSet;
|
||||
|
||||
/**
|
||||
* Unique number of the resource instance.
|
||||
*/
|
||||
id: ResourceIdType;
|
||||
id: string | number;
|
||||
}
|
||||
|
||||
export type { Resource, ResourceNameType, ResourceIdType };
|
||||
export type { Resource };
|
@ -1,10 +0,0 @@
|
||||
import type { ShaderResource } from "./ShaderResource";
|
||||
|
||||
namespace ResourceName {
|
||||
export type Shader = ShaderResource["type"];
|
||||
}
|
||||
|
||||
type ResourceSet = ShaderResource;
|
||||
type ResourceNameSet = ResourceName.Shader;
|
||||
|
||||
export type { ResourceName, ResourceNameSet, ResourceSet };
|
@ -0,0 +1,9 @@
|
||||
|
||||
namespace ResourceType {
|
||||
|
||||
export type Shader = "SHADER" | 100_001;
|
||||
}
|
||||
|
||||
type ResourceSet = ResourceType.Shader;
|
||||
|
||||
export type { ResourceType, ResourceSet };
|
0
packages/renderer-virtual/source/resource/Shader.ts
Normal file
0
packages/renderer-virtual/source/resource/Shader.ts
Normal file
@ -1,8 +0,0 @@
|
||||
import type { Resource } from "./Resource";
|
||||
|
||||
interface ShaderResource extends Resource {
|
||||
|
||||
type: "SHADER" | 100_001;
|
||||
}
|
||||
|
||||
export type { ShaderResource };
|
@ -4,5 +4,4 @@ export * from "command/CommandType";
|
||||
export * from "command/RenderCommand";
|
||||
export * from "command/ClearCommand";
|
||||
export * from "resource/Resource";
|
||||
export * from "resource/ResourceSet";
|
||||
export * from "resource/ShaderResource";
|
||||
export * from "resource/ResourceType";
|
@ -1,63 +0,0 @@
|
||||
import { Resource, ResourceNameType, ResourceIdType } from "@ray-lab/renderer-virtual";
|
||||
|
||||
/**
|
||||
* Resource processing tools.
|
||||
* Whenever a new resource setting is received,
|
||||
* an instance of this class will be instantiated to manage the received resource.
|
||||
* @typeParam ResourceOption - Resource option type.
|
||||
*/
|
||||
abstract class ResourceHandler<ResourceOption extends Resource = Resource> {
|
||||
|
||||
/**
|
||||
* Resource type enumeration.
|
||||
*/
|
||||
public static resourceType: ResourceNameType;
|
||||
public static resourceTypeAlias: ResourceNameType;
|
||||
|
||||
/**
|
||||
* Original resource option.
|
||||
*/
|
||||
public resourceOption: ResourceOption;
|
||||
|
||||
/**
|
||||
* Resource unique number.
|
||||
*/
|
||||
public resourceId: ResourceIdType;
|
||||
|
||||
/**
|
||||
* @param resourceOption - Resource option.
|
||||
*/
|
||||
public constructor(resourceOption: ResourceOption) {
|
||||
this.resourceOption = resourceOption;
|
||||
this.resourceId = resourceOption.id ?? Symbol(resourceOption.type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource initialization lifecycle.
|
||||
* It will be called once after `WebGLState` is ready.
|
||||
*/
|
||||
public abstract setup(): any;
|
||||
|
||||
/**
|
||||
* Marks whether the instance is destroyed.
|
||||
*/
|
||||
public isDestroyed: boolean = false;
|
||||
|
||||
/**
|
||||
* Resource destruction lifecycle.
|
||||
* Will be called when the resource is destroyed.
|
||||
*/
|
||||
public abstract destroy(): any;
|
||||
|
||||
/**
|
||||
* Resource Settings Update Lifecycle.
|
||||
* Called when the resource settings will to be updated.
|
||||
* At this time, you can access the old settings through `this.resourceOption`.
|
||||
*
|
||||
* Note:
|
||||
* You don't need to execute ```this.resourceOption = newResourceOption``` manually,
|
||||
* The assignment will be done after this function returns.
|
||||
* @param newResourceOption - New resource option.
|
||||
*/
|
||||
public abstract update(newResourceOption: ResourceOption): any;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
|
||||
/**
|
||||
* Used to manage and process all GL resources.
|
||||
* Rely on adding `ResourceHandler` to extend functions.
|
||||
*/
|
||||
class ResourcePool {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user