Skip to content

Commit

Permalink
Added GLSL 1.20 Starfield shaders for macOS compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fo76utils committed Aug 23, 2024
1 parent 05c7e16 commit 266b009
Show file tree
Hide file tree
Showing 7 changed files with 849 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
- name: 'Create DMG image'
run: |
rm release/shaders/stf_default.*
cp res/stf_compat.* release/shaders/
mv release/*.xml release/shaders release/qt.conf release/style.qss release/*.txt release/NifSkope.app/Contents/MacOS/
macdeployqt release/NifSkope.app -dmg
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Skyrim and Fallout 4 shader property data is no longer moved to a sub-structure of BSLightingShaderProperty or BSEffectShaderProperty.
* Fixed the geometry of docked widgets not being restored.
* Fixed invisible Oblivion models with Mesa (and possibly other) OpenGL drivers.
* Fixed error messages on macOS about unsupported GLSL version in the shaders. Note that Starfield shading is currently disabled on macOS.
* Fixed error messages on macOS about unsupported GLSL version in the shaders.

#### NifSkope-2.0.dev9-20240818

Expand Down
13 changes: 2 additions & 11 deletions res/shaders/stf_default.frag
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ struct Material {
vec4 color;
// bit 0 = color override mode (0: multiply, 1: lerp)
// bit 1 = use vertex color as tint (1: yes)
// bits 2 to 8 = flipbook columns (0: not a flipbook)
// bits 9 to 15 = flipbook rows (0: not a flipbook)
// bits 16 to 29 = flipbook frame
// bit 2 = is a flipbook
int flags;
TextureSet textureSet;
};
Expand Down Expand Up @@ -440,13 +438,6 @@ void main()
break;

vec2 offset = getTexCoord( lm.layers[i].uvStream );
if ( (lm.layers[i].material.flags & 0xFFFC) != 0 ) {
// flipbook
int w = ( lm.layers[i].material.flags >> 2 ) & 0x7F;
int h = ( lm.layers[i].material.flags >> 9 ) & 0x7F;
int n = lm.layers[i].material.flags >> 16;
offset = ( offset + vec2( float(n % w), float(n / w) ) ) / vec2( float(w), float(h) );
}

float layerMask = 1.0;
float f = 1.0;
Expand Down Expand Up @@ -546,7 +537,7 @@ void main()
baseMap.a = a;
}
} else if ( lm.alphaSettings.hasOpacity && i == lm.alphaSettings.opacitySourceLayer ) {
if ( (lm.layers[i].material.flags & 0xFFFC) == 0 )
if ( (lm.layers[i].material.flags & 4) == 0 )
baseMap.a = getLayerTexture( i, 2, getTexCoord(lm.alphaSettings.opacityUVstream) ).r;
else
baseMap.a = getLayerTexture( i, 2, offset ).r;
Expand Down
Loading

0 comments on commit 266b009

Please sign in to comment.