Skip to content

Commit

Permalink
#71 #77 Refactor de los HLSL.
Browse files Browse the repository at this point in the history
Se agregaron todos los Shaders del Worshop de @mbanquiero que faltaban, pero por ahora se adaptaron 4, el resto de adapto bastante pero aun no andan (no estan agregaron al proyecto pero si en el repo). Se hizo refactor de todos los HLSL y se migraron todos a V3. Se avanzo un poco con TGCGeometry.
  • Loading branch information
rejurime committed Aug 22, 2017
1 parent 370fd28 commit 736fe29
Show file tree
Hide file tree
Showing 124 changed files with 10,477 additions and 3,742 deletions.
4 changes: 2 additions & 2 deletions TGC.Core/BoundingVolumes/TgcBoundingAxisAlignBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public TgcBoundingAxisAlignBox()
{
RenderColor = Color.Yellow.ToArgb();
dirtyValues = true;
AlphaBlendEnable = false;
AlphaBlend = false;
}

/// <summary>
Expand Down Expand Up @@ -127,7 +127,7 @@ public TGCVector3 Position
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// Renderizar BoundingBox
Expand Down
2 changes: 1 addition & 1 deletion TGC.Core/BoundingVolumes/TgcBoundingCylinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void Dispose()
vertices = null;
}

public bool AlphaBlendEnable { get; set; } //useless?
public bool AlphaBlend { get; set; } //useless?

#endregion Rendering

Expand Down
2 changes: 1 addition & 1 deletion TGC.Core/BoundingVolumes/TgcBoundingCylinderFixedY.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void Dispose()
vertices = null;
}

public bool AlphaBlendEnable { get; set; } //useless?
public bool AlphaBlend { get; set; } //useless?

#endregion Rendering
}
Expand Down
4 changes: 2 additions & 2 deletions TGC.Core/BoundingVolumes/TgcBoundingElipsoid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public TgcBoundingElipsoid()
{
RenderColor = Color.Yellow.ToArgb();
dirtyValues = true;
AlphaBlendEnable = false;
AlphaBlend = false;
}

/// <summary>
Expand Down Expand Up @@ -90,7 +90,7 @@ public TGCVector3 Position
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// Renderizar el Elipsoid
Expand Down
4 changes: 2 additions & 2 deletions TGC.Core/BoundingVolumes/TgcBoundingOrientedBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public TgcBoundingOrientedBox()
{
RenderColor = Color.Yellow.ToArgb();
dirtyValues = true;
AlphaBlendEnable = false;
AlphaBlend = false;
}

/// <summary>
Expand Down Expand Up @@ -105,7 +105,7 @@ public string Technique
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// Renderizar
Expand Down
4 changes: 2 additions & 2 deletions TGC.Core/BoundingVolumes/TgcBoundingSphere.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public TgcBoundingSphere()
{
RenderColor = Color.Yellow.ToArgb();
dirtyValues = true;
AlphaBlendEnable = false;
AlphaBlend = false;
}

/// <summary>
Expand Down Expand Up @@ -90,7 +90,7 @@ public TGCVector3 Position
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// Renderizar el BoundingSphere
Expand Down
25 changes: 24 additions & 1 deletion TGC.Core/Geometry/TGCGeometry.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
using TGC.Core.Mathematica;
using TGC.Core.SceneLoader;

