<commit_before><!--
  Copyright (C) 2007 by <NAME>
	    (C) 2007 by <NAME>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-->
<snippet type="compound">
  <technique priority="100">
    <snippet id="eyeVecObj" file="/shader/snippets/eye-direction-obj.xml" />
    
    <snippet id="parallax">
      <technique priority="100">
	<combiner name="cg" plugin="crystalspace.graphics3d.shader.combiner.glcg" />
	
	<input file="/shader/snippets/texCoord.inp"	
	  condition='vars."tex height".texture' />
	
	<!-- vector pointing to eye, in tangent space -->
	<input name="eyeVec" type="direction_tangent" />
	
	<input name="texHeight" type="tex2d" default="complex"
	    condition='vars."tex height".texture'>
	  <block location="pass">
	    <texture name="tex height" destination="fragmentIn.texHeight" />
	  </block>
	  
	  <block location="cg:fragmentIn">
	    <uniform type="tex2d" name="texHeight" />
	  </block>
	  
	  <block location="cg:fragmentMain">
	    texHeight = fragmentIn.texHeight;
	  </block>
	</input>
       
	<block location="cg:definitions">
	  <?Include /shader/snippets/cg-common.cginc?>
	</block>
	
	<block location="cg:variablemap">
	  <variablemap variable="tex height scale" 
	    destination="vertexIn.tcScale" />
	</block>
	
	<block location="cg:vertexIn">
	  <varying type="float2" name="tcScale" />
	</block>
	  
	<block location="cg:vertexToFragment">
	  <varying type="float3" name="eyeVec" />
	  <varying type="float2" name="tcParallax" />
	</block>
	
	<block location="cg:vertexMain">
	  <?if vars."tex height".texture ?>
	    <?if vars."tex height scale" 
	      && ((vars."tex height scale".x != 1) 
		|| (vars."tex height scale".y != 1)) ?>
	      vertexToFragment.tcParallax = texCoord * tcScale; 
	    <?endif?>
	  <?endif?>
	  // In case the coords are used on the VP side...
	  texCoordOffset = texCoord;
	</block>
	
	<block location="cg:fragmentMain">
	  float2 offset = float2 (0, 0);
	  <?if vars."tex height".texture ?>
	    float2 usedTC;
	    <?if vars."tex height scale" 
		&& ((vars."tex height scale".x != 1) 
		|| (vars."tex height scale".y != 1)) ?>
	    usedTC = vertexToFragment.tcParallax;
	    <?else?>
	    usedTC = texCoord;
	    <?endif?>
	    offset = ComputeParallaxOffset (texHeight, usedTC, 
	      -normalize (eyeVec), 0.04);
	  <?endif?>
	  texCoordOffset = texCoord + offset;
	</block>
	
	<output name="texCoordOffset" type="texcoord2" />
      </technique>
    </snippet>
    <connection from="eyeVecObj" to="parallax" />
  </technique>
  
  <technique priority="50">
    <snippet id="parallax">
      <technique priority="100">
	<combiner name="cg" plugin="crystalspace.graphics3d.shader.combiner.glcg" />
	
	<input file="/shader/snippets/texCoord.inp"	
	  condition='vars."tex height".texture' />
	
	<block location="cg:vertexMain">
	  // In case the coords are used on the VP side...
	  texCoordOffset = texCoord;
	</block>
	
	<block location="cg:fragmentMain">
	  texCoordOffset = texCoord;
	</block>
	
	<output name="texCoordOffset" type="texcoord2" />
      </technique>
    </snippet>
  </technique>
</snippet><commit_msg>Simplified parallax snippet by removing unnecessary check for the scale value<commit_after><!--
  Copyright (C) 2007 by <NAME>
	    (C) 2007 by <NAME>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-->
<snippet type="compound">
  <technique priority="100">
    <snippet id="eyeVecObj" file="/shader/snippets/eye-direction-obj.xml" />
    
    <snippet id="parallax">
      <technique priority="100">
	<combiner name="cg" plugin="crystalspace.graphics3d.shader.combiner.glcg" />
	
	<input file="/shader/snippets/texCoord.inp" />
	
	<!-- vector pointing to eye, in tangent space -->
	<input name="eyeVec" type="direction_tangent" />
	
	<input name="texHeight" type="tex2d" default="complex">
	  <block location="pass">
	    <texture name="tex height" destination="fragmentIn.texHeight" />
	  </block>
	  
	  <block location="cg:fragmentIn">
	    <uniform type="tex2d" name="texHeight" />
	  </block>
	  
	  <block location="cg:fragmentMain">
	    texHeight = fragmentIn.texHeight;
	  </block>
	</input>
       
	<block location="cg:definitions">
	  <?Include /shader/snippets/cg-common.cginc?>
	</block>
	
	<input name="tcScaleOffs" type="float4" default="complex">
	  <block location="shadervars">
	    <shadervar name="tex height scale" type="vector4">1,1,0,0</shadervar>
	  </block>
	  
	  <block location="cg:fragmentIn">
	    <uniform type="float4" name="tcScaleOffs" />
	  </block>
	  
	  <block location="cg:fragmentMain">
	    tcScaleOffs = fragmentIn.tcScaleOffs;
	  </block>
	
	  <block location="cg:variablemap">
	    <variablemap variable="tex height scale" 
			 destination="fragmentIn.tcScaleOffs" />
	  </block>
	</input>
	
	<block location="cg:vertexMain">
	  // In case the coords are used on the VP side...
	  texCoordOffset = texCoord;
	</block>
	
	<block location="cg:fragmentMain">
	  float2 offset = float2 (0, 0);
	  <?if vars."tex height".texture ?>
	    float2 usedTC;
	    usedTC = texCoord * tcScaleOffs.xy + tcScaleOffs.zw; 
	    offset = ComputeParallaxOffset (texHeight, usedTC, 
	      -normalize (eyeVec), 0.04);
	  <?endif?>
	  texCoordOffset = texCoord + offset;
	</block>
	
	<output name="texCoordOffset" type="texcoord2" />
      </technique>
    </snippet>
    <connection from="eyeVecObj" to="parallax" />
  </technique>
  
  <technique priority="50">
    <snippet id="parallax">
      <technique priority="100">
	<combiner name="cg" plugin="crystalspace.graphics3d.shader.combiner.glcg" />
	
	<input file="/shader/snippets/texCoord.inp" />
	
	<block location="cg:vertexMain">
	  // In case the coords are used on the VP side...
	  texCoordOffset = texCoord;
	</block>
	
	<block location="cg:fragmentMain">
	  texCoordOffset = texCoord;
	</block>
	
	<output name="texCoordOffset" type="texcoord2" />
      </technique>
    </snippet>
  </technique>
</snippet>
{'fraction_non_alphanumeric': 0.13791666666666666, 'fraction_numerical': 0.01361111111111111, 'mean_word_length': 3.5895474824729128, 'pattern_counts': {'":': 0, '<': 134, '<?xml version=': 0, '>': 134, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5924552', 'n_tokens_mistral': 2469, 'n_tokens_neox': 2243, 'n_words': 640}