<commit_before>import { Laya } from "Laya";
import { Camera } from "laya/d3/core/Camera";
import { DirectionLight } from "laya/d3/core/light/DirectionLight";
import { MeshSprite3D } from "laya/d3/core/MeshSprite3D";
import { Scene3D } from "laya/d3/core/scene/Scene3D";
import { Sprite3D } from "laya/d3/core/Sprite3D";
import { Transform3D } from "laya/d3/core/Transform3D";
import { Quaternion } from "laya/d3/math/Quaternion";
import { Vector3 } from "laya/d3/math/Vector3";
import { Stage } from "laya/display/Stage";
import { Loader } from "laya/net/Loader";
import { Handler } from "laya/utils/Handler";
import { Stat } from "laya/utils/Stat";
import { Laya3D } from "Laya3D";
import { CameraMoveScript } from "../common/CameraMoveScript";
import { ShadowCascadesMode } from "laya/d3/core/light/ShadowCascadesMode";
import { ShadowMode } from "laya/d3/core/light/ShadowMode";

/**
 * ...
 * @author ...
 */
export class TransformDemo {

	private _scene: Scene3D;
	private tmpVector: Vector3 = new Vector3(0, 0, 0);
	private _position: Vector3 = new Vector3(0, 0, 0);
	private _position1: Vector3 = new Vector3(0, 0, 0);
	private _rotate: Vector3 = new Vector3(0, 1, 0);
	private _rotate1: Vector3 = new Vector3(0, 0, 0);
	private _scale: Vector3 = new Vector3();
	private scaleDelta: number = 0;
	private scaleValue: number = 0;

	private layaMonkey_clone1: Sprite3D;
	private layaMonkey_clone2: Sprite3D;
	private layaMonkey_clone3: Sprite3D;

	private clone1Transform: Transform3D;
	private clone2Transform: Transform3D;
	private clone3Transform: Transform3D;


	constructor() {
		//初始化引擎
		Laya3D.init(0, 0);
		Laya.stage.scaleMode = Stage.SCALE_FULL;
		Laya.stage.screenMode = Stage.SCREEN_NONE;
		//显示性能面板
		Stat.show();

		//创建场景
		this._scene = (<Scene3D>Laya.stage.addChild(new Scene3D()));

		//添加相机
		var camera: Camera = (<Camera>(this._scene.addChild(new Camera(0, 0.1, 100))));
		camera.transform.translate(new Vector3(0, 2.0, 5));
		camera.transform.rotate(new Vector3(-30, 0, 0), true, false);
		camera.addComponent(CameraMoveScript);

		//添加光照
		var directionLight: DirectionLight = (<DirectionLight>this._scene.addChild(new DirectionLight()));
		directionLight.color = new Vector3(1, 1, 1);
		directionLight.transform.rotate(new Vector3(-3.14 / 3, 0, 0));

		//灯光开启阴影
		directionLight.shadowMode = ShadowMode.Hard;
		//可见阴影距离
		directionLight.shadowDistance = 5;
		//生成阴影贴图尺寸
		directionLight.shadowResolution = 2048;
		//生成阴影贴图数量
		directionLight.shadowCascadesMode = ShadowCascadesMode.NoCascades;

		//批量预加载资源
		Laya.loader.create(["res/threeDimen/staticModel/grid/plane.lh", "res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"], Handler.create(this, this.onComplete));

	}