namespace TGC.Core
{
public abstract class TGCGeometry
/// <summary>
/// Abstraccion con el comportamiento y estado interno comun de las geometrias.
/// </summary>
public abstract class TGCGeometry : IRenderObject
{
/// <summary>
/// Habilita el renderizado con AlphaBlending para los modelos
Expand All @@ -16,10 +20,21 @@ public abstract class TGCGeometry
/// </summary>
public TGCVector3 Position { get; set; }

/// <summary>
/// Direccion hacia arriba
/// </summary>
public TGCVector3 Up { get; set; }

/// <summary>
/// Direccion hacia la derecha.
/// </summary>
public TGCVector3 Right { get; set; }

/// <summary>
/// Direccion hacia el frente.
/// </summary>
public TGCVector3 Front { get; set; }

/// <summary>
/// Rotación absoluta del objeto
/// </summary>
Expand All @@ -38,6 +53,14 @@ public abstract class TGCGeometry
/// </summary>
public TGCMatrix Transform { get; set; }

/// <summary>
/// Iinicializacion del objeto.
/// </summary>
public abstract void Init();

/// <summary>
/// Se debe escribir toda la lógica de computo del modelo.
/// </summary>
public abstract void Update();

/// <summary>
Expand Down
20 changes: 10 additions & 10 deletions TGC.Core/Geometry/TGCSphere.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public Color Color
/// En False se respeta lo que el usuario haya cargado a mano en la matriz.
/// Por default está en False.
/// </summary>
public bool AutoTransformEnable { get; set; }
public bool AutoTransform { get; set; }

/// <summary>
/// Posicion absoluta del centro de la esfera
Expand Down Expand Up @@ -186,7 +186,7 @@ public TgcBoundingSphere BoundingSphere
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// Offset UV de textura
Expand Down Expand Up @@ -339,13 +339,13 @@ public TGCSphere(float radius, TgcTexture texture, TGCVector3 center)

protected void configure(float radius, Color color, TgcTexture texture, TGCVector3 center)
{
AutoTransformEnable = false;
AutoTransform = false;
Transform = TGCMatrix.Identity;
translation = center;
Rotation = TGCVector3.Empty;
Enabled = true;
scale = TGCVector3.One;
AlphaBlendEnable = false;
AlphaBlend = false;
uvOffset = TGCVector2.Zero;

//BoundingSphere
Expand Down Expand Up @@ -633,7 +633,7 @@ public virtual void Render()
return;

//transformacion
if (AutoTransformEnable)
if (AutoTransform)
{
Transform = TGCMatrix.Scaling(radius, radius, radius) * TGCMatrix.Scaling(Scale) *
TGCMatrix.RotationYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) *
Expand Down Expand Up @@ -693,7 +693,7 @@ protected void renderWithFill(FillMode fillmode)
/// </summary>
protected void activateAlphaBlend()
{
if (AlphaBlendEnable)
if (AlphaBlend)
{
D3DDevice.Instance.Device.RenderState.AlphaTestEnable = true;
D3DDevice.Instance.Device.RenderState.AlphaBlendEnable = true;
Expand Down Expand Up @@ -822,10 +822,10 @@ public virtual TGCSphere clone()

if (Texture != null) cloneSphere.setTexture(Texture.Clone());

cloneSphere.AutoTransformEnable = AutoTransformEnable;
cloneSphere.AutoTransform = AutoTransform;
cloneSphere.Transform = Transform;
cloneSphere.Rotation = Rotation;
cloneSphere.AlphaBlendEnable = AlphaBlendEnable;
cloneSphere.AlphaBlend = AlphaBlend;
cloneSphere.uvOffset = uvOffset;

cloneSphere.updateValues();
Expand All @@ -840,14 +840,14 @@ public virtual TGCSphere clone()
public TgcMesh toMesh(string meshName)
{
//Obtener matriz para transformar vertices
if (AutoTransformEnable)
if (AutoTransform)
{
Transform = TGCMatrix.Scaling(radius, radius, radius) * TGCMatrix.Scaling(Scale) *
TGCMatrix.RotationYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) *
TGCMatrix.Translation(translation);
}

return TgcMesh.FromTGCSphere(meshName, Texture, indices, vertices, Transform, AlphaBlendEnable);
return TgcMesh.FromTGCSphere(meshName, Texture, indices, vertices, Transform, AlphaBlend);
}

/// <remarks> http://gamedev.stackexchange.com/questions/31308/algorithm-for-creating-spheres David Lively</remarks>
Expand Down
20 changes: 10 additions & 10 deletions TGC.Core/Geometry/TgcBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public TGCBox()
D3DDevice.Instance.Device,
Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColoredTextured.Format, Pool.Default);

AutoTransformEnable = false;
AutoTransform = false;
Transform = TGCMatrix.Identity;
translation = TGCVector3.Empty;
rotation = TGCVector3.Empty;
Enabled = true;
Color = Color.White;
AlphaBlendEnable = false;
AlphaBlend = false;
UVOffset = TGCVector2.Zero;
UVTiling = TGCVector2.One;

Expand All @@ -58,15 +58,15 @@ public TGCBox()
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// En True hace que la matriz de transformacion (Transform) de la malla se actualiza en
/// cada cuadro en forma automática, según los valores de: Position, Rotation, Scale.
/// En False se respeta lo que el usuario haya cargado a mano en la matriz.
/// Por default está en False.
/// </summary>
public bool AutoTransformEnable { get; set; }
public bool AutoTransform { get; set; }

/// <summary>
/// BoundingBox de la caja
Expand Down Expand Up @@ -183,7 +183,7 @@ public void Render()
return;

//transformacion
if (AutoTransformEnable)
if (AutoTransform)
{
Transform = TGCMatrix.RotationYawPitchRoll(rotation.Y, rotation.X, rotation.Z) *
TGCMatrix.Translation(translation);
Expand Down Expand Up @@ -390,7 +390,7 @@ public void setTexture(TgcTexture texture)
/// </summary>
protected void activateAlphaBlend()
{
if (AlphaBlendEnable)
if (AlphaBlend)
{
D3DDevice.Instance.Device.RenderState.AlphaTestEnable = true;
D3DDevice.Instance.Device.RenderState.AlphaBlendEnable = true;
Expand Down Expand Up @@ -448,12 +448,12 @@ private void updateBoundingBox()
public TgcMesh ToMesh(string meshName)
{
//Obtener matriz para transformar vertices
if (AutoTransformEnable)
if (AutoTransform)
{
Transform = TGCMatrix.RotationYawPitchRoll(rotation.Y, rotation.X, rotation.Z) * TGCMatrix.Translation(translation);
}

return TgcMesh.FromTGCBox(meshName, this.Texture, this.vertices, this.Transform, this.AlphaBlendEnable);
return TgcMesh.FromTGCBox(meshName, this.Texture, this.vertices, this.Transform, this.AlphaBlend);
}

/// <summary>
Expand All @@ -469,10 +469,10 @@ public TGCBox clone()
{
cloneBox.setTexture(Texture.Clone());
}
cloneBox.AutoTransformEnable = AutoTransformEnable;
cloneBox.AutoTransform = AutoTransform;
cloneBox.Transform = Transform;
cloneBox.rotation = rotation;
cloneBox.AlphaBlendEnable = AlphaBlendEnable;
cloneBox.AlphaBlend = AlphaBlend;
cloneBox.UVOffset = UVOffset;
cloneBox.UVTiling = UVTiling;

Expand Down
4 changes: 2 additions & 2 deletions TGC.Core/Geometry/TgcBoxDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public TgcBoxDebug()
Thickness = 1f;
Enabled = true;
color = Color.White;
AlphaBlendEnable = false;
AlphaBlend = false;

//Shader
effect = TgcShaders.Instance.VariosShader;
Expand Down Expand Up @@ -105,7 +105,7 @@ public string Technique
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// Renderizar la caja
Expand Down
4 changes: 2 additions & 2 deletions TGC.Core/Geometry/TgcConvexPolygon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TgcConvexPolygon : IRenderObject
public TgcConvexPolygon()
{
Enabled = true;
AlphaBlendEnable = false;
AlphaBlend = false;
color = Color.Purple;
}

Expand Down Expand Up @@ -145,7 +145,7 @@ public Color Color
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

# endregion
}
Expand Down
10 changes: 5 additions & 5 deletions TGC.Core/Geometry/TgcCylinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public TgcCylinder(TGCVector3 _center, float _topRadius, float _bottomRadius, fl
color = Color.Red.ToArgb();

manualTransformation = TGCMatrix.Identity;
AutoTransformEnable = false;
AutoTransform = false;

initialize();
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public TGCVector3 Center

public void Render()
{
if (AlphaBlendEnable)
if (AlphaBlend)
{
D3DDevice.Instance.Device.RenderState.AlphaBlendEnable = true;
D3DDevice.Instance.Device.RenderState.AlphaTestEnable = true;
Expand Down Expand Up @@ -156,7 +156,7 @@ public void Dispose()
BoundingCylinder.Dispose();
}

public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

private void initialize()
{
Expand Down Expand Up @@ -253,13 +253,13 @@ public void updateValues()

#region Transformation

public bool AutoTransformEnable { get; set; }
public bool AutoTransform { get; set; }

public TGCMatrix Transform
{
get
{
if (AutoTransformEnable) return BoundingCylinder.Transform;
if (AutoTransform) return BoundingCylinder.Transform;
return manualTransformation;
}
set { manualTransformation = value; }
Expand Down
4 changes: 2 additions & 2 deletions TGC.Core/Geometry/TgcLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public TgcLine()
vertices = new CustomVertex.PositionColored[2];
color = Color.White;
Enabled = true;
AlphaBlendEnable = false;
AlphaBlend = false;

//Shader
effect = TgcShaders.Instance.VariosShader;
Expand Down Expand Up @@ -86,7 +86,7 @@ public string Technique
/// con textura o colores por vértice de canal Alpha.
/// Por default está deshabilitado.
/// </summary>
public bool AlphaBlendEnable { get; set; }
public bool AlphaBlend { get; set; }

/// <summary>
/// Renderizar la línea
Expand Down
Loading

0 comments on commit 736fe29

Please sign in to comment.