Skip to content

Commit b7fe5ad

Browse files
committed
core
1 parent 3e02954 commit b7fe5ad

File tree

15 files changed

+50
-36
lines changed

15 files changed

+50
-36
lines changed

src/core/cgl/cgl_shader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class CglShader extends CgShader
135135
this._tempInverseViewMatrix = mat4.create();
136136
this._tempInverseProjMatrix = mat4.create();
137137

138-
this.setModules(["MODULE_VERTEX_POSITION", "MODULE_COLOR", "MODULE_BEGIN_FRAG", "MODULE_VERTEX_MODELVIEW"]);
138+
this.setModules(["MODULE_VERTEX_POSITION", "MODULE_COLOR", "MODULE_NORMAL", "MODULE_BEGIN_FRAG", "MODULE_VERTEX_MODELVIEW"]);
139139
}
140140

141141
isValid()

src/libs/cables/vargetset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const VarGetOpWrapper = class
253253
_setValueOut(v)
254254
{
255255
if (this._valueOutPort)
256-
if (this._typeId == CABLES.Port.TYPE_ARRAY && this._typeId == CABLES.Port.TYPE_OBJECT)
256+
if (this._typeId == CABLES.Port.TYPE_ARRAY && this._typeId == CABLES.Port.TYPE_OBJECT || this._isTexture)
257257
this._valueOutPort.setRef(v);
258258
else
259259
this._valueOutPort.set(v);

src/ops/base/Ops.Array.ArrayGetTexture/Ops.Array.ArrayGetTexture.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ function update()
2121
let ind = index.get();
2222
if (ind < 0 || !arr || ind >= arr.length)
2323
{
24-
value.set(emptyTex);
24+
value.setRef(emptyTex);
2525
return;
2626
}
2727

2828
if (arr[ind])
2929
{
30-
value.set(arr[ind] || emptyTex);
30+
value.setRef(arr[ind] || emptyTex);
3131
last = arr[ind];
3232
}
3333
else
34-
value.set(emptyTex);
34+
value.setRef(emptyTex);
3535
}

src/ops/base/Ops.Gl.Pbr.PbrMaterial/Ops.Gl.Pbr.PbrMaterial.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ function buildShader()
332332
fragmentShader = fragmentShader.replace(FRAGMENT_BODY_REGEX, fragmentBody || "");
333333

334334
PBRShader.setSource(vertexShader, fragmentShader);
335-
shaderOut.set(PBRShader);
335+
shaderOut.setRef(PBRShader);
336336

