toon material

beta.r3js.org
-=yb4f310 2017-11-21 11:14:06 +01:00
parent 8757909f1a
commit 2e47fce33f
4 changed files with 212 additions and 16 deletions

26
build/game-lib-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
// COMPILE TIME DEFINITIONS (Generated via gulp)
var __DATE__ = "Sun Nov 19 2017 20:08:36 GMT+0100 (CET)";
var __DATE__ = "Mon Nov 20 2017 14:12:20 GMT+0100 (CET)";
// END COMPILE TIME DEFINITIONS
/**
@ -12500,6 +12500,7 @@ GameLib.D3.Material.MATERIAL_TYPE_PHONG = 0x7;
GameLib.D3.Material.MATERIAL_TYPE_STANDARD = 0x8;
GameLib.D3.Material.MATERIAL_TYPE_POINTS = 0x9;
GameLib.D3.Material.MATERIAL_TYPE_SPRITE = 0xa;
GameLib.D3.Material.MATERIAL_TYPE_TOON = 0xb;
GameLib.D3.Material.LINE_CAP_BUTT = 0x1;//'butt';
GameLib.D3.Material.LINE_CAP_ROUND = 0x2;//'round';
@ -12509,6 +12510,52 @@ GameLib.D3.Material.LINE_JOIN_ROUND = 0x1;//'round';
GameLib.D3.Material.LINE_JOIN_BEVEL = 0x2;//'bevel';
GameLib.D3.Material.LINE_JOIN_MITER = 0x3;//'miter';
GameLib.D3.Material.prototype.createToonMaterialInstance = function() {
return new THREE.MeshToonMaterial({
name: this.name,
opacity: this.opacity,
transparent: this.transparent,
blending: this.blending,
blendSrc: this.blendSrc,
blendDst: this.blendDst,
blendEquation: this.blendEquation,
depthTest: this.depthTest,
depthFunc: this.depthFunc,
depthWrite: this.depthWrite,
polygonOffset: this.polygonOffset,
polygonOffsetFactor: this.polygonOffsetFactor,
polygonOffsetUnits: this.polygonOffsetUnits,
alphaTest: this.alphaTest,
clippingPlanes: this.clippingPlanes,
clipShadows: this.clipShadows,
overdraw: this.overdraw,
visible: this.visible,
side: this.side,
color: this.color.instance,
roughness: this.roughness,
metalness: this.metalness,
lightMapIntensity: this.lightMapIntensity,
aoMapIntensity: this.aoMapIntensity,
emissive: this.emissive.instance,
emissiveIntensity: this.emissiveIntensity,
bumpScale: this.bumpScale,
normalScale: this.normalScale,
displacementScale: this.displacementScale,
refractionRatio: this.refractionRatio,
fog: this.fog,
flatShading: this.flatShading,
wireframe: this.wireframe,
wireframeLinewidth: this.wireframeLineWidth,
wireframeLinecap: this.wireframeLineCap,
wireframeLinejoin: this.wireframeLineJoin,
vertexColors: GameLib.D3.Material.TYPE_VERTEX_COLORS,
skinning: this.skinning,
morphTargets: this.morphTargets,
morphNormals: this.morphNormals
});
};
GameLib.D3.Material.prototype.createStandardMaterialInstance = function() {
return new THREE.MeshStandardMaterial({
name: this.name,
@ -12794,6 +12841,50 @@ GameLib.D3.Material.prototype.updateTextures = function() {
};
GameLib.D3.Material.prototype.updateToonMaterialInstance = function(property) {
this.instance.name = this.name;
this.instance.opacity = this.opacity;
this.instance.transparent = this.transparent;
this.instance.blending = this.blending;
this.instance.blendSrc = this.blendSrc;
this.instance.blendDst = this.blendDst;
this.instance.blendEquation = this.blendEquation;
this.instance.depthTest = this.depthTest;
this.instance.depthFunc = this.depthFunc;
this.instance.depthWrite = this.depthWrite;
this.instance.polygonOffset = this.polygonOffset;
this.instance.polygonOffsetFactor = this.polygonOffsetFactor;
this.instance.polygonOffsetUnits = this.polygonOffsetUnits;
this.instance.alphaTest = this.alphaTest;
this.instance.clippingPlanes = this.clippingPlanes;
this.instance.clipShadows = this.clipShadows;
this.instance.overdraw = this.overdraw;
this.instance.visible = this.visible;
this.instance.side = this.side;
this.instance.color = this.color.instance;
this.instance.envMapIntensity = this.envMapIntensity; //standard material doesnt have specular color
this.instance.roughness = this.roughness;
this.instance.metalness = this.metalness;
this.instance.lightMapIntensity = this.lightMapIntensity;
this.instance.aoMapIntensity = this.aoMapIntensity;
this.instance.emissive = this.emissive.instance;
this.instance.emissiveIntensity = this.emissiveIntensity;
this.instance.bumpScale = this.bumpScale;
this.instance.normalScale = this.normalScale;
this.instance.displacementScale = this.displacementScale;
this.instance.refractionRatio = this.refractionRatio;
this.instance.fog = this.fog;
this.instance.flatShading = this.flatShading;
this.instance.wireframe = this.wireframe;
this.instance.wireframeLinewidth = this.wireframeLineWidth;
this.instance.wireframeLinecap = this.wireframeLineCap;
this.instance.wireframeLinejoin = this.wireframeLineJoin;
this.instance.vertexColors = GameLib.D3.Material.TYPE_VERTEX_COLORS;
this.instance.skinning = this.skinning;
this.instance.morphTargets = this.morphTargets;
this.instance.morphNormals = this.morphNormals;
};
GameLib.D3.Material.prototype.updateStandardMaterialInstance = function(property) {
this.instance.name = this.name;
this.instance.opacity = this.opacity;
@ -13013,6 +13104,10 @@ GameLib.D3.Material.prototype.createInstance = function() {
this.instance = this.createLineBasicMaterialInstance();
} else if (this.materialType === GameLib.D3.Material.MATERIAL_TYPE_TOON) {
this.instance = this.createToonMaterialInstance();
} else {
console.warn("material type is not implemented yet: " + this.materialType);
}
@ -13075,6 +13170,8 @@ GameLib.D3.Material.prototype.updateInstance = function(property) {
this.updateMeshBasicMaterialInstance(property);
} else if (this.materialType === GameLib.D3.Material.MATERIAL_TYPE_LINE_BASIC) {
this.updateLineBasicMaterialInstance(property);
} else if (this.materialType === GameLib.D3.Material.MATERIAL_TYPE_TOON) {
this.updateToonMaterialInstance(property);
} else {
console.warn('not yet implemented (material type = ' + this.materialType + ')');
}
@ -26636,6 +26733,7 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
'basic': GameLib.D3.Material.MATERIAL_TYPE_BASIC,
'phong': GameLib.D3.Material.MATERIAL_TYPE_PHONG,
'points': GameLib.D3.Material.MATERIAL_TYPE_POINTS,
'toon': GameLib.D3.Material.MATERIAL_TYPE_TOON,
'line basic' : GameLib.D3.Material.MATERIAL_TYPE_LINE_BASIC
}
)
@ -27029,7 +27127,7 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
} else if (
property === 'density'
) {
controllers.push(folder.add(object, property, 0, 1, 0.000001));
controllers.push(folder.add(object, property, 0, 1, 0.0001));
} else if (
property === 'thetaLength' ||
property === 'angle'

View File

@ -339,6 +339,7 @@ GameLib.D3.Material.MATERIAL_TYPE_PHONG = 0x7;
GameLib.D3.Material.MATERIAL_TYPE_STANDARD = 0x8;
GameLib.D3.Material.MATERIAL_TYPE_POINTS = 0x9;
GameLib.D3.Material.MATERIAL_TYPE_SPRITE = 0xa;
GameLib.D3.Material.MATERIAL_TYPE_TOON = 0xb;
GameLib.D3.Material.LINE_CAP_BUTT = 0x1;//'butt';
GameLib.D3.Material.LINE_CAP_ROUND = 0x2;//'round';
@ -348,6 +349,52 @@ GameLib.D3.Material.LINE_JOIN_ROUND = 0x1;//'round';
GameLib.D3.Material.LINE_JOIN_BEVEL = 0x2;//'bevel';
GameLib.D3.Material.LINE_JOIN_MITER = 0x3;//'miter';
GameLib.D3.Material.prototype.createToonMaterialInstance = function() {
return new THREE.MeshToonMaterial({
name: this.name,
opacity: this.opacity,
transparent: this.transparent,
blending: this.blending,
blendSrc: this.blendSrc,
blendDst: this.blendDst,
blendEquation: this.blendEquation,
depthTest: this.depthTest,
depthFunc: this.depthFunc,
depthWrite: this.depthWrite,
polygonOffset: this.polygonOffset,
polygonOffsetFactor: this.polygonOffsetFactor,
polygonOffsetUnits: this.polygonOffsetUnits,
alphaTest: this.alphaTest,
clippingPlanes: this.clippingPlanes,
clipShadows: this.clipShadows,
overdraw: this.overdraw,
visible: this.visible,
side: this.side,
color: this.color.instance,
roughness: this.roughness,
metalness: this.metalness,
lightMapIntensity: this.lightMapIntensity,
aoMapIntensity: this.aoMapIntensity,
emissive: this.emissive.instance,
emissiveIntensity: this.emissiveIntensity,
bumpScale: this.bumpScale,
normalScale: this.normalScale,
displacementScale: this.displacementScale,
refractionRatio: this.refractionRatio,
fog: this.fog,
flatShading: this.flatShading,
wireframe: this.wireframe,
wireframeLinewidth: this.wireframeLineWidth,
wireframeLinecap: this.wireframeLineCap,
wireframeLinejoin: this.wireframeLineJoin,
vertexColors: GameLib.D3.Material.TYPE_VERTEX_COLORS,
skinning: this.skinning,
morphTargets: this.morphTargets,
morphNormals: this.morphNormals
});
};
GameLib.D3.Material.prototype.createStandardMaterialInstance = function() {
return new THREE.MeshStandardMaterial({
name: this.name,
@ -633,6 +680,50 @@ GameLib.D3.Material.prototype.updateTextures = function() {
};
GameLib.D3.Material.prototype.updateToonMaterialInstance = function(property) {
this.instance.name = this.name;
this.instance.opacity = this.opacity;
this.instance.transparent = this.transparent;
this.instance.blending = this.blending;
this.instance.blendSrc = this.blendSrc;
this.instance.blendDst = this.blendDst;
this.instance.blendEquation = this.blendEquation;
this.instance.depthTest = this.depthTest;
this.instance.depthFunc = this.depthFunc;
this.instance.depthWrite = this.depthWrite;
this.instance.polygonOffset = this.polygonOffset;
this.instance.polygonOffsetFactor = this.polygonOffsetFactor;
this.instance.polygonOffsetUnits = this.polygonOffsetUnits;
this.instance.alphaTest = this.alphaTest;
this.instance.clippingPlanes = this.clippingPlanes;
this.instance.clipShadows = this.clipShadows;
this.instance.overdraw = this.overdraw;
this.instance.visible = this.visible;
this.instance.side = this.side;
this.instance.color = this.color.instance;
this.instance.envMapIntensity = this.envMapIntensity; //standard material doesnt have specular color
this.instance.roughness = this.roughness;
this.instance.metalness = this.metalness;
this.instance.lightMapIntensity = this.lightMapIntensity;
this.instance.aoMapIntensity = this.aoMapIntensity;
this.instance.emissive = this.emissive.instance;
this.instance.emissiveIntensity = this.emissiveIntensity;
this.instance.bumpScale = this.bumpScale;
this.instance.normalScale = this.normalScale;
this.instance.displacementScale = this.displacementScale;
this.instance.refractionRatio = this.refractionRatio;
this.instance.fog = this.fog;
this.instance.flatShading = this.flatShading;
this.instance.wireframe = this.wireframe;
this.instance.wireframeLinewidth = this.wireframeLineWidth;
this.instance.wireframeLinecap = this.wireframeLineCap;
this.instance.wireframeLinejoin = this.wireframeLineJoin;
this.instance.vertexColors = GameLib.D3.Material.TYPE_VERTEX_COLORS;
this.instance.skinning = this.skinning;
this.instance.morphTargets = this.morphTargets;
this.instance.morphNormals = this.morphNormals;
};
GameLib.D3.Material.prototype.updateStandardMaterialInstance = function(property) {
this.instance.name = this.name;
this.instance.opacity = this.opacity;
@ -852,6 +943,10 @@ GameLib.D3.Material.prototype.createInstance = function() {
this.instance = this.createLineBasicMaterialInstance();
} else if (this.materialType === GameLib.D3.Material.MATERIAL_TYPE_TOON) {
this.instance = this.createToonMaterialInstance();
} else {
console.warn("material type is not implemented yet: " + this.materialType);
}
@ -914,6 +1009,8 @@ GameLib.D3.Material.prototype.updateInstance = function(property) {
this.updateMeshBasicMaterialInstance(property);
} else if (this.materialType === GameLib.D3.Material.MATERIAL_TYPE_LINE_BASIC) {
this.updateLineBasicMaterialInstance(property);
} else if (this.materialType === GameLib.D3.Material.MATERIAL_TYPE_TOON) {
this.updateToonMaterialInstance(property);
} else {
console.warn('not yet implemented (material type = ' + this.materialType + ')');
}

View File

@ -865,6 +865,7 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
'basic': GameLib.D3.Material.MATERIAL_TYPE_BASIC,
'phong': GameLib.D3.Material.MATERIAL_TYPE_PHONG,
'points': GameLib.D3.Material.MATERIAL_TYPE_POINTS,
'toon': GameLib.D3.Material.MATERIAL_TYPE_TOON,
'line basic' : GameLib.D3.Material.MATERIAL_TYPE_LINE_BASIC
}
)
@ -1258,7 +1259,7 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
} else if (
property === 'density'
) {
controllers.push(folder.add(object, property, 0, 1, 0.000001));
controllers.push(folder.add(object, property, 0, 1, 0.0001));
} else if (
property === 'thetaLength' ||
property === 'angle'