mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 00:07:24 +00:00
*** empty log message ***
This commit is contained in:
parent
931ab0641d
commit
53e0afc0ca
1
docs/license.txt
Normal file
1
docs/license.txt
Normal file
@ -0,0 +1 @@
|
||||
GPL license and some notes...
|
||||
44
src/meshlab/shaders/polkadot3d.frag
Normal file
44
src/meshlab/shaders/polkadot3d.frag
Normal file
@ -0,0 +1,44 @@
|
||||
//
|
||||
// Fragment shader for 3 dimensional polka dot shader.
|
||||
//
|
||||
// Author: Joshua Doss
|
||||
//
|
||||
// Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
|
||||
//
|
||||
// See 3Dlabs-License.txt for license information
|
||||
//
|
||||
varying float LightIntensity;
|
||||
varying vec3 MCPosition;
|
||||
|
||||
//Create uniform variables so dots can be spaced and scaled by user
|
||||
uniform vec3 Spacing;
|
||||
uniform float DotSize;
|
||||
|
||||
//Create colors as uniform variables so they can be easily changed
|
||||
uniform vec3 ModelColor, PolkaDotColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float insidesphere, sphereradius, scaledpointlength;
|
||||
vec3 scaledpoint, finalcolor;
|
||||
|
||||
// Scale the coordinate system
|
||||
// The following line of code is not yet implemented in current drivers:
|
||||
// mcpos = mod(Spacing, MCposition);
|
||||
// We will use a workaround found below for now
|
||||
scaledpoint = MCPosition - (Spacing * floor(MCPosition/Spacing));
|
||||
|
||||
// Bring the scaledpoint vector into the center of the scaled coordinate system
|
||||
scaledpoint = scaledpoint - Spacing/2.0;
|
||||
|
||||
// Find the length of the scaledpoint vector and compare it to the dotsize
|
||||
scaledpointlength = length(scaledpoint);
|
||||
insidesphere = step(scaledpointlength,DotSize);
|
||||
|
||||
// Determine final output color before lighting
|
||||
finalcolor = vec3(mix(ModelColor, PolkaDotColor, insidesphere));
|
||||
|
||||
// Output final color and factor in lighting
|
||||
gl_FragColor = clamp((vec4( finalcolor, 1.0 ) * LightIntensity), vec4(0.0), vec4(1.0));
|
||||
}
|
||||
|
||||
65
src/meshlab/shaders/polkadot3d.gdp
Normal file
65
src/meshlab/shaders/polkadot3d.gdp
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<GLSLang>
|
||||
<Metadata>
|
||||
<Author Author="" />
|
||||
<Email Email="" />
|
||||
<Company Company="" />
|
||||
<Shader Shader="" />
|
||||
<ShaderDescription ShaderDescription="" />
|
||||
<License License="" />
|
||||
<Version Version="" />
|
||||
</Metadata>
|
||||
<VPCount numero="1">
|
||||
<Filenames>
|
||||
<Filename0 VertexProgram="polkadot3d.vert" />
|
||||
</Filenames>
|
||||
</VPCount>
|
||||
<FPCount numero="1">
|
||||
<Filenames>
|
||||
<Filename0 FragmentProgram="polkadot3d.frag" />
|
||||
</Filenames>
|
||||
</FPCount>
|
||||
<TexturesPlugins NumberOfPlugins="0" />
|
||||
<TexturedUsed NumberUsedTU="0" />
|
||||
<UniformVariables NumberOfVariables="6">
|
||||
<Uniform0 Type="7" Name="LightPosition" ArraySize="1" Widget="0" Min="0" Max="1" Step="0.005">
|
||||
<Values Value0="0" Value1="4" Value2="5" />
|
||||
</Uniform0>
|
||||
<Uniform1 Type="5" Name="SpecularContribution" ArraySize="1" Widget="0" Min="0" Max="1" Step="0.005">
|
||||
<Values Value0="0.36" />
|
||||
</Uniform1>
|
||||
<Uniform2 Type="7" Name="Spacing" ArraySize="1" Widget="2" Min="0" Max="1" Step="0.001">
|
||||
<Values Value0="0.314" Value1="0.36" Value2="0.261" />
|
||||
</Uniform2>
|
||||
<Uniform3 Type="5" Name="DotSize" ArraySize="1" Widget="2" Min="0" Max="1" Step="0.001">
|
||||
<Values Value0="0.123" />
|
||||
</Uniform3>
|
||||
<Uniform4 Type="7" Name="ModelColor" ArraySize="1" Widget="0" Min="0" Max="1" Step="0.005">
|
||||
<Values Value0="0.75" Value1="0.2" Value2="0.1" />
|
||||
</Uniform4>
|
||||
<Uniform5 Type="7" Name="PolkaDotColor" ArraySize="1" Widget="0" Min="0" Max="1" Step="0.005">
|
||||
<Values Value0="1" Value1="1" Value2="1" />
|
||||
</Uniform5>
|
||||
</UniformVariables>
|
||||
<FogParameters FogColorR="0" FogColorG="0" FogColorB="0" FogColorA="1" Density="1" Start="0" End="1" />
|
||||
<VertexProcessor CullFace="True" PolygonMode="DummieField" PolygonModeBack="6914" PolygonModeFront="6914" LocalValue="1" TwoSidedValue="0" ColorControlValue="33273" />
|
||||
<FragmentProcessor Shade="7425" AlphaTest="False" AlphaFunc="516" AlphaClamp="0.5" Blending="False" BlendFuncSRC="770" BlendFuncDST="771" BlendEquation="32774" DepthTest="True" DepthFunc="515" ClampNear="0" ClampFar="1" ClearColorR="0.5019608" ClearColorG="0.5019608" ClearColorB="0.5019608" ClearColorA="1" />
|
||||
<MotionData Speed="0.05" Distance="4" Rotation="False" />
|
||||
<BuiltInStates>
|
||||
<ModelAmbient AmbientR="0" AmbientG="0" AmbientB="0" AmbientA="0" />
|
||||
<FrontMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0.8000001" DifG="0.8000001" DifB="0.8000001" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" EmiR="0" EmiG="0" EmiB="0" EmiA="1" Shininess="0" />
|
||||
<BackMaterial AmbR="0.2" AmbG="0.2" AmbB="0.2" AmbA="1" DifR="0.8000001" DifG="0.8000001" DifB="0.8000001" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" EmiR="0" EmiG="0" EmiB="0" EmiA="1" Shininess="0" />
|
||||
<PointParameters Size="1" MinSize="0" MaxSize="1" Threshold="1" ConstantAttenuation="1" LinearAttenuation="0" QuadraticAttenuation="0" />
|
||||
<Light0 Enabled="True" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="1" DifG="1" DifB="1" DifA="1" SpecR="1" SpecG="1" SpecB="1" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
<Light1 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
<Light2 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
<Light3 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
<Light4 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
<Light5 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
<Light6 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
<Light7 Enabled="False" PosX="0" PosY="0" PosZ="1" PosW="0" AmbR="0" AmbG="0" AmbB="0" AmbA="1" DifR="0" DifG="0" DifB="0" DifA="1" SpecR="0" SpecG="0" SpecB="0" SpecA="1" SpotDirX="0" SpotDirY="0" SpotDirZ="-1" SpotExp="0" SpotCutoff="180" SpotConstant="1" SpotLinear="0" SpotQuadratic="0" />
|
||||
</BuiltInStates>
|
||||
<BackGround>
|
||||
<BackGroundMode Mode="0" />
|
||||
</BackGround>
|
||||
</GLSLang>
|
||||
55
src/meshlab/shaders/polkadot3d.vert
Normal file
55
src/meshlab/shaders/polkadot3d.vert
Normal file
@ -0,0 +1,55 @@
|
||||
// This is the Vertex Shader for three dimensional polka dots.
|
||||
//
|
||||
// author(s): Joshua Doss
|
||||
//
|
||||
// Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
|
||||
|
||||
//Create uniform variables for lighting to allow user interaction
|
||||
uniform float SpecularContribution;
|
||||
uniform vec3 LightPosition;
|
||||
|
||||
varying vec3 MCPosition;
|
||||
varying float LightIntensity;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float diffusecontribution = 1.0 - SpecularContribution;
|
||||
|
||||
// compute the vertex position in eye coordinates
|
||||
vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
// compute the transformed normal
|
||||
vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
|
||||
|
||||
// compute a vector from the model to the light position
|
||||
vec3 lightVec = normalize(LightPosition - ecPosition);
|
||||
|
||||
// compute the reflection vector
|
||||
vec3 reflectVec = reflect(-lightVec, tnorm);
|
||||
|
||||
// compute a unit vector in direction of viewing position
|
||||
vec3 viewVec = normalize(-ecPosition);
|
||||
|
||||
// calculate amount of diffuse light based on normal and light angle
|
||||
float diffuse = max(dot(lightVec, tnorm), 0.0);
|
||||
float spec = 0.0;
|
||||
|
||||
// if there is diffuse lighting, calculate specular
|
||||
if(diffuse > 0.0)
|
||||
{
|
||||
spec = max(dot(reflectVec, viewVec), 0.0);
|
||||
spec = pow(spec, 16.0);
|
||||
}
|
||||
|
||||
// add up the light sources, since this is a varying (global) it will pass to frag shader
|
||||
LightIntensity = diffusecontribution * diffuse * 1.5 +
|
||||
SpecularContribution * spec;
|
||||
|
||||
// the varying variable MCPosition will be used by the fragment shader to determine where
|
||||
// in model space the current pixel is
|
||||
MCPosition = vec3 (gl_Vertex);
|
||||
|
||||
// send vertex information
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
}
|
||||
|
||||
BIN
src/sample/texturedknot.ply
Normal file
BIN
src/sample/texturedknot.ply
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user