pull/265/MERGE
ChenX 6 years ago
parent dea45b8d59
commit 3cff53ae01

@ -10,7 +10,7 @@ export class PhysicalMaterialRecord extends MaterialTableRecord
{
color: string = "#ffffff";
transparent = false; //透明度 0-1
matalness: number = 0.2;//金属性 0-1
matalness: number = 0;//金属性 0-1
opacity: number = 1;//不透明度.
depthTest: boolean = true;//深度测试
map: ObjectId;//纹理贴图

@ -1,9 +1,9 @@
import { RepeatWrapping, Texture, Wrapping } from 'three';
import { MirroredRepeatWrapping, Texture, Wrapping } from 'three';
import { CURRENT_HOST } from '../Common/HostUrl';
import { LoadImageFromUrl } from '../Loader/ImageLoader';
import { Factory } from './CADFactory';
import { CADFiler } from './CADFiler';
import { SymbolTableRecord } from './SymbolTableRecord';
import { CURRENT_HOST } from '../Common/HostUrl';
/**
* ..
@ -11,13 +11,34 @@ import { CURRENT_HOST } from '../Common/HostUrl';
@Factory
export class TextureTableRecord extends SymbolTableRecord
{
wrapS: Wrapping = RepeatWrapping;//横向(水平)平铺
wrapT: Wrapping = RepeatWrapping;//竖向(垂直)平铺
private wrapS: Wrapping = MirroredRepeatWrapping;//横向(水平)平铺
private wrapT: Wrapping = MirroredRepeatWrapping;//竖向(垂直)平铺
repeatX: number = 1;
repeatY: number = 1;
rotation: number = 0;//旋转 弧度deg
imageUrl: string;
set WrapS(wrap: Wrapping)
{
if (wrap !== this.wrapS)
{
this.WriteAllObjectRecord();
this.wrapS = wrap;
}
}
get WrapS() { return this.wrapS; };
get WrapT() { return this.wrapT; };
set WrapT(wrap: Wrapping)
{
if (wrap !== this.wrapT)
{
this.WriteAllObjectRecord();
this.wrapT = wrap;
}
}
private texture: Texture = new Texture();
async Update()
{

@ -283,7 +283,14 @@ export class Select extends React.Component<{ value: IObservableValue<any>, prom
ref={e => this.selectEl = e}
onChange={e =>
{
this.props.value.set(e.target.value);
for (let op of this.props.selects)
{
if (op.value == e.target.value)
{
this.props.value.set(op.value);
return;
}
}
}}
>
{

@ -48,7 +48,7 @@ export class MaterialEditorContent extends React.Component<IMaterialEditorConten
onChange={e =>
{
let val = parseFloat(e.target.value);
texture.wrapS = val;
texture.WrapS = val;
option.wrapS = val;
}}
/>
@ -61,7 +61,7 @@ export class MaterialEditorContent extends React.Component<IMaterialEditorConten
onChange={e =>
{
let val = parseFloat(e.target.value);
texture.wrapT = val;
texture.WrapT = val;
option.wrapT = val;
}}
/>

@ -35,8 +35,8 @@ export default class TextureContent extends React.Component<ITextureContentProps
}
let option: ITextureEditorProps = observable({
name: v.Name,
wrapS: v.wrapS,
wrapT: v.wrapT,
wrapS: v.WrapS,
wrapT: v.WrapT,
repeatX: v.repeatX.toString(),
repeatY: v.repeatY.toString(),
})

@ -30,7 +30,7 @@ export class TextureStore
this.repeatY.get();
this.rotation.get();
this.UpdateEvent();
})
});
}
dispose()
{
@ -55,6 +55,8 @@ export class TextureStore
this.textureId = null;
}
}
private updateing = false;
UpdateStore(textureId: ObjectId | TextureTableRecord)
{
if (!textureId) return;
@ -71,23 +73,28 @@ export class TextureStore
texture = textureId;
this.textureId = textureId.Id;
}
this.updateing = true;
this.repeatX.set(texture.repeatX);
this.repeatY.set(texture.repeatY);
this.warpS.set(texture.wrapS);
this.wrapT.set(texture.wrapT);
this.warpS.set(texture.WrapS);
this.wrapT.set(texture.WrapT);
let deg = Math.radToDeg(texture.rotation);
this.rotation.set(parseFloat(FixedNotZero(deg, 1)));
this.textureImg = texture.imageUrl;
this.updateing = false;
}
UpdateEvent()
{
if (this.textureId)
if (this.textureId && !this.updateing)
{
let texture = this.textureId.Object as TextureTableRecord;
texture.wrapS = this.warpS.get();
texture.wrapT = this.wrapT.get();
texture.WrapS = this.warpS.get();
texture.WrapT = this.wrapT.get();
texture.rotation = Math.degToRad(this.rotation.get());
if (texture.wrapS === ClampToEdgeWrapping)
if (texture.WrapS === ClampToEdgeWrapping)
{
texture.repeatX = 1;
this.repeatX.set(1);
@ -95,7 +102,7 @@ export class TextureStore
else
texture.repeatX = this.repeatX.get();
if (texture.wrapT === ClampToEdgeWrapping)
if (texture.WrapT === ClampToEdgeWrapping)
{
texture.repeatY = 1;
this.repeatY.set(1);

Loading…
Cancel
Save