mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-04-08 18:35:09 +02:00
Merge pull request #208 from jianmingyong/model_importer_fix
Use custom shader for 3d model
This commit is contained in:
commit
4621ecbb12
P3D
Content/Effects
Core
Entites
Overworld
Resources
lib/P3D.ContentPipeline/Content/Effects
Binary file not shown.
@ -45,7 +45,7 @@
|
||||
|
||||
Public GameOptions As GameOptions
|
||||
|
||||
Public sampler As SamplerState
|
||||
Public Sampler As SamplerState
|
||||
|
||||
Public BackgroundColor As Color = New Color(173, 216, 255)
|
||||
|
||||
@ -85,14 +85,14 @@
|
||||
|
||||
GameMessage = New GameMessage(Nothing, New Size(0, 0), New Vector2(0, 0))
|
||||
|
||||
sampler = New SamplerState()
|
||||
sampler.Filter = TextureFilter.Point
|
||||
sampler.AddressU = TextureAddressMode.Clamp
|
||||
sampler.AddressV = TextureAddressMode.Clamp
|
||||
Sampler = New SamplerState()
|
||||
Sampler.Filter = TextureFilter.Point
|
||||
Sampler.AddressU = TextureAddressMode.Clamp
|
||||
Sampler.AddressV = TextureAddressMode.Clamp
|
||||
|
||||
ServersManager = New Servers.ServersManager()
|
||||
|
||||
GraphicsDevice.SamplerStates(0) = sampler
|
||||
GraphicsDevice.SamplerStates(0) = Sampler
|
||||
KeyboardInput = New KeyboardInput()
|
||||
|
||||
If CommandLineArgHandler.NoSplash = True Then
|
||||
@ -193,7 +193,7 @@
|
||||
FontRenderer.Begin()
|
||||
GraphicsDevice.DepthStencilState = DepthStencilState.Default
|
||||
|
||||
GraphicsDevice.SamplerStates(0) = sampler
|
||||
GraphicsDevice.SamplerStates(0) = Sampler
|
||||
GraphicsDevice.SamplerStates(0) = SamplerState.PointClamp
|
||||
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)
|
||||
If Visible = True 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) = SamplerState.PointWrap
|
||||
Model.Draw(Me.World, Screen.Camera.View, Screen.Camera.Projection)
|
||||
Core.GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||
If drawViewBox = True Then
|
||||
BoundingBoxRenderer.Render(ViewBox, Core.GraphicsDevice, Screen.Camera.View, Screen.Camera.Projection, Microsoft.Xna.Framework.Color.Red)
|
||||
End If
|
||||
@ -661,25 +671,47 @@
|
||||
If Not Me.Model Is Nothing Then
|
||||
For Each mesh As ModelMesh In Me.Model.Meshes
|
||||
For Each part As ModelMeshPart In mesh.MeshParts
|
||||
With CType(part.Effect, BasicEffect)
|
||||
Lighting.UpdateLighting(CType(part.Effect, BasicEffect))
|
||||
.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()
|
||||
If part.Effect.GetType() = GetType(BasicEffect)
|
||||
With CType(part.Effect, BasicEffect)
|
||||
Lighting.UpdateLighting(CType(part.Effect, BasicEffect))
|
||||
.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
|
||||
End If
|
||||
|
||||
.FogEnabled = True
|
||||
.FogColor = Screen.Effect.FogColor
|
||||
.FogEnd = Screen.Effect.FogEnd
|
||||
.FogStart = Screen.Effect.FogStart
|
||||
End With
|
||||
.FogEnabled = True
|
||||
.FogColor = Screen.Effect.FogColor
|
||||
.FogEnd = Screen.Effect.FogEnd
|
||||
.FogStart = Screen.Effect.FogStart
|
||||
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
|
||||
End If
|
||||
|
@ -36,7 +36,17 @@
|
||||
Public Overrides Sub Render()
|
||||
If Visible = True 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) = SamplerState.PointWrap
|
||||
_model.Draw(Me.World, Screen.Camera.View, Screen.Camera.Projection)
|
||||
Core.GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||
End If
|
||||
|
||||
If drawViewBox = True Then
|
||||
|
@ -30,7 +30,7 @@
|
||||
Next
|
||||
|
||||
GraphicsDevice.RasterizerState = tempRasterizer
|
||||
GraphicsDevice.SamplerStates(0) = Core.sampler
|
||||
GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||
End Sub
|
||||
|
||||
Public Class Backdrop
|
||||
|
@ -57,7 +57,7 @@ Public Class ModelManager
|
||||
Core.GraphicsDevice.Clear(Color.Transparent)
|
||||
|
||||
Core.GraphicsDevice.BlendState = BlendState.Opaque
|
||||
Core.GraphicsDevice.SamplerStates(0) = Core.sampler
|
||||
Core.GraphicsDevice.SamplerStates(0) = Core.Sampler
|
||||
|
||||
Dim m As Model = ModelManager.GetModel(modelName)
|
||||
|
||||
|
@ -251,14 +251,23 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
||||
|
||||
Public Sub New(ByVal device As GraphicsDevice)
|
||||
MyBase.New(device, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(AppContext.BaseDirectory), "Content", "Effects", "BasicEffectWithAlphaTest.mgfxdx")))
|
||||
CacheEffectParameters(Nothing)
|
||||
CacheEffectParameters()
|
||||
DirectionalLight0.Enabled = True
|
||||
SpecularColor = Vector3.One
|
||||
SpecularPower = 16
|
||||
AlphaCutoff = 0
|
||||
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)
|
||||
CacheEffectParameters(cloneSource)
|
||||
_lightingEnabled = cloneSource.lightingEnabled
|
||||
@ -277,6 +286,89 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
||||
_fogEnd = cloneSource.fogEnd
|
||||
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)
|
||||
With DirectionalLight0
|
||||
.Direction = cloneSource.DirectionalLight0.Direction
|
||||
.Enabled = cloneSource.DirectionalLight0.Enabled
|
||||
.DiffuseColor = cloneSource.DirectionalLight0.DiffuseColor
|
||||
.SpecularColor = cloneSource.DirectionalLight0.SpecularColor
|
||||
End With
|
||||
With DirectionalLight1
|
||||
.Direction = cloneSource.DirectionalLight1.Direction
|
||||
.Enabled = cloneSource.DirectionalLight1.Enabled
|
||||
.DiffuseColor = cloneSource.DirectionalLight1.DiffuseColor
|
||||
.SpecularColor = cloneSource.DirectionalLight1.SpecularColor
|
||||
End With
|
||||
With DirectionalLight2
|
||||
.Direction = cloneSource.DirectionalLight2.Direction
|
||||
.Enabled = cloneSource.DirectionalLight2.Enabled
|
||||
.DiffuseColor = cloneSource.DirectionalLight2.DiffuseColor
|
||||
.SpecularColor = cloneSource.DirectionalLight2.SpecularColor
|
||||
End With
|
||||
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
|
||||
Return New BasicEffectWithAlphaTest(Me)
|
||||
End Function
|
||||
@ -338,6 +430,24 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
||||
End If
|
||||
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)
|
||||
_textureParam = Parameters("Texture")
|
||||
_diffuseColorParam = Parameters("DiffuseColor")
|
||||
@ -355,4 +465,22 @@ Public NotInheritable Class BasicEffectWithAlphaTest
|
||||
DirectionalLight1 = New DirectionalLight(Parameters("DirLight1Direction"), Parameters("DirLight1DiffuseColor"), Parameters("DirLight1SpecularColor"), cloneSource?.DirectionalLight1)
|
||||
DirectionalLight2 = New DirectionalLight(Parameters("DirLight2Direction"), Parameters("DirLight2DiffuseColor"), Parameters("DirLight2SpecularColor"), cloneSource?.DirectionalLight2)
|
||||
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
|
||||
|
@ -69,7 +69,8 @@ VSOutput VSHWBasic(VSInput vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutput vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParams;
|
||||
|
||||
return vout;
|
||||
@ -93,7 +94,8 @@ VSOutputNoFog VSHWBasicNoFog(VSInput vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutputNoFog vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParamsNoFog;
|
||||
|
||||
return vout;
|
||||
@ -119,7 +121,8 @@ VSOutput VSHWBasicVc(VSInputVc vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutput vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParams;
|
||||
|
||||
vout.Diffuse *= vin.Color;
|
||||
@ -147,7 +150,8 @@ VSOutputNoFog VSHWBasicVcNoFog(VSInputVc vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutputNoFog vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParamsNoFog;
|
||||
|
||||
vout.Diffuse *= vin.Color;
|
||||
@ -175,7 +179,8 @@ VSOutputTx VSHWBasicTx(VSInputTx vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutputTx vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParams;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -203,7 +208,8 @@ VSOutputTxNoFog VSHWBasicTxNoFog(VSInputTx vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutputTxNoFog vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParamsNoFog;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -232,7 +238,8 @@ VSOutputTx VSHWBasicTxVc(VSInputTxVc vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutputTx vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParams;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -262,7 +269,8 @@ VSOutputTxNoFog VSHWBasicTxVcNoFog(VSInputTxVc vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
VSOutputTxNoFog vout;
|
||||
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position + vhwin.Position);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutput cout = ComputeCommonVSOutput(vin.Position);
|
||||
SetCommonVSOutputParamsNoFog;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -289,7 +297,8 @@ VSOutput VSHWBasicVertexLighting(VSInputNm vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
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;
|
||||
|
||||
return vout;
|
||||
@ -315,7 +324,8 @@ VSOutput VSHWBasicVertexLightingVc(VSInputNmVc vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
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;
|
||||
|
||||
vout.Diffuse *= vin.Color;
|
||||
@ -343,7 +353,8 @@ VSOutputTx VSHWBasicVertexLightingTx(VSInputNmTx vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
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;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -372,7 +383,8 @@ VSOutputTx VSHWBasicVertexLightingTxVc(VSInputNmTxVc vin, VSHWInputInstance vhwi
|
||||
{
|
||||
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;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -399,7 +411,8 @@ VSOutput VSHWBasicOneLight(VSInputNm vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
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;
|
||||
|
||||
return vout;
|
||||
@ -425,7 +438,8 @@ VSOutput VSHWBasicOneLightVc(VSInputNmVc vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
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;
|
||||
|
||||
vout.Diffuse *= vin.Color;
|
||||
@ -453,7 +467,8 @@ VSOutputTx VSHWBasicOneLightTx(VSInputNmTx vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
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;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -482,7 +497,8 @@ VSOutputTx VSHWBasicOneLightTxVc(VSInputNmTxVc vin, VSHWInputInstance vhwin)
|
||||
{
|
||||
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;
|
||||
|
||||
vout.TexCoord = vin.TexCoord;
|
||||
@ -511,7 +527,8 @@ VSOutputPixelLighting VSHWBasicPixelLighting(VSInputNm vin, VSHWInputInstance vh
|
||||
{
|
||||
VSOutputPixelLighting vout;
|
||||
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||
SetCommonVSOutputParamsPixelLighting;
|
||||
|
||||
vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
|
||||
@ -540,7 +557,8 @@ VSOutputPixelLighting VSHWBasicPixelLightingVc(VSInputNmVc vin, VSHWInputInstanc
|
||||
{
|
||||
VSOutputPixelLighting vout;
|
||||
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||
SetCommonVSOutputParamsPixelLighting;
|
||||
|
||||
vout.Diffuse.rgb = vin.Color.rgb;
|
||||
@ -570,7 +588,8 @@ VSOutputPixelLightingTx VSHWBasicPixelLightingTx(VSInputNmTx vin, VSHWInputInsta
|
||||
{
|
||||
VSOutputPixelLightingTx vout;
|
||||
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||
SetCommonVSOutputParamsPixelLighting;
|
||||
|
||||
vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
|
||||
@ -601,7 +620,8 @@ VSOutputPixelLightingTx VSHWBasicPixelLightingTxVc(VSInputNmTxVc vin, VSHWInputI
|
||||
{
|
||||
VSOutputPixelLightingTx vout;
|
||||
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position + vhwin.Position, vin.Normal);
|
||||
ApplyPositionOffset(vin.Position, vhwin.Position);
|
||||
CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, vin.Normal);
|
||||
SetCommonVSOutputParamsPixelLighting;
|
||||
|
||||
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 vout;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
struct VSHWInputInstance
|
||||
{
|
||||
float4 Position : POSITION1;
|
||||
float3 Position : POSITION1;
|
||||
};
|
||||
|
||||
struct VSInput
|
||||
|
Loading…
x
Reference in New Issue
Block a user