mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-27 15:54:25 +02:00
Use custom shader for 3d model.
This commit is contained in:
parent
7e37e1c382
commit
c6e101bd3f
Binary file not shown.
@ -45,7 +45,9 @@
|
|||||||
|
|
||||||
Public GameOptions As GameOptions
|
Public GameOptions As GameOptions
|
||||||
|
|
||||||
Public sampler As SamplerState
|
Public Sampler As SamplerState
|
||||||
|
|
||||||
|
Public ModelSampler As SamplerState
|
||||||
|
|
||||||
Public BackgroundColor As Color = New Color(173, 216, 255)
|
Public BackgroundColor As Color = New Color(173, 216, 255)
|
||||||
|
|
||||||
@ -85,14 +87,19 @@
|
|||||||
|
|
||||||
GameMessage = New GameMessage(Nothing, New Size(0, 0), New Vector2(0, 0))
|
GameMessage = New GameMessage(Nothing, New Size(0, 0), New Vector2(0, 0))
|
||||||
|
|
||||||
sampler = New SamplerState()
|
Sampler = New SamplerState()
|
||||||
sampler.Filter = TextureFilter.Point
|
Sampler.Filter = TextureFilter.Point
|
||||||
sampler.AddressU = TextureAddressMode.Clamp
|
Sampler.AddressU = TextureAddressMode.Clamp
|
||||||
sampler.AddressV = TextureAddressMode.Clamp
|
Sampler.AddressV = TextureAddressMode.Clamp
|
||||||
|
|
||||||
|
ModelSampler = New SamplerState()
|
||||||
|
ModelSampler.Filter = TextureFilter.Point
|
||||||
|
ModelSampler.AddressU = TextureAddressMode.Wrap
|
||||||
|
ModelSampler.AddressV = TextureAddressMode.Wrap
|
||||||
|
|
||||||
ServersManager = New Servers.ServersManager()
|
ServersManager = New Servers.ServersManager()
|
||||||
|
|
||||||
GraphicsDevice.SamplerStates(0) = sampler
|
GraphicsDevice.SamplerStates(0) = Sampler
|
||||||
KeyboardInput = New KeyboardInput()
|
KeyboardInput = New KeyboardInput()
|
||||||
|
|
||||||
If CommandLineArgHandler.NoSplash = True Then
|
If CommandLineArgHandler.NoSplash = True Then
|
||||||
@ -193,7 +200,7 @@
|
|||||||
FontRenderer.Begin()
|
FontRenderer.Begin()
|
||||||
GraphicsDevice.DepthStencilState = DepthStencilState.Default
|
GraphicsDevice.DepthStencilState = DepthStencilState.Default
|
||||||
|
|
||||||
GraphicsDevice.SamplerStates(0) = sampler
|
GraphicsDevice.SamplerStates(0) = Sampler
|
||||||
GraphicsDevice.SamplerStates(0) = SamplerState.PointClamp
|
GraphicsDevice.SamplerStates(0) = SamplerState.PointClamp
|
||||||
CurrentScreen.Draw()
|
CurrentScreen.Draw()
|
||||||
|
|
||||||
|
@ -543,7 +543,17 @@
|
|||||||
Public Overridable Sub Draw(ByVal BaseModel As BaseModel, ByVal Textures() As Texture2D, ByVal setRasterizerState As Boolean, Optional Model As Model = Nothing)
|
Public Overridable Sub Draw(ByVal BaseModel As BaseModel, ByVal Textures() As Texture2D, ByVal setRasterizerState As Boolean, Optional Model As Model = Nothing)
|
||||||
If Visible = True Then
|
If Visible = True Then
|
||||||
If Not Model Is Nothing Then
|
If Not Model Is Nothing Then
|
||||||
|
For Each modelMesh As ModelMesh In Model.Meshes
|
||||||
|
For Each modelMeshPart As ModelMeshPart In modelMesh.MeshParts
|
||||||
|
If modelMeshPart.Effect.GetType() = GetType(BasicEffect)
|
||||||
|
Dim effect = New BasicEffectWithAlphaTest(CType(modelMeshPart.Effect, BasicEffect))
|
||||||
|
modelMeshPart.Effect = effect
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
Core.GraphicsDevice.SamplerStates(0) = Core.ModelSampler
|
||||||
Model.Draw(Me.World, Screen.Camera.View, Screen.Camera.Projection)
|
Model.Draw(Me.World, Screen.Camera.View, Screen.Camera.Projection)
|
||||||
|
Core.GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||||
If drawViewBox = True Then
|
If drawViewBox = True Then
|
||||||
BoundingBoxRenderer.Render(ViewBox, Core.GraphicsDevice, Screen.Camera.View, Screen.Camera.Projection, Microsoft.Xna.Framework.Color.Red)
|
BoundingBoxRenderer.Render(ViewBox, Core.GraphicsDevice, Screen.Camera.View, Screen.Camera.Projection, Microsoft.Xna.Framework.Color.Red)
|
||||||
End If
|
End If
|
||||||
@ -661,6 +671,7 @@
|
|||||||
If Not Me.Model Is Nothing Then
|
If Not Me.Model Is Nothing Then
|
||||||
For Each mesh As ModelMesh In Me.Model.Meshes
|
For Each mesh As ModelMesh In Me.Model.Meshes
|
||||||
For Each part As ModelMeshPart In mesh.MeshParts
|
For Each part As ModelMeshPart In mesh.MeshParts
|
||||||
|
If part.Effect.GetType() = GetType(BasicEffect)
|
||||||
With CType(part.Effect, BasicEffect)
|
With CType(part.Effect, BasicEffect)
|
||||||
Lighting.UpdateLighting(CType(part.Effect, BasicEffect))
|
Lighting.UpdateLighting(CType(part.Effect, BasicEffect))
|
||||||
.Alpha = Me.Opacity
|
.Alpha = Me.Opacity
|
||||||
@ -680,6 +691,27 @@
|
|||||||
.FogEnd = Screen.Effect.FogEnd
|
.FogEnd = Screen.Effect.FogEnd
|
||||||
.FogStart = Screen.Effect.FogStart
|
.FogStart = Screen.Effect.FogStart
|
||||||
End With
|
End With
|
||||||
|
Else
|
||||||
|
With CType(part.Effect, BasicEffectWithAlphaTest)
|
||||||
|
Lighting.UpdateLighting(CType(part.Effect, BasicEffectWithAlphaTest))
|
||||||
|
.Alpha = Me.Opacity
|
||||||
|
If Core.GameOptions.LightingEnabled = True Then
|
||||||
|
.DiffuseColor = Screen.Effect.DiffuseColor * Me.Shader * Me.Color
|
||||||
|
Else
|
||||||
|
.DiffuseColor = Screen.Effect.DiffuseColor * Me.Color
|
||||||
|
End If
|
||||||
|
If Not Screen.Level.World Is Nothing Then
|
||||||
|
If Screen.Level.World.EnvironmentType = P3D.World.EnvironmentTypes.Outside Then
|
||||||
|
.DiffuseColor *= SkyDome.GetDaytimeColor(True).ToVector3()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
.FogEnabled = True
|
||||||
|
.FogColor = Screen.Effect.FogColor
|
||||||
|
.FogEnd = Screen.Effect.FogEnd
|
||||||
|
.FogStart = Screen.Effect.FogStart
|
||||||
|
End With
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
@ -36,7 +36,17 @@
|
|||||||
Public Overrides Sub Render()
|
Public Overrides Sub Render()
|
||||||
If Visible = True Then
|
If Visible = True Then
|
||||||
If Not _model Is Nothing Then
|
If Not _model Is Nothing Then
|
||||||
|
For Each modelMesh As ModelMesh In Model.Meshes
|
||||||
|
For Each modelMeshPart As ModelMeshPart In modelMesh.MeshParts
|
||||||
|
If modelMeshPart.Effect.GetType() = GetType(BasicEffect)
|
||||||
|
Dim effect = New BasicEffectWithAlphaTest(CType(modelMeshPart.Effect, BasicEffect))
|
||||||
|
modelMeshPart.Effect = effect
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
Core.GraphicsDevice.SamplerStates(0) = Core.ModelSampler
|
||||||
_model.Draw(Me.World, Screen.Camera.View, Screen.Camera.Projection)
|
_model.Draw(Me.World, Screen.Camera.View, Screen.Camera.Projection)
|
||||||
|
Core.GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If drawViewBox = True Then
|
If drawViewBox = True Then
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
Next
|
Next
|
||||||
|
|
||||||
GraphicsDevice.RasterizerState = tempRasterizer
|
GraphicsDevice.RasterizerState = tempRasterizer
|
||||||
GraphicsDevice.SamplerStates(0) = Core.sampler
|
GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Class Backdrop
|
Public Class Backdrop
|
||||||
|
@ -57,7 +57,7 @@ Public Class ModelManager
|
|||||||
Core.GraphicsDevice.Clear(Color.Transparent)
|
Core.GraphicsDevice.Clear(Color.Transparent)
|
||||||
|
|
||||||
Core.GraphicsDevice.BlendState = BlendState.Opaque
|
Core.GraphicsDevice.BlendState = BlendState.Opaque
|
||||||
Core.GraphicsDevice.SamplerStates(0) = Core.sampler
|
Core.GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||||
|
|
||||||
Dim m As Model = ModelManager.GetModel(modelName)
|
Dim m As Model = ModelManager.GetModel(modelName)
|
||||||
|
|
||||||
|
@ -251,14 +251,23 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
|||||||
|
|
||||||
Public Sub New(ByVal device As GraphicsDevice)
|
Public Sub New(ByVal device As GraphicsDevice)
|
||||||
MyBase.New(device, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(AppContext.BaseDirectory), "Content", "Effects", "BasicEffectWithAlphaTest.mgfxdx")))
|
MyBase.New(device, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(AppContext.BaseDirectory), "Content", "Effects", "BasicEffectWithAlphaTest.mgfxdx")))
|
||||||
CacheEffectParameters(Nothing)
|
CacheEffectParameters()
|
||||||
DirectionalLight0.Enabled = True
|
DirectionalLight0.Enabled = True
|
||||||
SpecularColor = Vector3.One
|
SpecularColor = Vector3.One
|
||||||
SpecularPower = 16
|
SpecularPower = 16
|
||||||
AlphaCutoff = 0
|
AlphaCutoff = 0
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub New(ByVal cloneSource As BasicEffectWithAlphaTest)
|
Public Sub New(ByVal device As GraphicsDevice, ByVal data As Byte())
|
||||||
|
MyBase.New(device, data)
|
||||||
|
CacheEffectParameters()
|
||||||
|
DirectionalLight0.Enabled = True
|
||||||
|
SpecularColor = Vector3.One
|
||||||
|
SpecularPower = 16
|
||||||
|
AlphaCutoff = 0
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub New(ByVal cloneSource As BasicEffectWithAlphaTest)
|
||||||
MyBase.New(cloneSource)
|
MyBase.New(cloneSource)
|
||||||
CacheEffectParameters(cloneSource)
|
CacheEffectParameters(cloneSource)
|
||||||
_lightingEnabled = cloneSource.lightingEnabled
|
_lightingEnabled = cloneSource.lightingEnabled
|
||||||
@ -277,6 +286,74 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
|||||||
_fogEnd = cloneSource.fogEnd
|
_fogEnd = cloneSource.fogEnd
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Sub New(ByVal cloneSource As BasicEffect)
|
||||||
|
MyBase.New(cloneSource.GraphicsDevice, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(AppContext.BaseDirectory), "Content", "Effects", "BasicEffectWithAlphaTest.mgfxdx")))
|
||||||
|
CacheEffectParameters(cloneSource)
|
||||||
|
DirectionalLight0 = cloneSource.DirectionalLight0
|
||||||
|
DirectionalLight1 = cloneSource.DirectionalLight1
|
||||||
|
DirectionalLight2 = cloneSource.DirectionalLight2
|
||||||
|
World = cloneSource.World
|
||||||
|
View = cloneSource.View
|
||||||
|
Projection = cloneSource.Projection
|
||||||
|
DiffuseColor = cloneSource.DiffuseColor
|
||||||
|
EmissiveColor = cloneSource.EmissiveColor
|
||||||
|
SpecularColor = cloneSource.SpecularColor
|
||||||
|
SpecularPower = cloneSource.SpecularPower
|
||||||
|
Alpha = cloneSource.Alpha
|
||||||
|
LightingEnabled = cloneSource.LightingEnabled
|
||||||
|
PreferPerPixelLighting = cloneSource.PreferPerPixelLighting
|
||||||
|
AmbientLightColor = cloneSource.AmbientLightColor
|
||||||
|
FogEnabled = cloneSource.FogEnabled
|
||||||
|
FogStart = cloneSource.FogStart
|
||||||
|
FogEnd = cloneSource.FogEnd
|
||||||
|
FogColor = cloneSource.FogColor
|
||||||
|
TextureEnabled = cloneSource.TextureEnabled
|
||||||
|
Texture = cloneSource.Texture
|
||||||
|
VertexColorEnabled = cloneSource.VertexColorEnabled
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Widening Shared Operator CType(ByVal effect As BasicEffectWithAlphaTest) As BasicEffect
|
||||||
|
Dim newEffect As New BasicEffect(effect.GraphicsDevice)
|
||||||
|
With newEffect
|
||||||
|
With .DirectionalLight0
|
||||||
|
.Enabled = effect.DirectionalLight0.Enabled
|
||||||
|
.Direction = effect.DirectionalLight0.Direction
|
||||||
|
.DiffuseColor = effect.DirectionalLight0.DiffuseColor
|
||||||
|
.SpecularColor = effect.DirectionalLight0.SpecularColor
|
||||||
|
End With
|
||||||
|
With .DirectionalLight1
|
||||||
|
.Enabled = effect.DirectionalLight1.Enabled
|
||||||
|
.Direction = effect.DirectionalLight1.Direction
|
||||||
|
.DiffuseColor = effect.DirectionalLight1.DiffuseColor
|
||||||
|
.SpecularColor = effect.DirectionalLight1.SpecularColor
|
||||||
|
End With
|
||||||
|
With .DirectionalLight2
|
||||||
|
.Enabled = effect.DirectionalLight2.Enabled
|
||||||
|
.Direction = effect.DirectionalLight2.Direction
|
||||||
|
.DiffuseColor = effect.DirectionalLight2.DiffuseColor
|
||||||
|
.SpecularColor = effect.DirectionalLight2.SpecularColor
|
||||||
|
End With
|
||||||
|
.World = effect.World
|
||||||
|
.View = effect.View
|
||||||
|
.Projection = effect.Projection
|
||||||
|
.DiffuseColor = effect.DiffuseColor
|
||||||
|
.EmissiveColor = effect.EmissiveColor
|
||||||
|
.SpecularColor = effect.SpecularColor
|
||||||
|
.SpecularPower = effect.SpecularPower
|
||||||
|
.Alpha = effect.Alpha
|
||||||
|
.LightingEnabled = effect.LightingEnabled
|
||||||
|
.PreferPerPixelLighting = effect.PreferPerPixelLighting
|
||||||
|
.AmbientLightColor = effect.AmbientLightColor
|
||||||
|
.FogStart = effect.FogStart
|
||||||
|
.FogEnd = effect.FogEnd
|
||||||
|
.FogColor = effect.FogColor
|
||||||
|
.TextureEnabled = effect.TextureEnabled
|
||||||
|
.Texture = effect.Texture
|
||||||
|
.VertexColorEnabled = effect.VertexColorEnabled
|
||||||
|
End With
|
||||||
|
Return newEffect
|
||||||
|
End Operator
|
||||||
|
|
||||||
Public Overrides Function Clone() As Effect
|
Public Overrides Function Clone() As Effect
|
||||||
Return New BasicEffectWithAlphaTest(Me)
|
Return New BasicEffectWithAlphaTest(Me)
|
||||||
End Function
|
End Function
|
||||||
@ -338,6 +415,24 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CacheEffectParameters()
|
||||||
|
_textureParam = Parameters("Texture")
|
||||||
|
_diffuseColorParam = Parameters("DiffuseColor")
|
||||||
|
_emissiveColorParam = Parameters("EmissiveColor")
|
||||||
|
_specularColorParam = Parameters("SpecularColor")
|
||||||
|
_specularPowerParam = Parameters("SpecularPower")
|
||||||
|
_eyePositionParam = Parameters("EyePosition")
|
||||||
|
_fogColorParam = Parameters("FogColor")
|
||||||
|
_fogVectorParam = Parameters("FogVector")
|
||||||
|
_worldParam = Parameters("World")
|
||||||
|
_worldInverseTransposeParam = Parameters("WorldInverseTranspose")
|
||||||
|
_worldViewProjParam = Parameters("WorldViewProj")
|
||||||
|
_alphaTestParam = Parameters("AlphaTest")
|
||||||
|
DirectionalLight0 = New DirectionalLight(Parameters("DirLight0Direction"), Parameters("DirLight0DiffuseColor"), Parameters("DirLight0SpecularColor"), Nothing)
|
||||||
|
DirectionalLight1 = New DirectionalLight(Parameters("DirLight1Direction"), Parameters("DirLight1DiffuseColor"), Parameters("DirLight1SpecularColor"), Nothing)
|
||||||
|
DirectionalLight2 = New DirectionalLight(Parameters("DirLight2Direction"), Parameters("DirLight2DiffuseColor"), Parameters("DirLight2SpecularColor"), Nothing)
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub CacheEffectParameters(ByVal cloneSource As BasicEffectWithAlphaTest)
|
Private Sub CacheEffectParameters(ByVal cloneSource As BasicEffectWithAlphaTest)
|
||||||
_textureParam = Parameters("Texture")
|
_textureParam = Parameters("Texture")
|
||||||
_diffuseColorParam = Parameters("DiffuseColor")
|
_diffuseColorParam = Parameters("DiffuseColor")
|
||||||
@ -355,4 +450,22 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
|||||||
DirectionalLight1 = New DirectionalLight(Parameters("DirLight1Direction"), Parameters("DirLight1DiffuseColor"), Parameters("DirLight1SpecularColor"), cloneSource?.DirectionalLight1)
|
DirectionalLight1 = New DirectionalLight(Parameters("DirLight1Direction"), Parameters("DirLight1DiffuseColor"), Parameters("DirLight1SpecularColor"), cloneSource?.DirectionalLight1)
|
||||||
DirectionalLight2 = New DirectionalLight(Parameters("DirLight2Direction"), Parameters("DirLight2DiffuseColor"), Parameters("DirLight2SpecularColor"), cloneSource?.DirectionalLight2)
|
DirectionalLight2 = New DirectionalLight(Parameters("DirLight2Direction"), Parameters("DirLight2DiffuseColor"), Parameters("DirLight2SpecularColor"), cloneSource?.DirectionalLight2)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CacheEffectParameters(ByVal cloneSource As BasicEffect)
|
||||||
|
_textureParam = Parameters("Texture")
|
||||||
|
_diffuseColorParam = Parameters("DiffuseColor")
|
||||||
|
_emissiveColorParam = Parameters("EmissiveColor")
|
||||||
|
_specularColorParam = Parameters("SpecularColor")
|
||||||
|
_specularPowerParam = Parameters("SpecularPower")
|
||||||
|
_eyePositionParam = Parameters("EyePosition")
|
||||||
|
_fogColorParam = Parameters("FogColor")
|
||||||
|
_fogVectorParam = Parameters("FogVector")
|
||||||
|
_worldParam = Parameters("World")
|
||||||
|
_worldInverseTransposeParam = Parameters("WorldInverseTranspose")
|
||||||
|
_worldViewProjParam = Parameters("WorldViewProj")
|
||||||
|
_alphaTestParam = Parameters("AlphaTest")
|
||||||
|
DirectionalLight0 = New DirectionalLight(Parameters("DirLight0Direction"), Parameters("DirLight0DiffuseColor"), Parameters("DirLight0SpecularColor"), cloneSource?.DirectionalLight0)
|
||||||
|
DirectionalLight1 = New DirectionalLight(Parameters("DirLight1Direction"), Parameters("DirLight1DiffuseColor"), Parameters("DirLight1SpecularColor"), cloneSource?.DirectionalLight1)
|
||||||
|
DirectionalLight2 = New DirectionalLight(Parameters("DirLight2Direction"), Parameters("DirLight2DiffuseColor"), Parameters("DirLight2SpecularColor"), cloneSource?.DirectionalLight2)
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
@ -69,7 +69,8 @@ VSOutput VSHWBasic(VSInput vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutput vout;
|
VSOutput vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
return vout;
|
return vout;
|
||||||
@ -93,7 +94,8 @@ VSOutputNoFog VSHWBasicNoFog(VSInput vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputNoFog vout;
|
VSOutputNoFog vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParamsNoFog;
|
SetCommonVSOutputParamsNoFog;
|
||||||
|
|
||||||
return vout;
|
return vout;
|
||||||
@ -119,7 +121,8 @@ VSOutput VSHWBasicVc(VSInputVc vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutput vout;
|
VSOutput vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.Diffuse *= vin.Color;
|
vout.Diffuse *= vin.Color;
|
||||||
@ -147,7 +150,8 @@ VSOutputNoFog VSHWBasicVcNoFog(VSInputVc vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputNoFog vout;
|
VSOutputNoFog vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParamsNoFog;
|
SetCommonVSOutputParamsNoFog;
|
||||||
|
|
||||||
vout.Diffuse *= vin.Color;
|
vout.Diffuse *= vin.Color;
|
||||||
@ -175,7 +179,8 @@ VSOutputTx VSHWBasicTx(VSInputTx vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputTx vout;
|
VSOutputTx vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -203,7 +208,8 @@ VSOutputTxNoFog VSHWBasicTxNoFog(VSInputTx vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputTxNoFog vout;
|
VSOutputTxNoFog vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParamsNoFog;
|
SetCommonVSOutputParamsNoFog;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -232,7 +238,8 @@ VSOutputTx VSHWBasicTxVc(VSInputTxVc vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputTx vout;
|
VSOutputTx vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -262,7 +269,8 @@ VSOutputTxNoFog VSHWBasicTxVcNoFog(VSInputTxVc vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputTxNoFog vout;
|
VSOutputTxNoFog vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||||
SetCommonVSOutputParamsNoFog;
|
SetCommonVSOutputParamsNoFog;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -289,7 +297,8 @@ VSOutput VSHWBasicVertexLighting(VSInputNm vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutput vout;
|
VSOutput vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 3);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
return vout;
|
return vout;
|
||||||
@ -315,7 +324,8 @@ VSOutput VSHWBasicVertexLightingVc(VSInputNmVc vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutput vout;
|
VSOutput vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 3);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.Diffuse *= vin.Color;
|
vout.Diffuse *= vin.Color;
|
||||||
@ -343,7 +353,8 @@ VSOutputTx VSHWBasicVertexLightingTx(VSInputNmTx vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputTx vout;
|
VSOutputTx vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 3);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -372,7 +383,8 @@ VSOutputTx VSHWBasicVertexLightingTxVc(VSInputNmTxVc vin, VSHWInputInstance vhwi
|
|||||||
{
|
{
|
||||||
VSOutputTx vout;
|
VSOutputTx vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 3);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 3);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -399,7 +411,8 @@ VSOutput VSHWBasicOneLight(VSInputNm vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutput vout;
|
VSOutput vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 1);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
return vout;
|
return vout;
|
||||||
@ -425,7 +438,8 @@ VSOutput VSHWBasicOneLightVc(VSInputNmVc vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutput vout;
|
VSOutput vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 1);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.Diffuse *= vin.Color;
|
vout.Diffuse *= vin.Color;
|
||||||
@ -453,7 +467,8 @@ VSOutputTx VSHWBasicOneLightTx(VSInputNmTx vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputTx vout;
|
VSOutputTx vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 1);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -482,7 +497,8 @@ VSOutputTx VSHWBasicOneLightTxVc(VSInputNmTxVc vin, VSHWInputInstance vhwin)
|
|||||||
{
|
{
|
||||||
VSOutputTx vout;
|
VSOutputTx vout;
|
||||||
|
|
||||||
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position + vhwin.Position, vin.Normal, 1);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutput cout = ComputeCommonVSOutputWithLighting(vin.Position, vin.Normal, 1);
|
||||||
SetCommonVSOutputParams;
|
SetCommonVSOutputParams;
|
||||||
|
|
||||||
vout.TexCoord = vin.TexCoord;
|
vout.TexCoord = vin.TexCoord;
|
||||||
@ -511,7 +527,8 @@ VSOutputPixelLighting VSHWBasicPixelLighting(VSInputNm vin, VSHWInputInstance vh
|
|||||||
{
|
{
|
||||||
VSOutputPixelLighting vout;
|
VSOutputPixelLighting vout;
|
||||||
|
|
||||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||||
SetCommonVSOutputParamsPixelLighting;
|
SetCommonVSOutputParamsPixelLighting;
|
||||||
|
|
||||||
vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
|
vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
|
||||||
@ -540,7 +557,8 @@ VSOutputPixelLighting VSHWBasicPixelLightingVc(VSInputNmVc vin, VSHWInputInstanc
|
|||||||
{
|
{
|
||||||
VSOutputPixelLighting vout;
|
VSOutputPixelLighting vout;
|
||||||
|
|
||||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||||
SetCommonVSOutputParamsPixelLighting;
|
SetCommonVSOutputParamsPixelLighting;
|
||||||
|
|
||||||
vout.Diffuse.rgb = vin.Color.rgb;
|
vout.Diffuse.rgb = vin.Color.rgb;
|
||||||
@ -570,7 +588,8 @@ VSOutputPixelLightingTx VSHWBasicPixelLightingTx(VSInputNmTx vin, VSHWInputInsta
|
|||||||
{
|
{
|
||||||
VSOutputPixelLightingTx vout;
|
VSOutputPixelLightingTx vout;
|
||||||
|
|
||||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||||
SetCommonVSOutputParamsPixelLighting;
|
SetCommonVSOutputParamsPixelLighting;
|
||||||
|
|
||||||
vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
|
vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
|
||||||
@ -601,7 +620,8 @@ VSOutputPixelLightingTx VSHWBasicPixelLightingTxVc(VSInputNmTxVc vin, VSHWInputI
|
|||||||
{
|
{
|
||||||
VSOutputPixelLightingTx vout;
|
VSOutputPixelLightingTx vout;
|
||||||
|
|
||||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||||
|
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||||
SetCommonVSOutputParamsPixelLighting;
|
SetCommonVSOutputParamsPixelLighting;
|
||||||
|
|
||||||
vout.Diffuse.rgb = vin.Color.rgb;
|
vout.Diffuse.rgb = vin.Color.rgb;
|
||||||
|
@ -33,6 +33,12 @@ struct CommonVSOutput
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void ApplyPositionOffset(inout float4 position, float3 offset)
|
||||||
|
{
|
||||||
|
position.xyz += offset.xyz;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CommonVSOutput ComputeCommonVSOutput(float4 position)
|
CommonVSOutput ComputeCommonVSOutput(float4 position)
|
||||||
{
|
{
|
||||||
CommonVSOutput vout;
|
CommonVSOutput vout;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
struct VSHWInputInstance
|
struct VSHWInputInstance
|
||||||
{
|
{
|
||||||
float4 Position : POSITION1;
|
float3 Position : POSITION1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VSInput
|
struct VSInput
|
||||||
|
Loading…
x
Reference in New Issue
Block a user