pull/347/head
ChenX 5 years ago
parent 18840d4b7b
commit 7e68f495b5

@ -1,5 +1,4 @@
import * as THREE from 'three';
import { Material, MeshPhysicalMaterial } from "three";
export const MaterialNeedUpdateKey = "needUpdateImg";
@ -9,17 +8,17 @@ export const MaterialNeedUpdateKey = "needUpdateImg";
export class MaterialDictionary
{
MaterialDict: Map<number, THREE.Material>;
MaterialDict: Map<number, Material>;
MaterialCallback: Map<number, any>;
private _cout = 0;//Id 分配器.
constructor()
{
this.MaterialDict = new Map<number, THREE.Material>();
this.MaterialDict = new Map<number, Material>();
this.MaterialCallback = new Map<number, any>();
}
//添加材质..
addMaterial(mat: THREE.Material)
addMaterial(mat: Material)
{
this.extendObservable(mat, this._cout);
this.MaterialDict.set(this._cout, mat);
@ -27,11 +26,11 @@ export class MaterialDictionary
}
createMaterial()
{
let mat = new THREE.MeshPhysicalMaterial({ roughness: 0.2, metalness: 0.2, bumpScale: 0.0005 });
let mat = new MeshPhysicalMaterial({ roughness: 0.2, metalness: 0.2, bumpScale: 0.0005 });
mat.name = "材质" + this._cout;
this.addMaterial(mat);
}
extendObservable(mat: THREE.Material, id: number)
extendObservable(mat: Material, id: number)
{
// let mobxData: Object = {};
@ -41,7 +40,7 @@ export class MaterialDictionary
// for (let key of colorList)
// {
// let newKey = "mobx_" + key;
// mobxData[newKey] = "#" + (mat[key] as THREE.Color).getHexString();
// mobxData[newKey] = "#" + (mat[key] as Color).getHexString();
// }
// for (let d of ["name", "transparent", "roughness", "metalness", "opacity", "depthTest", "map", "bumpMap", "bumpScale", "roughnessMap"])
// {
@ -56,14 +55,14 @@ export class MaterialDictionary
// {
// for (let key of colorList)
// {
// (mat[key] as THREE.Color).set(mat["mobx_" + key])
// (mat[key] as Color).set(mat["mobx_" + key])
// }
// })
// this.MaterialCallback.set(id, mobxRemove);
}
getMaterial(id: number): THREE.Material
getMaterial(id: number): Material
{
return this.MaterialDict.get(Number(id));
}
@ -74,4 +73,4 @@ export class MaterialDictionary
if (callback) callback();
this.MaterialCallback.delete(id);
}
}
}

@ -1,6 +1,5 @@
import { SymbolTable } from "./SymbolTable";
import { PhysicalMaterialRecord } from "./PhysicalMaterialRecord";
import { Status } from "../Common/Status";
export class MaterialTable extends SymbolTable
{

@ -9,9 +9,9 @@ import { Polyline } from './Entity/Polyline';
* ,.
* :http://www.cnblogs.com/miloyip/archive/2013/04/19/3029852.html
*
* @param {Arc} arc
* @param {Vector3} pt
* @returns {boolean} .
* @param arc
* @param pt
* @returns .
*/
function IsPointInCircularSector(arc: Arc, pt: Vector3): boolean
{
@ -26,10 +26,10 @@ function IsPointInCircularSector(arc: Arc, pt: Vector3): boolean
/**
*
*
* @param {Arc} arc
* @param {Vector3} pt
* @param {boolean} isInChrodIsTrue
* @returns {boolean}
* @param arc
* @param pt
* @param isInChrodIsTrue
* @returns
*/
export function IsPointInBowArc(arc: Arc, pt: Vector3, isInChrodIsTrue = false): boolean
{
@ -56,11 +56,9 @@ export function IsPointInBowArc(arc: Arc, pt: Vector3, isInChrodIsTrue = false):
/**
* 线
*
* @export
* @param {Polyline} pl 线
* @param {Vector3} pt
* @returns {boolean} 线
* @param pl 线
* @param pt
* @returns 线
*/
export function IsPointInPolyLine(pl: Polyline, pt: Vector3): boolean
{
@ -160,8 +158,8 @@ export function IsPointInPolyLine(pl: Polyline, pt: Vector3): boolean
/**
*
*
* @param {Vector3} pt
* @param {Vector2[]} pts
* @param pt
* @param pts
* @returns
*/
function IsPointInPolygon(pt: Vector3, pts: Vector2[])

Loading…
Cancel
Save