Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add two new clipplanes (5 and 6) to get a clipcube #7316

Merged
merged 2 commits into from Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions dist/preview release/what's new.md
Expand Up @@ -21,6 +21,7 @@

### General

- Add two new clip planes (5 and 6) to get a clip cube ([MickPastor](https://github.com/mickPASTOR))
- Added support for dual shock gamepads ([Deltakosh](https://github.com/deltakosh/))
- Support Vive Focus 3Dof controller ([TrevorDev](https://github.com/TrevorDev))
- Planar positioning support for GizmoManager ([Balupg](https://github.com/balupg))
Expand Down Expand Up @@ -75,7 +76,7 @@
- Added support for inspectable strings ([Deltakosh](https://github.com/deltakosh/))
- Added support for CreateScreenshotUsingRenderTarget ([13djwright](https://github.com/13djwright/))
- Added support for `Material.depthFunction` property ([Popov72](https://github.com/Popov72))
- Added an optional config option `initialTab` ([ycw](https://github.com/ycw/))
- Added an optional config option `initialTab` ([ycw](https://github.com/ycw/))
- Added support for ImportAnimations ([noalak](https://github.com/noalak/))

### Tools
Expand Down Expand Up @@ -198,7 +199,7 @@
- Added the feature `expandable` to the Solid Particle System ([jerome](https://github.com/jbousquie/))
- Added the feature `removeParticles()` to the Solid Particle System ([jerome](https://github.com/jbousquie/))
- Added the feature "storable particles" and `insertParticlesFromArray()` to the Solid Particle System ([jerome](https://github.com/jbousquie/))
- Added the support for MultiMaterials to the Solid Particle System ([jerome](https://github.com/jbousquie/))
- Added the support for MultiMaterials to the Solid Particle System ([jerome](https://github.com/jbousquie/))

### Navigation Mesh

Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/cell/cellMaterial.ts
Expand Up @@ -26,6 +26,8 @@ class CellMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public POINTSIZE = false;
public FOG = false;
Expand Down Expand Up @@ -188,7 +190,7 @@ export class CellMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vDiffuseInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix"
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix"
];
var samplers = ["diffuseSampler"];
var uniformBuffers = new Array<string>();
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/fire/fireMaterial.ts
Expand Up @@ -27,6 +27,8 @@ class FireMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -177,7 +179,7 @@ export class FireMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vDiffuseInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix",
// Fire
"time", "speed"
],
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/fur/furMaterial.ts
Expand Up @@ -30,6 +30,8 @@ class FurMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -266,7 +268,7 @@ export class FurMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vDiffuseInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix",
"furLength", "furAngle", "furColor", "furOffset", "furGravity", "furTime", "furSpacing", "furDensity", "furOcclusion"
];
var samplers = ["diffuseSampler",
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/gradient/gradientMaterial.ts
Expand Up @@ -25,6 +25,8 @@ class GradientMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -179,7 +181,7 @@ export class GradientMaterial extends PushMaterial {
var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType",
"vFogInfos", "vFogColor", "pointSize",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6",
"topColor", "bottomColor", "offset", "smoothness", "scale"
];
var samplers: string[] = [];
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/lava/lavaMaterial.ts
Expand Up @@ -26,6 +26,8 @@ class LavaMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -249,7 +251,7 @@ export class LavaMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vDiffuseInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix",
"time", "speed", "movingSpeed",
"fogColor", "fogDensity", "lowFrequencySpeed"
];
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/mix/mixMaterial.ts
Expand Up @@ -27,6 +27,8 @@ class MixMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -278,7 +280,7 @@ export class MixMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vTextureInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "textureMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "textureMatrix",
"diffuse1Infos", "diffuse2Infos", "diffuse3Infos", "diffuse4Infos",
"diffuse5Infos", "diffuse6Infos", "diffuse7Infos", "diffuse8Infos"
];
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/normal/normalMaterial.ts
Expand Up @@ -26,6 +26,8 @@ class NormalMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -222,7 +224,7 @@ export class NormalMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vDiffuseInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix"
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix"
];
var samplers = ["diffuseSampler"];
var uniformBuffers = new Array<string>();
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/shadowOnly/shadowOnlyMaterial.ts
Expand Up @@ -24,6 +24,8 @@ class ShadowOnlyMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public POINTSIZE = false;
public FOG = false;
public NORMAL = false;
Expand Down Expand Up @@ -151,7 +153,7 @@ export class ShadowOnlyMaterial extends PushMaterial {
var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType",
"vFogInfos", "vFogColor", "pointSize", "alpha", "shadowColor",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4"
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6"
];
var samplers = new Array<string>();

Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/simple/simpleMaterial.ts
Expand Up @@ -26,6 +26,8 @@ class SimpleMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -177,7 +179,7 @@ export class SimpleMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vDiffuseInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix"
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix"
];
var samplers = ["diffuseSampler"];
var uniformBuffers = new Array<string>();
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/sky/skyMaterial.ts
Expand Up @@ -23,6 +23,8 @@ class SkyMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public POINTSIZE = false;
public FOG = false;
public VERTEXCOLOR = false;
Expand Down Expand Up @@ -209,7 +211,7 @@ export class SkyMaterial extends PushMaterial {
subMesh.setEffect(scene.getEngine().createEffect(shaderName,
attribs,
["world", "viewProjection", "view",
"vFogInfos", "vFogColor", "pointSize", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4",
"vFogInfos", "vFogColor", "pointSize", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6",
"luminance", "turbidity", "rayleigh", "mieCoefficient", "mieDirectionalG", "sunPosition",
"cameraPosition", "cameraOffset"
],
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/terrain/terrainMaterial.ts
Expand Up @@ -28,6 +28,8 @@ class TerrainMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -240,7 +242,7 @@ export class TerrainMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vTextureInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "textureMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "textureMatrix",
"diffuse1Infos", "diffuse2Infos", "diffuse3Infos"
];
var samplers = ["textureSampler", "diffuse1Sampler", "diffuse2Sampler", "diffuse3Sampler",
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/triPlanar/triPlanarMaterial.ts
Expand Up @@ -34,6 +34,8 @@ class TriPlanarMaterialDefines extends MaterialDefines {
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -232,7 +234,7 @@ export class TriPlanarMaterial extends PushMaterial {
var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor", "vSpecularColor",
"vFogInfos", "vFogColor", "pointSize",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6",
"tileSize"
];
var samplers = ["diffuseSamplerX", "diffuseSamplerY", "diffuseSamplerZ",
Expand Down
4 changes: 3 additions & 1 deletion materialsLibrary/src/water/waterMaterial.ts
Expand Up @@ -34,6 +34,8 @@ class WaterMaterialDefines extends MaterialDefines implements IImageProcessingCo
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public POINTSIZE = false;
Expand Down Expand Up @@ -438,7 +440,7 @@ export class WaterMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vNormalInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "normalMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "normalMatrix",
"logarithmicDepthConstant",

// Water
Expand Down
4 changes: 3 additions & 1 deletion src/Materials/Background/backgroundMaterial.ts
Expand Up @@ -151,6 +151,8 @@ class BackgroundMaterialDefines extends MaterialDefines implements IImageProcess
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public POINTSIZE = false;
public FOG = false;
public NORMAL = false;
Expand Down Expand Up @@ -869,7 +871,7 @@ export class BackgroundMaterial extends PushMaterial {

var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType",
"vFogInfos", "vFogColor", "pointSize",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "mBones",

"vPrimaryColor", "vPrimaryColorShadow",
"vReflectionInfos", "reflectionMatrix", "vReflectionMicrosurfaceInfos", "fFovMultiplier",
Expand Down
4 changes: 3 additions & 1 deletion src/Materials/PBR/pbrBaseMaterial.ts
Expand Up @@ -183,6 +183,8 @@ export class PBRMaterialDefines extends MaterialDefines
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public POINTSIZE = false;
public FOG = false;
public LOGARITHMICDEPTH = false;
Expand Down Expand Up @@ -1205,7 +1207,7 @@ export abstract class PBRBaseMaterial extends PushMaterial {
"vAlbedoInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vReflectionPosition", "vReflectionSize", "vEmissiveInfos", "vReflectivityInfos",
"vMicroSurfaceSamplerInfos", "vBumpInfos", "vLightmapInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "albedoMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "reflectivityMatrix", "normalMatrix", "microSurfaceSamplerMatrix", "bumpMatrix", "lightmapMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "albedoMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "reflectivityMatrix", "normalMatrix", "microSurfaceSamplerMatrix", "bumpMatrix", "lightmapMatrix",
"vLightingIntensity",
"logarithmicDepthConstant",
"vSphericalX", "vSphericalY", "vSphericalZ",
Expand Down
22 changes: 22 additions & 0 deletions src/Materials/materialHelper.ts
Expand Up @@ -123,11 +123,15 @@ export class MaterialHelper {
let useClipPlane2 = false;
let useClipPlane3 = false;
let useClipPlane4 = false;
let useClipPlane5 = false;
let useClipPlane6 = false;

useClipPlane1 = useClipPlane == null ? (scene.clipPlane !== undefined && scene.clipPlane !== null) : useClipPlane;
useClipPlane2 = useClipPlane == null ? (scene.clipPlane2 !== undefined && scene.clipPlane2 !== null) : useClipPlane;
useClipPlane3 = useClipPlane == null ? (scene.clipPlane3 !== undefined && scene.clipPlane3 !== null) : useClipPlane;
useClipPlane4 = useClipPlane == null ? (scene.clipPlane4 !== undefined && scene.clipPlane4 !== null) : useClipPlane;
useClipPlane5 = useClipPlane == null ? (scene.clipPlane5 !== undefined && scene.clipPlane5 !== null) : useClipPlane;
useClipPlane6 = useClipPlane == null ? (scene.clipPlane6 !== undefined && scene.clipPlane6 !== null) : useClipPlane;

if (defines["CLIPPLANE"] !== useClipPlane1) {
defines["CLIPPLANE"] = useClipPlane1;
Expand All @@ -149,6 +153,16 @@ export class MaterialHelper {
changed = true;
}

if (defines["CLIPPLANE5"] !== useClipPlane5) {
defines["CLIPPLANE5"] = useClipPlane5;
changed = true;
}

if (defines["CLIPPLANE6"] !== useClipPlane6) {
defines["CLIPPLANE6"] = useClipPlane6;
changed = true;
}

if (defines["DEPTHPREPASS"] !== !engine.getColorWrite()) {
defines["DEPTHPREPASS"] = !defines["DEPTHPREPASS"];
changed = true;
Expand Down Expand Up @@ -788,5 +802,13 @@ export class MaterialHelper {
let clipPlane = scene.clipPlane4;
effect.setFloat4("vClipPlane4", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
}
if (scene.clipPlane5) {
let clipPlane = scene.clipPlane5;
effect.setFloat4("vClipPlane5", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
}
if (scene.clipPlane6) {
let clipPlane = scene.clipPlane6;
effect.setFloat4("vClipPlane6", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
}
}
}
4 changes: 3 additions & 1 deletion src/Materials/standardMaterial.ts
Expand Up @@ -57,6 +57,8 @@ export class StandardMaterialDefines extends MaterialDefines implements IImagePr
public CLIPPLANE2 = false;
public CLIPPLANE3 = false;
public CLIPPLANE4 = false;
public CLIPPLANE5 = false;
public CLIPPLANE6 = false;
public ALPHATEST = false;
public DEPTHPREPASS = false;
public ALPHAFROMDIFFUSE = false;
Expand Down Expand Up @@ -1122,7 +1124,7 @@ export class StandardMaterial extends PushMaterial {
"vFogInfos", "vFogColor", "pointSize",
"vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos", "vLightmapInfos", "vRefractionInfos",
"mBones",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "normalMatrix", "lightmapMatrix", "refractionMatrix",
"vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "normalMatrix", "lightmapMatrix", "refractionMatrix",
"diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor",
"vReflectionPosition", "vReflectionSize",
"logarithmicDepthConstant", "vTangentSpaceParams", "alphaCutOff", "boneTextureWidth"
Expand Down