	private onComplete(): void {
		//加载地面
		var grid: Sprite3D = (<Sprite3D>this._scene.addChild(Loader.getRes("res/threeDimen/staticModel/grid/plane.lh")));
		//地面接收阴影
		((<MeshSprite3D>grid.getChildAt(0))).meshRenderer.receiveShadow = true;
		//加载静态小猴子
		var staticLayaMonkey: MeshSprite3D = (<MeshSprite3D>Loader.getRes("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"));

		//设置缩放
		var staticMonkeyTransform: Transform3D = staticLayaMonkey.transform;
		var staticMonkeyScale: Vector3 = staticMonkeyTransform.localScale;
		staticMonkeyScale.setValue(0.3, 0.3, 0.3);
		staticMonkeyTransform.localScale = staticMonkeyScale;

		//克隆sprite3d
		this.layaMonkey_clone1 = Sprite3D.instantiate(staticLayaMonkey, this._scene, false, this._position1);
		this.layaMonkey_clone2 = Sprite3D.instantiate(staticLayaMonkey, this._scene, false, this._position1);
		this.layaMonkey_clone3 = Sprite3D.instantiate(staticLayaMonkey, this._scene, false, this._position1);
		//得到三个Transform
		this.clone1Transform = this.layaMonkey_clone1.transform;
		this.clone2Transform = this.layaMonkey_clone2.transform;
		this.clone3Transform = this.layaMonkey_clone3.transform;
		//平移
		this._position1.setValue(0.0, 0, 0.0);
		this.clone1Transform.translate(this._position1);
		this._position1.setValue(-1.5, 0, 0.0);
		this.clone2Transform.translate(this._position1);<commit_msg>zqx--Remove unnecessary shadow display in transformDemo.<commit_after>import { Laya } from "Laya";
import { Camera } from "laya/d3/core/Camera";
import { DirectionLight } from "laya/d3/core/light/DirectionLight";
import { MeshSprite3D } from "laya/d3/core/MeshSprite3D";
import { Scene3D } from "laya/d3/core/scene/Scene3D";
import { Sprite3D } from "laya/d3/core/Sprite3D";
import { Transform3D } from "laya/d3/core/Transform3D";
import { Vector3 } from "laya/d3/math/Vector3";
import { Stage } from "laya/display/Stage";
import { Loader } from "laya/net/Loader";
import { Handler } from "laya/utils/Handler";
import { Stat } from "laya/utils/Stat";
import { Laya3D } from "Laya3D";
import { CameraMoveScript } from "../common/CameraMoveScript";

/**
 * ...
 * @author ...
 */
export class TransformDemo {

	private _scene: Scene3D;
	private tmpVector: Vector3 = new Vector3(0, 0, 0);
	private _position: Vector3 = new Vector3(0, 0, 0);
	private _position1: Vector3 = new Vector3(0, 0, 0);
	private _rotate: Vector3 = new Vector3(0, 1, 0);
	private _rotate1: Vector3 = new Vector3(0, 0, 0);
	private _scale: Vector3 = new Vector3();
	private scaleDelta: number = 0;
	private scaleValue: number = 0;

	private layaMonkey_clone1: Sprite3D;
	private layaMonkey_clone2: Sprite3D;
	private layaMonkey_clone3: Sprite3D;

	private clone1Transform: Transform3D;
	private clone2Transform: Transform3D;
	private clone3Transform: Transform3D;


	constructor() {
		//初始化引擎
		Laya3D.init(0, 0);
		Laya.stage.scaleMode = Stage.SCALE_FULL;
		Laya.stage.screenMode = Stage.SCREEN_NONE;
		//显示性能面板
		Stat.show();

		//创建场景
		this._scene = (<Scene3D>Laya.stage.addChild(new Scene3D()));

		//添加相机
		var camera: Camera = (<Camera>(this._scene.addChild(new Camera(0, 0.1, 100))));
		camera.transform.translate(new Vector3(0, 2.0, 5));
		camera.transform.rotate(new Vector3(-30, 0, 0), true, false);
		camera.addComponent(CameraMoveScript);

		//添加光照
		var directionLight: DirectionLight = (<DirectionLight>this._scene.addChild(new DirectionLight()));
		directionLight.color = new Vector3(1, 1, 1);
		directionLight.transform.rotate(new Vector3(-3.14 / 3, 0, 0));

		//批量预加载资源
		Laya.loader.create(["res/threeDimen/staticModel/grid/plane.lh", "res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"], Handler.create(this, this.onComplete));

	}

	private onComplete(): void {
		//加载地面
		var grid: Sprite3D = (<Sprite3D>this._scene.addChild(Loader.getRes("res/threeDimen/staticModel/grid/plane.lh")));
		//加载静态小猴子
		var staticLayaMonkey: MeshSprite3D = (<MeshSprite3D>Loader.getRes("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"));

		//设置缩放
		var staticMonkeyTransform: Transform3D = staticLayaMonkey.transform;
		var staticMonkeyScale: Vector3 = staticMonkeyTransform.localScale;
		staticMonkeyScale.setValue(0.3, 0.3, 0.3);
		staticMonkeyTransform.localScale = staticMonkeyScale;

		//克隆sprite3d
		this.layaMonkey_clone1 = Sprite3D.instantiate(staticLayaMonkey, this._scene, false, this._position1);
		this.layaMonkey_clone2 = Sprite3D.instantiate(staticLayaMonkey, this._scene, false, this._position1);
		this.layaMonkey_clone3 = Sprite3D.instantiate(staticLayaMonkey, this._scene, false, this._position1);
		//得到三个Transform
		this.clone1Transform = this.layaMonkey_clone1.transform;
		this.clone2Transform = this.layaMonkey_clone2.transform;
		this.clone3Transform = this.layaMonkey_clone3.transform;
		//平移
		this._position1.setValue(0.0, 0, 0.0);
		this.clone1Transform.translate(this._position1);
		this._position1.setValue(-1.5, 0, 0.0);
		this.clone2Transform.translate(this._position1);
{'fraction_non_alphanumeric': 0.1365661861074705, 'fraction_numerical': 0.03774574049803408, 'mean_word_length': 4.980407523510972, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2135493', 'n_tokens_mistral': 3049, 'n_tokens_neox': 2894, 'n_words': 515}