Skip to content

Commit

Permalink
refactor: add rtSimpleSkinRenderNode && webSimpleSkinRenderNode
Browse files Browse the repository at this point in the history
  • Loading branch information
lirongf committed May 25, 2024
1 parent 4d007ab commit 64fd9eb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Vector4 } from "../../../../maths/Vector4";
import { ISimpleSkinRenderNode } from "../../Design/3D/I3DRenderModuleData";
import { RTBaseRenderNode } from "./RTBaseRenderNode";

export class RTSimpleSkinRenderNode extends RTBaseRenderNode implements ISimpleSkinRenderNode {
setSimpleAnimatorParams(value: Vector4): void {
this._nativeObj.setSimpleAnimatorParams(value);
}

protected _getNativeObj() {
this._nativeObj = new (window as any).conchRTSimpleSkinRenderNode();
}

constructor() {
super();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { SimpleSkinnedMeshRenderer } from "../../../../d3/core/SimpleSkinnedMeshRenderer";
import { Sprite3D } from "../../../../d3/core/Sprite3D";
import { Vector4 } from "../../../../maths/Vector4";
import { IRenderContext3D } from "../../../DriverDesign/3DRenderPass/I3DRenderPass";
import { ISimpleSkinRenderNode } from "../../Design/3D/I3DRenderModuleData";
import { WebBaseRenderNode } from "./WebBaseRenderNode";

export class WebSimpleSkinRenderNode extends WebBaseRenderNode implements ISimpleSkinRenderNode{
_simpleAnimatorParams: Vector4;

constructor() {
super();
this.set_renderUpdatePreCall(this, this._renderUpdate);
this._simpleAnimatorParams = new Vector4();
}

setSimpleAnimatorParams(value:Vector4){
value.cloneTo(this._simpleAnimatorParams);
this.shaderData.setVector(SimpleSkinnedMeshRenderer.SIMPLE_SIMPLEANIMATORPARAMS, this._simpleAnimatorParams);
}

_renderUpdate(context3D: IRenderContext3D): void {
let shaderData = this.shaderData;
//let
let worldMat = this.transform.worldMatrix;
let worldParams = this._worldParams;
worldParams.x = this.transform.getFrontFaceValue();
shaderData.setMatrix4x4(Sprite3D.WORLDMATRIX, worldMat);
shaderData.setVector(Sprite3D.WORLDINVERTFRONT, worldParams);
this._applyLightProb();
this._applyReflection();
shaderData.setVector(SimpleSkinnedMeshRenderer.SIMPLE_SIMPLEANIMATORPARAMS, this._simpleAnimatorParams);
}
}

0 comments on commit 64fd9eb

Please sign in to comment.