337337
for (let i = 0; i < PBRLightStack.length; i += 1)
338338
{

src/ops/base/Ops.Gl.Phong.LambertMaterial_v2/att_lambert.frag

+2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ void main()
109109
if(!gl_FrontFacing) normal = normal*-1.0;
110110
#endif
111111

112+
{{MODULE_NORMAL}}
113+
112114
vec3 matColor = materialColor.rgb;
113115

114116
#ifdef HAS_TEXTURES

src/ops/base/Ops.Gl.Shader.AttributeAsColorMaterial/att_normalsmaterial.frag

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
IN vec3 normal;
1+
IN vec3 outNormal;
22
IN vec3 outTangent;
33
IN vec3 outBiTangent;
44
IN vec4 outPosition;
@@ -21,6 +21,9 @@ void main()
2121
vec3 attr;
2222
#endif
2323

24+
vec3 normal=outNormal;
25+
{{MODULE_NORMAL}}
26+
2427
#ifdef SHOW_NORMALS
2528
attr.xyz=normal;
2629
#endif

src/ops/base/Ops.Gl.Shader.AttributeAsColorMaterial/att_normalsmaterial.vert

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ IN float attrVertIndex;
55
IN vec3 attrVertNormal,attrTangent,attrBiTangent;
66
OUT vec2 texCoord;
77
OUT vec2 texCoord1;
8-
OUT vec3 normal;
8+
OUT vec3 outNormal;
99
OUT vec3 tangent;
1010
OUT vec3 bitangent;
1111
OUT vec3 outTangent,outBiTangent;
@@ -42,7 +42,7 @@ void main()
4242
#ifdef SHOW_NORMAL_MAT
4343
norm=( vec4(norm,1.0)*normalMatrix ).xyz;
4444
#endif
45-
normal=norm;
45+
outNormal=norm;
4646
outTangent=tangent;
4747
outBiTangent=bitangent;
4848
outPosition= mMatrix * pos;

src/ops/base/Ops.Gl.Shader.MatCapMaterial_v3/Ops.Gl.Shader.MatCapMaterial_v3.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ op.setPortGroup("Color", [r, g, b, pOpacity]);
4242
const shader = new CGL.Shader(cgl, "MatCapMaterialNew3");
4343
const uniOpacity = new CGL.Uniform(shader, "f", "opacity", pOpacity);
4444

45-
shader.setModules(["MODULE_VERTEX_POSITION", "MODULE_COLOR", "MODULE_BEGIN_FRAG", "MODULE_VERTEX_MODELVIEW"]);
45+
shader.setModules(["MODULE_VERTEX_POSITION", "MODULE_COLOR", "MODULE_NORMAL", "MODULE_BEGIN_FRAG", "MODULE_VERTEX_MODELVIEW"]);
4646
shader.setSource(attachments.matcap_vert, attachments.matcap_frag);
47-
shaderOut.set(shader);
47+
shaderOut.setRef(shader);
4848

4949
const textureMatcapUniform = new CGL.Uniform(shader, "t", "texMatcap");
5050
let textureDiffuseUniform = null;

src/ops/base/Ops.Gl.Shader.MatCapMaterial_v3/att_matcap.frag

+10-9
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ vec2 getMatCapUV(vec3 viewSpacePosition, vec3 normal) {
6161

6262
void main()
6363
{
64-
vec3 viewSpaceNormal = normalize(transformedNormal);
64+
vec3 normal = normalize(transformedNormal);
65+
{{MODULE_NORMAL}}
6566

6667

6768

@@ -73,11 +74,11 @@ void main()
7374

7475

7576
#ifdef DOUBLE_SIDED
76-
if(!gl_FrontFacing) viewSpaceNormal *= -1.0;
77+
if(!gl_FrontFacing) normal *= -1.0;
7778
#endif
7879

7980
#ifdef CALC_SSNORMALS
80-
viewSpaceNormal = CalculateScreenSpaceNormals();
81+
normal = CalculateScreenSpaceNormals();
8182
#endif
8283

8384

@@ -95,28 +96,28 @@ void main()
9596

9697
tangent = c1;
9798
tangent = normalize(tangent);
98-
binormal = cross(viewSpaceNormal, tangent);
99+
binormal = cross(normal, tangent);
99100
binormal = normalize(binormal);
100101
#endif
101102

102103
#ifndef CALC_TANGENT
103104
tangent = normalize(normalMatrix * vTangent);
104105
vec3 bitangent = normalize(normalMatrix * vBiTangent);
105-
binormal = normalize(cross(viewSpaceNormal, bitangent));
106+
binormal = normalize(cross(normal, bitangent));
106107
#endif
107108

108109
normalFromMap = normalize(
109110
tangent * normalFromMap.x
110111
+ binormal * normalFromMap.y
111-
+ viewSpaceNormal * normalFromMap.z
112+
+ normal * normalFromMap.z
112113
);
113114

114-
vec3 mixedNormal = normalize(viewSpaceNormal + normalFromMap * normalMapIntensity);
115+
vec3 mixedNormal = normalize(normal + normalFromMap * normalMapIntensity);
115116

116-
viewSpaceNormal = mixedNormal;
117+
normal = mixedNormal;
117118
#endif
118119

119-
vec4 col = texture(texMatcap, getMatCapUV(viewSpacePosition, viewSpaceNormal));
120+
vec4 col = texture(texMatcap, getMatCapUV(viewSpacePosition, normal));
120121

121122
#ifdef HAS_DIFFUSE_TEXTURE
122123
col = col*texture(texDiffuse, texCoords);

src/ops/base/Ops.Html.CompareImages_v2/Ops.Html.CompareImages_v2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function compare()
5656
if (data.getImageDataUrl) outImageUrl.set(data.getImageDataUrl());
5757
outSameDimensions.set(data.isSameDimensions);
5858
outMatchPercentage.set(data.rawMisMatchPercentage);
59-
outData.set(data);
59+
outData.setRef(data);
6060
loadingId = op.patch.loading.finished(loadingId);
6161
outFinished.trigger();
6262

src/ops/base/Ops.Html.QuerySelector_v2/Ops.Html.QuerySelector_v2.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function update()
2626
const q = queryPort.get();
2727
if (!q)
2828
{
29-
elementPort.set(null);
29+
elementPort.setRef(null);
3030
return;
3131
}
3232
const theDocument = inSource.get();
@@ -39,7 +39,7 @@ function update()
3939
{
4040
htmlDoc = parser.parseFromString(theDocument, inMimeType.get());
4141
const el = htmlDoc.querySelector(q);
42-
elementPort.set(el);
42+
elementPort.setRef(el);
4343
}
4444
catch (e)
4545
{
@@ -52,7 +52,7 @@ function update()
5252
try
5353
{
5454
const el = document.querySelector(q);
55-
elementPort.set(el);
55+
elementPort.setRef(el);
5656
}
5757
catch (e)
5858
{

src/ops/base/Ops.Ui.VizString/Ops.Ui.VizString.js

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ inStr.onLinkChanged = () =>
1919
{
2020
lines = [];
2121
inStr.set(null);
22+
23+
op.setUiAttrib({ "extendTitle": "" });
24+
}
25+
else
26+
{
27+
const pp = inStr.links[0].getOtherPort(inStr);
28+
if (pp) op.setUiAttrib({ "extendTitle": pp.name });
2229
}
2330
};
2431

src/ops/base/Ops.Ui.VizString/Ops.Ui.VizString.json

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
"type": "feature",
3131
"author": "pandur",
3232
"date": 1714486826698
33+
},
34+
{
35+
"message": "Show connected port name as extended title",
36+
"type": "improvement",
37+
"author": "pandur",
38+
"date": 1741686439258
3339
}
3440
],
3541
"authorName": "pandur",
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const val = op.outTexture("Value");
22
op.varName = op.inValueSelect("Variable", [], "", true);
33

4-
new CABLES.VarGetOpWrapper(op, "object", op.varName, val);
4+
new CABLES.VarGetOpWrapper(op, "texture", op.varName, val);

src/ops/base/Ops.Vars.VarGetTexture_v2/Ops.Vars.VarGetTexture_v2.json

+6-11
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,21 @@
1818
"vargetset"
1919
],
2020
"layout": {
21-
"portsIn": [
22-
{
23-
"type": "0",
24-
"name": "Variable",
25-
"subType": "string"
26-
}
27-
],
21+
"portsIn": [],
2822
"portsOut": [
2923
{
30-
"type": "2",
31-
"name": "Value"
24+
"type": 2,
25+
"name": "Value",
26+
"objType": "texture"
3227
}
3328
]
3429
},
3530
"summary": "get a texture from a variable",
3631
"issues": "",
37-
3832
"youtubeids": [],
3933
"docs": {
4034
"ports": []
4135
},
42-
"exampleProjectId": "lkS998"
36+
"exampleProjectId": "lkS998",
37+
"license": "MIT"
4338
}

0 commit comments

Comments
 (0)