forked from layabox/LayaAir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add rtSimpleSkinRenderNode && webSimpleSkinRenderNode
- Loading branch information
lirongf
committed
May 25, 2024
1 parent
4d007ab
commit 64fd9eb
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...layaAir/laya/RenderDriver/RenderModuleData/RuntimeModuleData/3D/RTSimpleSkinRenderNode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/layaAir/laya/RenderDriver/RenderModuleData/WebModuleData/3D/WebSimpleSkinRenderNode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |