.. | .. |
---|
1819 | 1819 | |
---|
1820 | 1820 | display.modelParams7[0] = 0; |
---|
1821 | 1821 | display.modelParams7[1] = 1000; |
---|
1822 | | - display.modelParams7[2] = 0; |
---|
| 1822 | + display.modelParams7[2] = material.parallax; |
---|
1823 | 1823 | display.modelParams7[3] = 0; |
---|
1824 | 1824 | |
---|
1825 | 1825 | //display.modelParams6[0] = 100; // criss de bug de bump |
---|
.. | .. |
---|
12593 | 12593 | "PARAM params4 = program.env[4];" + // anisoV, cameralight, selfshadow, shadow |
---|
12594 | 12594 | "PARAM params5 = program.env[5];" + // texture, opacity, fakedepth, shadowbias |
---|
12595 | 12595 | "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough |
---|
12596 | | - "PARAM params7 = program.env[7];" + // noise power, opacity power |
---|
| 12596 | + "PARAM params7 = program.env[7];" + // noise power, opacity power, parallax |
---|
12597 | 12597 | "PARAM options0 = program.env[63];" + // fog density, intensity, elevation |
---|
12598 | 12598 | "PARAM options1 = program.env[62];" + // fog rgb color |
---|
12599 | 12599 | "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen |
---|
.. | .. |
---|
12838 | 12838 | "POW texSamp.a, texSamp.a, params6.w;" + // fog punch through shortcut |
---|
12839 | 12839 | // mar 2013 ??? "KIL alpha.a;" + |
---|
12840 | 12840 | "MOV alpha, texSamp.aaaa;" + // y;" + |
---|
12841 | | - "KIL alpha.a;" + |
---|
| 12841 | + "KIL alpha.a;" + // not sure with parallax mapping |
---|
12842 | 12842 | /* |
---|
12843 | 12843 | "MUL temp.xy, temp, two;" + |
---|
12844 | 12844 | "TXB bump, temp, texture[0], 2D;" + |
---|
.. | .. |
---|
12924 | 12924 | "SUB bump0, bump0, half;" + |
---|
12925 | 12925 | "ADD bump, bump, bump0;" + |
---|
12926 | 12926 | |
---|
12927 | | - "MOV temp.x, texSamp.a;" + |
---|
12928 | | - "LRP texSamp, params5.x, texSamp, one;" + // texture proportion |
---|
12929 | | - //"LRP texSamp0, params5.x, texSamp0, one;" + |
---|
12930 | | - "MOV texSamp.a, temp.x;" + |
---|
12931 | | - |
---|
12932 | 12927 | // double-sided |
---|
12933 | 12928 | /**/ |
---|
12934 | 12929 | (doublesided?"DP3 temp.z, normal, eye;" + |
---|
.. | .. |
---|
12958 | 12953 | Normalize("U") + |
---|
12959 | 12954 | |
---|
12960 | 12955 | // parallax mapping |
---|
| 12956 | + |
---|
| 12957 | + "DP3 temp2.x, V, eye;" + |
---|
| 12958 | + "DP3 temp2.y, U, eye;" + |
---|
| 12959 | + "DP3 temp2.z, normal, eye;" + |
---|
| 12960 | + "RCP temp2.z, temp2.z;" + |
---|
| 12961 | + |
---|
| 12962 | + "DP3 temp2.w, texSamp, texSamp;" + // Height |
---|
| 12963 | + "RSQ temp2.w, temp2.w;" + |
---|
| 12964 | + "RCP temp2.w, temp2.w;" + |
---|
| 12965 | + |
---|
| 12966 | + "SUB temp2.w, temp2.w, half;" + |
---|
| 12967 | +// "SGE temp.x, temp2.w, eps.x;" + |
---|
| 12968 | +// "MUL temp2.w, temp2.w, temp.x;" + |
---|
| 12969 | + |
---|
| 12970 | + //"MOV texSamp, U;" + |
---|
| 12971 | + |
---|
| 12972 | + "MUL temp2.z, temp2.z, temp2.w;" + |
---|
| 12973 | + "MUL temp2.z, temp2.z, params7.z;" + // parallax |
---|
| 12974 | + |
---|
| 12975 | + "MUL temp2, temp2, temp2.z;" + |
---|
| 12976 | + |
---|
| 12977 | + "MOV temp, fragment.texcoord[0];" + |
---|
| 12978 | + |
---|
| 12979 | + "SUB temp, temp, temp2;" + |
---|
| 12980 | + |
---|
| 12981 | + "TEX texSamp, temp, texture[0], 2D;" + |
---|
| 12982 | + "POW texSamp.a, texSamp.a, params6.w;" + // punch through |
---|
| 12983 | + "MOV alpha, texSamp.aaaa;" + |
---|
| 12984 | + |
---|
| 12985 | +// parallax mapping |
---|
| 12986 | + |
---|
| 12987 | + "MOV temp.x, texSamp.a;" + |
---|
| 12988 | + "LRP texSamp, params5.x, texSamp, one;" + // texture proportion |
---|
| 12989 | + //"LRP texSamp0, params5.x, texSamp0, one;" + |
---|
| 12990 | + "MOV texSamp.a, temp.x;" + |
---|
12961 | 12991 | |
---|
12962 | 12992 | //"MOV temp, fragment.texcoord[0];" + |
---|
12963 | 12993 | // |
---|
.. | .. |
---|
13739 | 13769 | /*static*/ float[] modelParams4 = new float[]{0, 0, 0, 0}; // anisoV, cameralight, selfshadow, shadow |
---|
13740 | 13770 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13741 | 13771 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13742 | | - /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
| 13772 | + /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power, parallax |
---|
13743 | 13773 | |
---|
13744 | 13774 | //Object3D.cVector2[] vector2buffer; |
---|
13745 | 13775 | |
---|
.. | .. |
---|
936 | 936 | cGridBag currenttab; |
---|
937 | 937 | //boolean added; // patch for jar |
---|
938 | 938 | |
---|
| 939 | + int totalcount = 0; |
---|
| 940 | + |
---|
939 | 941 | int tabcount = 0; |
---|
940 | 942 | int colcount = 0; |
---|
941 | 943 | int rowcount = 0; |
---|
.. | .. |
---|
974 | 976 | } |
---|
975 | 977 | |
---|
976 | 978 | AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab); |
---|
| 979 | + totalcount++; |
---|
977 | 980 | |
---|
978 | 981 | if (++colcount >= columns) |
---|
979 | 982 | { |
---|
.. | .. |
---|
999 | 1002 | container.add(resourcecontainer); |
---|
1000 | 1003 | |
---|
1001 | 1004 | Grafreed.ParseResources("textures", this); |
---|
| 1005 | + |
---|
| 1006 | + // 935. System.out.println("Total = " + totalcount); |
---|
1002 | 1007 | } |
---|
1003 | 1008 | |
---|
1004 | 1009 | void SetupUI2(ObjEditor oe) |
---|
.. | .. |
---|
2682 | 2682 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
2683 | 2683 | colorSection.add(backlit); |
---|
2684 | 2684 | |
---|
| 2685 | + cGridBag parallax = new cGridBag(); |
---|
| 2686 | + parallax.add(parallaxLabel = new JLabel("Parallax")); // , aConstraints); |
---|
| 2687 | + parallaxLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 2688 | + parallax.add(parallaxField = new cNumberSlider(this, 0.001, 0.5, -0.25)); // , aConstraints); |
---|
| 2689 | + colorSection.add(parallax); |
---|
| 2690 | + |
---|
2685 | 2691 | //panel.add(new JSeparator()); |
---|
2686 | 2692 | |
---|
2687 | 2693 | //panel.add(globalSection); |
---|
.. | .. |
---|
3733 | 3739 | shadowField.setFloat(mat.shadow); |
---|
3734 | 3740 | textureField.setFloat(mat.texture); |
---|
3735 | 3741 | opacityField.setFloat(mat.opacity); |
---|
| 3742 | + parallaxField.setFloat(mat.parallax + 0.25f); |
---|
3736 | 3743 | fakedepthField.setFloat(mat.fakedepth); |
---|
3737 | 3744 | shadowbiasField.setFloat(mat.shadowbias); |
---|
3738 | 3745 | bumpField.setInteger(1); // dec 2013 |
---|
.. | .. |
---|
4957 | 4964 | current.shadow = (float) shadowField.getFloat(); |
---|
4958 | 4965 | current.texture = (float) textureField.getFloat(); |
---|
4959 | 4966 | current.opacity = (float) opacityField.getFloat(); |
---|
| 4967 | + current.parallax = (float) parallaxField.getFloat() - 0.25f; |
---|
4960 | 4968 | current.fakedepth = (float) fakedepthField.getFloat(); |
---|
4961 | 4969 | current.shadowbias = (float) shadowbiasField.getFloat(); |
---|
4962 | 4970 | |
---|
.. | .. |
---|
5011 | 5019 | textureField.SetToolTipValue((mat.texture)); |
---|
5012 | 5020 | if (!Equal(opacityField.getFloat(), mat.opacity)) |
---|
5013 | 5021 | opacityField.SetToolTipValue((mat.opacity)); |
---|
| 5022 | + //if (!Equal(parallaxField.getFloat(), mat.parallax)) |
---|
| 5023 | + parallaxField.SetToolTipValue((mat.parallax)); |
---|
5014 | 5024 | if (!Equal(fakedepthField.getFloat(), mat.fakedepth)) |
---|
5015 | 5025 | fakedepthField.SetToolTipValue((mat.fakedepth)); |
---|
5016 | 5026 | if (!Equal(shadowbiasField.getFloat(), mat.shadowbias)) |
---|
.. | .. |
---|
6267 | 6277 | cNumberSlider textureField; |
---|
6268 | 6278 | JLabel opacityLabel; |
---|
6269 | 6279 | cNumberSlider opacityField; |
---|
| 6280 | + JLabel parallaxLabel; |
---|
| 6281 | + cNumberSlider parallaxField; |
---|
6270 | 6282 | JLabel fakedepthLabel; |
---|
6271 | 6283 | cNumberSlider fakedepthField; |
---|
6272 | 6284 | JLabel shadowbiasLabel; |
---|
.. | .. |
---|
34 | 34 | shadow = val; |
---|
35 | 35 | texture = val; |
---|
36 | 36 | opacity = val; |
---|
| 37 | + parallax = val; |
---|
37 | 38 | fakedepth = val; |
---|
38 | 39 | shadowbias = val; |
---|
39 | 40 | } |
---|
.. | .. |
---|
71 | 72 | shadow = mat.shadow; |
---|
72 | 73 | texture = mat.texture; |
---|
73 | 74 | opacity = mat.opacity; |
---|
| 75 | + parallax = mat.parallax; |
---|
74 | 76 | fakedepth = mat.fakedepth; |
---|
75 | 77 | shadowbias = mat.shadowbias; |
---|
76 | 78 | |
---|
.. | .. |
---|
105 | 107 | shadow *= Factor(anchor.shadow, current.shadow); |
---|
106 | 108 | texture *= Factor(anchor.texture, current.texture); |
---|
107 | 109 | opacity *= Factor(anchor.opacity, current.opacity); |
---|
| 110 | +// if (anchor.parallax == 0) |
---|
| 111 | +// anchor.parallax = 0.001f; |
---|
| 112 | + //parallax *= Factor(anchor.parallax, current.parallax); |
---|
| 113 | + parallax = current.parallax; |
---|
108 | 114 | fakedepth *= Factor(anchor.fakedepth, current.fakedepth); |
---|
109 | 115 | shadowbias *= Factor(anchor.shadowbias, current.shadowbias); |
---|
110 | 116 | } |
---|
111 | 117 | |
---|
112 | 118 | float Factor(float anchor, float current) |
---|
113 | 119 | { |
---|
114 | | - if (anchor <= 0) |
---|
115 | | - { |
---|
116 | | - assert anchor > 0; |
---|
117 | | - } |
---|
| 120 | + Grafreed.Assert(anchor > 0); |
---|
118 | 121 | |
---|
119 | 122 | return current / anchor; |
---|
120 | 123 | } |
---|
.. | .. |
---|
364 | 367 | float sheen = 1f, subsurface = 0.001f, bump = 0.75f, aniso = 0.001f, anisoV = 0.001f; |
---|
365 | 368 | float cameralight = 0.3f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1; |
---|
366 | 369 | float fakedepth = 0.5f, shadowbias = 0.01f; // 0.001f; |
---|
| 370 | + |
---|
| 371 | + float parallax = 0; |
---|
367 | 372 | |
---|
368 | 373 | boolean multiply; |
---|
369 | 374 | |
---|