mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 15:14:55 +00:00
Rewrite all the texture modes to use proper enums
This commit is contained in:
parent
db065e1c57
commit
1ab2164339
27 changed files with 225 additions and 158 deletions
Binary file not shown.
|
@ -85,43 +85,35 @@ namespace FirstPlugin
|
||||||
|
|
||||||
switch (TextureMapInfo.WrapU)
|
switch (TextureMapInfo.WrapU)
|
||||||
{
|
{
|
||||||
case PICATextureWrap.Repeat: tex1.wrapModeS = 0; break;
|
case PICATextureWrap.Repeat: tex1.WrapModeS = STTextureWrapMode.Repeat; break;
|
||||||
case PICATextureWrap.Mirror: tex1.wrapModeS = 1; break;
|
case PICATextureWrap.Mirror: tex1.WrapModeS = STTextureWrapMode.Mirror; break;
|
||||||
case PICATextureWrap.ClampToEdge: tex1.wrapModeS = 2; break;
|
case PICATextureWrap.ClampToEdge: tex1.WrapModeS = STTextureWrapMode.Clamp; break;
|
||||||
case PICATextureWrap.ClampToBorder: tex1.wrapModeS = 2; break;
|
case PICATextureWrap.ClampToBorder: tex1.WrapModeS = STTextureWrapMode.Clamp; break;
|
||||||
}
|
}
|
||||||
switch (TextureMapInfo.WrapV)
|
switch (TextureMapInfo.WrapV)
|
||||||
{
|
{
|
||||||
case PICATextureWrap.Repeat: tex1.wrapModeT = 0; break;
|
case PICATextureWrap.Repeat: tex1.WrapModeT = STTextureWrapMode.Repeat; break;
|
||||||
case PICATextureWrap.Mirror: tex1.wrapModeT = 1; break;
|
case PICATextureWrap.Mirror: tex1.WrapModeT = STTextureWrapMode.Mirror; break;
|
||||||
case PICATextureWrap.ClampToEdge: tex1.wrapModeT = 2; break;
|
case PICATextureWrap.ClampToEdge: tex1.WrapModeT = STTextureWrapMode.Clamp; break;
|
||||||
case PICATextureWrap.ClampToBorder: tex1.wrapModeT = 2; break;
|
case PICATextureWrap.ClampToBorder: tex1.WrapModeT = STTextureWrapMode.Clamp; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (TextureMapInfo.MagFilter)
|
switch (TextureMapInfo.MagFilter)
|
||||||
{
|
{
|
||||||
case PICATextureFilter.Linear: tex1.magFilter = 0; break;
|
case PICATextureFilter.Linear: tex1.MagFilter = STTextureMagFilter.Linear; break;
|
||||||
case PICATextureFilter.Nearest: tex1.magFilter = 1; break;
|
case PICATextureFilter.Nearest: tex1.MagFilter = STTextureMagFilter.Nearest; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (TextureMapInfo.MinFilter)
|
switch (TextureMapInfo.MinFilter)
|
||||||
{
|
{
|
||||||
case PICATextureFilter.Linear: tex1.minFilter = 0; break;
|
case PICATextureFilter.Linear: tex1.MagFilter = STTextureMagFilter.Linear; break;
|
||||||
case PICATextureFilter.Nearest: tex1.minFilter = 1; break;
|
case PICATextureFilter.Nearest: tex1.MagFilter = STTextureMagFilter.Nearest; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (TextureMapInfo.MipFilter)
|
switch (TextureMapInfo.MipFilter)
|
||||||
{
|
{
|
||||||
case PICATextureFilter.Linear: tex1.mipDetail = 0; break;
|
case PICATextureFilter.Linear: tex1.MagFilter = STTextureMagFilter.Linear; break;
|
||||||
case PICATextureFilter.Nearest: tex1.mipDetail = 1; break;
|
case PICATextureFilter.Nearest: tex1.MagFilter = STTextureMagFilter.Nearest; break;
|
||||||
}
|
|
||||||
|
|
||||||
switch (TextureMapInfo.WrapV)
|
|
||||||
{
|
|
||||||
case PICATextureWrap.Repeat: tex1.wrapModeT = 0; break;
|
|
||||||
case PICATextureWrap.Mirror: tex1.wrapModeT = 1; break;
|
|
||||||
case PICATextureWrap.ClampToEdge: tex1.wrapModeT = 2; break;
|
|
||||||
case PICATextureWrap.ClampToBorder: tex1.wrapModeT = 2; break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -983,8 +983,8 @@ namespace Bfres.Structs
|
||||||
//Note we can't add/remove samplers so we must fill these slots
|
//Note we can't add/remove samplers so we must fill these slots
|
||||||
foreach (var t in fmat.TextureMaps)
|
foreach (var t in fmat.TextureMaps)
|
||||||
{
|
{
|
||||||
t.wrapModeS = 0;
|
t.WrapModeS = STTextureWrapMode.Repeat;
|
||||||
t.wrapModeT = 0;
|
t.WrapModeT = STTextureWrapMode.Repeat;
|
||||||
|
|
||||||
switch (t.Type)
|
switch (t.Type)
|
||||||
{
|
{
|
||||||
|
@ -1076,9 +1076,9 @@ namespace Bfres.Structs
|
||||||
if (t.Type == tex.Type)
|
if (t.Type == tex.Type)
|
||||||
{
|
{
|
||||||
t.Name = tex.Name;
|
t.Name = tex.Name;
|
||||||
t.wrapModeS = tex.wrapModeS;
|
t.WrapModeS = tex.WrapModeS;
|
||||||
t.wrapModeT = tex.wrapModeT;
|
t.WrapModeT = tex.WrapModeT;
|
||||||
t.wrapModeW = tex.wrapModeW;
|
t.WrapModeW = tex.WrapModeW;
|
||||||
t.Type = tex.Type;
|
t.Type = tex.Type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -791,7 +791,7 @@ namespace Bfres.Structs
|
||||||
|
|
||||||
texSampler.LodBias = matTex.BiasLod;
|
texSampler.LodBias = matTex.BiasLod;
|
||||||
texSampler.MaxLod = matTex.MaxLod;
|
texSampler.MaxLod = matTex.MaxLod;
|
||||||
texSampler.MinLod = matTex.minFilter;
|
texSampler.MinLod = matTex.MinLod;
|
||||||
|
|
||||||
return texSampler;
|
return texSampler;
|
||||||
}
|
}
|
||||||
|
|
|
@ -690,19 +690,19 @@ namespace FirstPlugin
|
||||||
MatTexture texture = new MatTexture();
|
MatTexture texture = new MatTexture();
|
||||||
texture.switchSampler = mat.Samplers[id];
|
texture.switchSampler = mat.Samplers[id];
|
||||||
|
|
||||||
texture.wrapModeS = (int)mat.Samplers[id].WrapModeU;
|
texture.WrapModeS = (STTextureWrapMode)mat.Samplers[id].WrapModeU;
|
||||||
texture.wrapModeT = (int)mat.Samplers[id].WrapModeV;
|
texture.WrapModeT = (STTextureWrapMode)mat.Samplers[id].WrapModeV;
|
||||||
texture.wrapModeW = (int)mat.Samplers[id].WrapModeW;
|
texture.WrapModeW = (STTextureWrapMode)mat.Samplers[id].WrapModeW;
|
||||||
texture.SamplerName = mat.SamplerDict.GetKey(id);
|
texture.SamplerName = mat.SamplerDict.GetKey(id);
|
||||||
|
|
||||||
if (mat.Samplers[id].ShrinkXY == Sampler.ShrinkFilterModes.Points)
|
if (mat.Samplers[id].ShrinkXY == Sampler.ShrinkFilterModes.Points)
|
||||||
texture.minFilter = 1;
|
texture.MinFilter = STTextureMinFilter.Nearest;
|
||||||
else
|
else
|
||||||
texture.minFilter = 0;
|
texture.MinFilter = STTextureMinFilter.Linear;
|
||||||
if (mat.Samplers[id].ExpandXY == Sampler.ExpandFilterModes.Points)
|
if (mat.Samplers[id].ExpandXY == Sampler.ExpandFilterModes.Points)
|
||||||
texture.magFilter = 1;
|
texture.MagFilter = STTextureMagFilter.Nearest;
|
||||||
else
|
else
|
||||||
texture.magFilter = 0;
|
texture.MagFilter = STTextureMagFilter.Linear;
|
||||||
|
|
||||||
string useSampler = texture.SamplerName;
|
string useSampler = texture.SamplerName;
|
||||||
|
|
||||||
|
|
|
@ -474,9 +474,9 @@ namespace FirstPlugin
|
||||||
texture.MaxLod = mat.Samplers[id].TexSampler.MaxLod;
|
texture.MaxLod = mat.Samplers[id].TexSampler.MaxLod;
|
||||||
texture.BiasLod = mat.Samplers[id].TexSampler.LodBias;
|
texture.BiasLod = mat.Samplers[id].TexSampler.LodBias;
|
||||||
|
|
||||||
texture.wrapModeS = (int)mat.Samplers[id].TexSampler.ClampX;
|
texture.WrapModeS = (STTextureWrapMode)mat.Samplers[id].TexSampler.ClampX;
|
||||||
texture.wrapModeT = (int)mat.Samplers[id].TexSampler.ClampY;
|
texture.WrapModeT = (STTextureWrapMode)mat.Samplers[id].TexSampler.ClampY;
|
||||||
texture.wrapModeW = (int)mat.Samplers[id].TexSampler.ClampZ;
|
texture.WrapModeW = (STTextureWrapMode)mat.Samplers[id].TexSampler.ClampZ;
|
||||||
mat.Samplers.TryGetKey(mat.Samplers[id], out texture.SamplerName);
|
mat.Samplers.TryGetKey(mat.Samplers[id], out texture.SamplerName);
|
||||||
|
|
||||||
string useSampler = texture.SamplerName;
|
string useSampler = texture.SamplerName;
|
||||||
|
@ -487,13 +487,13 @@ namespace FirstPlugin
|
||||||
|
|
||||||
|
|
||||||
if (mat.Samplers[id].TexSampler.MinFilter == GX2TexXYFilterType.Point)
|
if (mat.Samplers[id].TexSampler.MinFilter == GX2TexXYFilterType.Point)
|
||||||
texture.minFilter = 1;
|
texture.MinFilter = STTextureMinFilter.Nearest;
|
||||||
if (mat.Samplers[id].TexSampler.MagFilter == GX2TexXYFilterType.Point)
|
if (mat.Samplers[id].TexSampler.MagFilter == GX2TexXYFilterType.Point)
|
||||||
texture.magFilter = 1;
|
texture.MagFilter = STTextureMagFilter.Nearest;
|
||||||
if (mat.Samplers[id].TexSampler.MinFilter == GX2TexXYFilterType.Bilinear)
|
if (mat.Samplers[id].TexSampler.MinFilter == GX2TexXYFilterType.Bilinear)
|
||||||
texture.minFilter = 0;
|
texture.MinFilter = STTextureMinFilter.Linear;
|
||||||
if (mat.Samplers[id].TexSampler.MagFilter == GX2TexXYFilterType.Bilinear)
|
if (mat.Samplers[id].TexSampler.MagFilter == GX2TexXYFilterType.Bilinear)
|
||||||
texture.magFilter = 0;
|
texture.MagFilter = STTextureMagFilter.Linear;
|
||||||
|
|
||||||
if (Runtime.activeGame == Runtime.ActiveGame.MK8D)
|
if (Runtime.activeGame == Runtime.ActiveGame.MK8D)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,10 +41,10 @@ namespace FirstPlugin
|
||||||
matTexture.Type = STGenericMatTexture.TextureType.Diffuse;
|
matTexture.Type = STGenericMatTexture.TextureType.Diffuse;
|
||||||
matTexture.textureUnit = textureUnit++;
|
matTexture.textureUnit = textureUnit++;
|
||||||
|
|
||||||
matTexture.wrapModeS = (int)GXToOpenGL.GetWrapMode(ParentModel.Textures[texIndex].WrapS);
|
matTexture.WrapModeS = (STTextureWrapMode)GXToOpenGL.GetWrapMode(ParentModel.Textures[texIndex].WrapS);
|
||||||
matTexture.wrapModeT = (int)GXToOpenGL.GetWrapMode(ParentModel.Textures[texIndex].WrapT);
|
matTexture.WrapModeT = (STTextureWrapMode)GXToOpenGL.GetWrapMode(ParentModel.Textures[texIndex].WrapT);
|
||||||
matTexture.minFilter = (int)GXToOpenGL.GetMinFilter(ParentModel.Textures[texIndex].MinFilter);
|
matTexture.MinFilter = (STTextureMinFilter)GXToOpenGL.GetMinFilter(ParentModel.Textures[texIndex].MinFilter);
|
||||||
matTexture.magFilter = (int)GXToOpenGL.GetMinFilter(ParentModel.Textures[texIndex].MagFilter);
|
matTexture.MagFilter = (STTextureMagFilter)GXToOpenGL.GetMinFilter(ParentModel.Textures[texIndex].MagFilter);
|
||||||
|
|
||||||
TextureMaps.Add(matTexture);
|
TextureMaps.Add(matTexture);
|
||||||
|
|
||||||
|
|
|
@ -270,8 +270,8 @@ namespace FirstPlugin
|
||||||
STGenericMatTexture matTexture = new STGenericMatTexture();
|
STGenericMatTexture matTexture = new STGenericMatTexture();
|
||||||
matTexture.Name = textureMap.Name;
|
matTexture.Name = textureMap.Name;
|
||||||
matTexture.textureUnit = textureUnit++;
|
matTexture.textureUnit = textureUnit++;
|
||||||
matTexture.wrapModeS = 1;
|
matTexture.WrapModeS = STTextureWrapMode.Mirror;
|
||||||
matTexture.wrapModeT = 0;
|
matTexture.WrapModeT = STTextureWrapMode.Repeat;
|
||||||
|
|
||||||
if (textureMap.Effect == "Col0Tex")
|
if (textureMap.Effect == "Col0Tex")
|
||||||
{
|
{
|
||||||
|
|
|
@ -203,10 +203,8 @@ namespace FirstPlugin
|
||||||
{
|
{
|
||||||
if (tex.TextureIndex != -1)
|
if (tex.TextureIndex != -1)
|
||||||
{
|
{
|
||||||
CMBTextureMapWrapper matTexture = new CMBTextureMapWrapper();
|
CMBTextureMapWrapper matTexture = new CMBTextureMapWrapper(tex);
|
||||||
matTexture.TextureIndex = tex.TextureIndex;
|
matTexture.TextureIndex = tex.TextureIndex;
|
||||||
matTexture.wrapModeS = tex.WrapS;
|
|
||||||
matTexture.wrapModeT = tex.WrapT;
|
|
||||||
material.TextureMaps.Add(matTexture);
|
material.TextureMaps.Add(matTexture);
|
||||||
|
|
||||||
if (tex.TextureIndex < Renderer.TextureList.Count && tex.TextureIndex >= 0)
|
if (tex.TextureIndex < Renderer.TextureList.Count && tex.TextureIndex >= 0)
|
||||||
|
@ -390,6 +388,54 @@ namespace FirstPlugin
|
||||||
public class CMBTextureMapWrapper : STGenericMatTexture
|
public class CMBTextureMapWrapper : STGenericMatTexture
|
||||||
{
|
{
|
||||||
public int TextureIndex { get; set; }
|
public int TextureIndex { get; set; }
|
||||||
|
|
||||||
|
public TextureMap TextureMapData;
|
||||||
|
|
||||||
|
public CMBTextureMapWrapper(TextureMap texMap)
|
||||||
|
{
|
||||||
|
TextureMapData = texMap;
|
||||||
|
|
||||||
|
this.WrapModeS = ConvertWrapMode(TextureMapData.WrapS);
|
||||||
|
this.WrapModeT = ConvertWrapMode(TextureMapData.WrapT);
|
||||||
|
this.MinFilter = ConvertMinFilterMode(TextureMapData.MinFiler);
|
||||||
|
this.MagFilter = ConvertMagFilterMode(TextureMapData.MagFiler);
|
||||||
|
}
|
||||||
|
|
||||||
|
private STTextureMinFilter ConvertMinFilterMode(ushort PicaFilterMode)
|
||||||
|
{
|
||||||
|
switch ((TextureFilter)PicaFilterMode)
|
||||||
|
{
|
||||||
|
case TextureFilter.LINEAR: return STTextureMinFilter.Linear;
|
||||||
|
case TextureFilter.LINEAR_MIPMAP_LINEAR: return STTextureMinFilter.LinearMipMapNearest;
|
||||||
|
case TextureFilter.LINEAR_MIPMAP_NEAREST: return STTextureMinFilter.NearestMipmapLinear;
|
||||||
|
case TextureFilter.NEAREST: return STTextureMinFilter.Nearest;
|
||||||
|
case TextureFilter.NEAREST_MIPMAP_LINEAR: return STTextureMinFilter.NearestMipmapLinear;
|
||||||
|
case TextureFilter.NEAREST_MIPMAP_NEAREST: return STTextureMinFilter.NearestMipmapNearest;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private STTextureMagFilter ConvertMagFilterMode(ushort PicaFilterMode)
|
||||||
|
{
|
||||||
|
switch ((TextureFilter)PicaFilterMode)
|
||||||
|
{
|
||||||
|
case TextureFilter.LINEAR: return STTextureMagFilter.Linear;
|
||||||
|
case TextureFilter.NEAREST: return STTextureMagFilter.Nearest;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private STTextureWrapMode ConvertWrapMode(ushort PicaWrapMode)
|
||||||
|
{
|
||||||
|
switch ((CMBTextureWrapMode)PicaWrapMode)
|
||||||
|
{
|
||||||
|
case CMBTextureWrapMode.REPEAT: return STTextureWrapMode.Repeat;
|
||||||
|
case CMBTextureWrapMode.MIRRORED_REPEAT: return STTextureWrapMode.Mirror;
|
||||||
|
case CMBTextureWrapMode.CLAMP: return STTextureWrapMode.Clamp;
|
||||||
|
case CMBTextureWrapMode.CLAMP_TO_EDGE: return STTextureWrapMode.Clamp;
|
||||||
|
default: return STTextureWrapMode.Repeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CmbMeshWrapper : GenericRenderedObject
|
public class CmbMeshWrapper : GenericRenderedObject
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Grezzo.CmbEnums
|
||||||
SMOOTH_SKINNING = 0x02,
|
SMOOTH_SKINNING = 0x02,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TextureWrapMode
|
public enum CMBTextureWrapMode
|
||||||
{
|
{
|
||||||
CLAMP = 0x2900,
|
CLAMP = 0x2900,
|
||||||
REPEAT = 0x2901,
|
REPEAT = 0x2901,
|
||||||
|
|
|
@ -275,10 +275,10 @@ namespace FirstPlugin
|
||||||
{
|
{
|
||||||
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texid);
|
GL.BindTexture(TextureTarget.Texture2D, texid);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)STGenericMatTexture.wrapmode[tex.wrapModeS]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)STGenericMatTexture.wrapmode[tex.WrapModeS]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)STGenericMatTexture.wrapmode[tex.wrapModeT]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)STGenericMatTexture.wrapmode[tex.WrapModeT]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[tex.minFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[tex.MinFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[tex.magFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[tex.MagFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -704,10 +704,10 @@ namespace FirstPlugin
|
||||||
|
|
||||||
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.RenderableTex.TexID);
|
GL.BindTexture(TextureTarget.Texture2D, texture.RenderableTex.TexID);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)MatTexture.wrapmode[tex.wrapModeS]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)MatTexture.wrapmode[tex.WrapModeS]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)MatTexture.wrapmode[tex.wrapModeT]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)MatTexture.wrapmode[tex.WrapModeT]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)MatTexture.minfilter[tex.minFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)MatTexture.minfilter[tex.MinFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)MatTexture.magfilter[tex.magFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)MatTexture.magfilter[tex.MagFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
||||||
}
|
}
|
||||||
private void DrawModel(FSHP m, FMDL mdl, SF.Shader shader, bool ModelSelected)
|
private void DrawModel(FSHP m, FMDL mdl, SF.Shader shader, bool ModelSelected)
|
||||||
|
|
|
@ -376,10 +376,10 @@ namespace FirstPlugin
|
||||||
|
|
||||||
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.RenderableTex.TexID);
|
GL.BindTexture(TextureTarget.Texture2D, texture.RenderableTex.TexID);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)STGenericMatTexture.wrapmode[tex.wrapModeS]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)STGenericMatTexture.wrapmode[tex.WrapModeS]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)STGenericMatTexture.wrapmode[tex.wrapModeT]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)STGenericMatTexture.wrapmode[tex.WrapModeT]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[tex.minFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[tex.MinFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[tex.magFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[tex.MagFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,12 +112,10 @@ namespace FirstPlugin.Forms
|
||||||
TextureMap.UVScale = Utils.ToVec4(material.matparam["gsys_bake_st1"].ValueFloat).Xy;
|
TextureMap.UVScale = Utils.ToVec4(material.matparam["gsys_bake_st1"].ValueFloat).Xy;
|
||||||
TextureMap.UVTranslate = Utils.ToVec4(material.matparam["gsys_bake_st1"].ValueFloat).Zw;
|
TextureMap.UVTranslate = Utils.ToVec4(material.matparam["gsys_bake_st1"].ValueFloat).Zw;
|
||||||
}
|
}
|
||||||
TextureMap.wrapModeS = texmap.wrapModeS;
|
TextureMap.WrapModeS = texmap.WrapModeS;
|
||||||
TextureMap.wrapModeT = texmap.wrapModeT;
|
TextureMap.WrapModeT = texmap.WrapModeT;
|
||||||
TextureMap.mipDetail = texmap.mipDetail;
|
TextureMap.MinFilter = texmap.MinFilter;
|
||||||
TextureMap.minFilter = texmap.minFilter;
|
TextureMap.MagFilter = texmap.MagFilter;
|
||||||
TextureMap.magFilter = texmap.mapMode;
|
|
||||||
TextureMap.mapMode = texmap.mapMode;
|
|
||||||
|
|
||||||
TextureMap.texture = genericTexture;
|
TextureMap.texture = genericTexture;
|
||||||
return TextureMap;
|
return TextureMap;
|
||||||
|
|
|
@ -417,9 +417,9 @@ namespace FirstPlugin.Forms
|
||||||
tex.FragShaderSampler = "_a1";
|
tex.FragShaderSampler = "_a1";
|
||||||
tex.Name = "Untitled";
|
tex.Name = "Untitled";
|
||||||
tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
|
tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
|
||||||
tex.wrapModeS = 0;
|
tex.WrapModeS = Toolbox.Library.STTextureWrapMode.Repeat;
|
||||||
tex.wrapModeT = 0;
|
tex.WrapModeT = Toolbox.Library.STTextureWrapMode.Repeat;
|
||||||
tex.wrapModeW = 2;
|
tex.WrapModeW = Toolbox.Library.STTextureWrapMode.Clamp;
|
||||||
|
|
||||||
if (material.GetResFileU() != null)
|
if (material.GetResFileU() != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -187,51 +187,51 @@ namespace FirstPlugin.Forms
|
||||||
|
|
||||||
if (ActiveMatTexture.wiiUSampler != null)
|
if (ActiveMatTexture.wiiUSampler != null)
|
||||||
{
|
{
|
||||||
ActiveMatTexture.wrapModeS = SetWrapMode((int)ActiveMatTexture.wiiUSampler.ClampX);
|
ActiveMatTexture.WrapModeS = SetWrapMode((int)ActiveMatTexture.wiiUSampler.ClampX);
|
||||||
ActiveMatTexture.wrapModeT = SetWrapMode((int)ActiveMatTexture.wiiUSampler.ClampY);
|
ActiveMatTexture.WrapModeT = SetWrapMode((int)ActiveMatTexture.wiiUSampler.ClampY);
|
||||||
ActiveMatTexture.wrapModeW = SetWrapMode((int)ActiveMatTexture.wiiUSampler.ClampZ);
|
ActiveMatTexture.WrapModeW = SetWrapMode((int)ActiveMatTexture.wiiUSampler.ClampZ);
|
||||||
|
|
||||||
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Point)
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
ActiveMatTexture.minFilter = 1;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Nearest;
|
||||||
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Point)
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
ActiveMatTexture.magFilter = 1;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Nearest;
|
||||||
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
ActiveMatTexture.minFilter = 0;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Linear;
|
||||||
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
ActiveMatTexture.magFilter = 0;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Linear;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ActiveMatTexture.wrapModeS = SetWrapMode((int)ActiveMatTexture.switchSampler.WrapModeU);
|
ActiveMatTexture.WrapModeS = SetWrapMode((int)ActiveMatTexture.switchSampler.WrapModeU);
|
||||||
ActiveMatTexture.wrapModeT = SetWrapMode((int)ActiveMatTexture.switchSampler.WrapModeV);
|
ActiveMatTexture.WrapModeT = SetWrapMode((int)ActiveMatTexture.switchSampler.WrapModeV);
|
||||||
ActiveMatTexture.wrapModeW = SetWrapMode((int)ActiveMatTexture.switchSampler.WrapModeW);
|
ActiveMatTexture.WrapModeW = SetWrapMode((int)ActiveMatTexture.switchSampler.WrapModeW);
|
||||||
|
|
||||||
if (ActiveMatTexture.switchSampler.ShrinkXY == ResNX.Sampler.ShrinkFilterModes.Points)
|
if (ActiveMatTexture.switchSampler.ShrinkXY == ResNX.Sampler.ShrinkFilterModes.Points)
|
||||||
ActiveMatTexture.minFilter = 1;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Nearest;
|
||||||
if (ActiveMatTexture.switchSampler.ExpandXY == ResNX.Sampler.ExpandFilterModes.Points)
|
if (ActiveMatTexture.switchSampler.ExpandXY == ResNX.Sampler.ExpandFilterModes.Points)
|
||||||
ActiveMatTexture.magFilter = 1;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Nearest;
|
||||||
if (ActiveMatTexture.switchSampler.ShrinkXY == ResNX.Sampler.ShrinkFilterModes.Linear)
|
if (ActiveMatTexture.switchSampler.ShrinkXY == ResNX.Sampler.ShrinkFilterModes.Linear)
|
||||||
ActiveMatTexture.minFilter = 0;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Linear;
|
||||||
if (ActiveMatTexture.switchSampler.ExpandXY == ResNX.Sampler.ExpandFilterModes.Linear)
|
if (ActiveMatTexture.switchSampler.ExpandXY == ResNX.Sampler.ExpandFilterModes.Linear)
|
||||||
ActiveMatTexture.magFilter = 0;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryGUI.UpdateViewport();
|
LibraryGUI.UpdateViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int SetWrapMode(int wrapMode)
|
private STTextureWrapMode SetWrapMode(int wrapMode)
|
||||||
{
|
{
|
||||||
switch (wrapMode)
|
switch (wrapMode)
|
||||||
{
|
{
|
||||||
case (int)ResNX.GFX.TexClamp.Repeat:
|
case (int)ResNX.GFX.TexClamp.Repeat:
|
||||||
return 0;
|
return STTextureWrapMode.Repeat;
|
||||||
case (int)ResNX.GFX.TexClamp.Mirror:
|
case (int)ResNX.GFX.TexClamp.Mirror:
|
||||||
return 1;
|
return STTextureWrapMode.Mirror;
|
||||||
case (int)ResNX.GFX.TexClamp.Clamp:
|
case (int)ResNX.GFX.TexClamp.Clamp:
|
||||||
case (int)ResNX.GFX.TexClamp.ClampToEdge:
|
case (int)ResNX.GFX.TexClamp.ClampToEdge:
|
||||||
return 2;
|
return STTextureWrapMode.Clamp;
|
||||||
default:
|
default:
|
||||||
return 2;
|
return STTextureWrapMode.Clamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,9 +368,9 @@ namespace FirstPlugin.Forms
|
||||||
tex.FragShaderSampler = "_a0";
|
tex.FragShaderSampler = "_a0";
|
||||||
tex.Name = "Untitled";
|
tex.Name = "Untitled";
|
||||||
tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
|
tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
|
||||||
tex.wrapModeS = 0;
|
tex.WrapModeS = STTextureWrapMode.Repeat;
|
||||||
tex.wrapModeT = 0;
|
tex.WrapModeT = STTextureWrapMode.Repeat;
|
||||||
tex.wrapModeW = 2;
|
tex.WrapModeW = STTextureWrapMode.Clamp;
|
||||||
|
|
||||||
if (material.GetResFileU() != null)
|
if (material.GetResFileU() != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,33 +77,34 @@ namespace FirstPlugin.Forms
|
||||||
{
|
{
|
||||||
if (ActiveMatTexture.wiiUSampler != null)
|
if (ActiveMatTexture.wiiUSampler != null)
|
||||||
{
|
{
|
||||||
ActiveMatTexture.wrapModeS = (int)ActiveMatTexture.wiiUSampler.ClampX;
|
ActiveMatTexture.WrapModeS = (STTextureWrapMode)ActiveMatTexture.wiiUSampler.ClampX;
|
||||||
ActiveMatTexture.wrapModeT = (int)ActiveMatTexture.wiiUSampler.ClampY;
|
ActiveMatTexture.WrapModeT = (STTextureWrapMode)ActiveMatTexture.wiiUSampler.ClampY;
|
||||||
ActiveMatTexture.wrapModeW = (int)ActiveMatTexture.wiiUSampler.ClampZ;
|
ActiveMatTexture.WrapModeW = (STTextureWrapMode)ActiveMatTexture.wiiUSampler.ClampZ;
|
||||||
|
|
||||||
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Point)
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
ActiveMatTexture.minFilter = 1;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Nearest;
|
||||||
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Point)
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Point)
|
||||||
ActiveMatTexture.magFilter = 1;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Nearest;
|
||||||
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
if (ActiveMatTexture.wiiUSampler.MinFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
ActiveMatTexture.minFilter = 0;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Linear;
|
||||||
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
if (ActiveMatTexture.wiiUSampler.MagFilter == ResUGX2.GX2TexXYFilterType.Bilinear)
|
||||||
ActiveMatTexture.magFilter = 0;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Linear;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ActiveMatTexture.wrapModeS = (int)ActiveMatTexture.switchSampler.WrapModeU;
|
ActiveMatTexture.WrapModeS = (STTextureWrapMode)ActiveMatTexture.switchSampler.WrapModeU;
|
||||||
ActiveMatTexture.wrapModeT = (int)ActiveMatTexture.switchSampler.WrapModeV;
|
ActiveMatTexture.WrapModeT = (STTextureWrapMode)ActiveMatTexture.switchSampler.WrapModeV;
|
||||||
ActiveMatTexture.wrapModeW = (int)ActiveMatTexture.switchSampler.WrapModeW;
|
ActiveMatTexture.WrapModeW = (STTextureWrapMode)ActiveMatTexture.switchSampler.WrapModeW;
|
||||||
|
|
||||||
|
|
||||||
if (ActiveMatTexture.switchSampler.ShrinkXY == Sampler.ShrinkFilterModes.Points)
|
if (ActiveMatTexture.switchSampler.ShrinkXY == Sampler.ShrinkFilterModes.Points)
|
||||||
ActiveMatTexture.minFilter = 1;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Nearest;
|
||||||
if (ActiveMatTexture.switchSampler.ExpandXY == Sampler.ExpandFilterModes.Points)
|
if (ActiveMatTexture.switchSampler.ExpandXY == Sampler.ExpandFilterModes.Points)
|
||||||
ActiveMatTexture.magFilter = 1;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Nearest;
|
||||||
if (ActiveMatTexture.switchSampler.ShrinkXY == Sampler.ShrinkFilterModes.Linear)
|
if (ActiveMatTexture.switchSampler.ShrinkXY == Sampler.ShrinkFilterModes.Linear)
|
||||||
ActiveMatTexture.minFilter = 0;
|
ActiveMatTexture.MinFilter = STTextureMinFilter.Linear;
|
||||||
if (ActiveMatTexture.switchSampler.ExpandXY == Sampler.ExpandFilterModes.Linear)
|
if (ActiveMatTexture.switchSampler.ExpandXY == Sampler.ExpandFilterModes.Linear)
|
||||||
ActiveMatTexture.magFilter = 0;
|
ActiveMatTexture.MagFilter = STTextureMagFilter.Linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryGUI.UpdateViewport();
|
LibraryGUI.UpdateViewport();
|
||||||
|
|
|
@ -404,27 +404,27 @@ namespace Toolbox.Library
|
||||||
}
|
}
|
||||||
|
|
||||||
matTex.Name = System.IO.Path.GetFileNameWithoutExtension(tex.FilePath);
|
matTex.Name = System.IO.Path.GetFileNameWithoutExtension(tex.FilePath);
|
||||||
matTex.wrapModeS = SetWrapMode(tex.WrapModeU);
|
matTex.WrapModeS = SetWrapMode(tex.WrapModeU);
|
||||||
matTex.wrapModeT = SetWrapMode(tex.WrapModeV);
|
matTex.WrapModeT = SetWrapMode(tex.WrapModeV);
|
||||||
|
|
||||||
STConsole.WriteLine($"Getting assimp texture slot {matTex.Name} Type {matTex.Type}");
|
STConsole.WriteLine($"Getting assimp texture slot {matTex.Name} Type {matTex.Type}");
|
||||||
|
|
||||||
return matTex;
|
return matTex;
|
||||||
}
|
}
|
||||||
private int SetWrapMode(TextureWrapMode wrap)
|
private STTextureWrapMode SetWrapMode(TextureWrapMode wrap)
|
||||||
{
|
{
|
||||||
switch (wrap)
|
switch (wrap)
|
||||||
{
|
{
|
||||||
case TextureWrapMode.Wrap:
|
case TextureWrapMode.Wrap:
|
||||||
return 0;
|
return STTextureWrapMode.Repeat;
|
||||||
case TextureWrapMode.Mirror:
|
case TextureWrapMode.Mirror:
|
||||||
return 1;
|
return STTextureWrapMode.Mirror;
|
||||||
case TextureWrapMode.Clamp:
|
case TextureWrapMode.Clamp:
|
||||||
return 2;
|
return STTextureWrapMode.Clamp;
|
||||||
case TextureWrapMode.Decal:
|
case TextureWrapMode.Decal:
|
||||||
return 0;
|
return STTextureWrapMode.Repeat;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return STTextureWrapMode.Repeat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -556,7 +556,7 @@ namespace Toolbox.Library
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TextureSlot slot2 = new TextureSlot(path, ConvertToAssimpTextureType(tex.Type), 0, TextureMapping.FromUV,
|
TextureSlot slot2 = new TextureSlot(path, ConvertToAssimpTextureType(tex.Type), 0, TextureMapping.FromUV,
|
||||||
0, 1.0f, Assimp.TextureOperation.Add, ConvertToAssimpWrapType(tex.wrapModeS), ConvertToAssimpWrapType(tex.wrapModeT), 0);
|
0, 1.0f, Assimp.TextureOperation.Add, ConvertToAssimpWrapType(tex.WrapModeS), ConvertToAssimpWrapType(tex.WrapModeT), 0);
|
||||||
|
|
||||||
material.AddMaterialTexture(ref slot2);
|
material.AddMaterialTexture(ref slot2);
|
||||||
}
|
}
|
||||||
|
@ -565,13 +565,13 @@ namespace Toolbox.Library
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Assimp.TextureWrapMode ConvertToAssimpWrapType(int type)
|
private static Assimp.TextureWrapMode ConvertToAssimpWrapType(STTextureWrapMode type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0: return TextureWrapMode.Wrap;
|
case STTextureWrapMode.Repeat: return TextureWrapMode.Wrap;
|
||||||
case 1: return TextureWrapMode.Mirror;
|
case STTextureWrapMode.Mirror: return TextureWrapMode.Mirror;
|
||||||
case 2: return TextureWrapMode.Clamp;
|
case STTextureWrapMode.Clamp: return TextureWrapMode.Clamp;
|
||||||
default:
|
default:
|
||||||
return TextureWrapMode.Wrap;
|
return TextureWrapMode.Wrap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,14 @@ namespace Toolbox.Library.Forms
|
||||||
public STGenericTexture texture;
|
public STGenericTexture texture;
|
||||||
public int UvChannelIndex;
|
public int UvChannelIndex;
|
||||||
public int mapMode = 0;
|
public int mapMode = 0;
|
||||||
public int wrapModeS = 1;
|
|
||||||
public int wrapModeT = 1;
|
public STTextureWrapMode WrapModeS = STTextureWrapMode.Repeat;
|
||||||
public int minFilter = 3;
|
public STTextureWrapMode WrapModeT = STTextureWrapMode.Repeat;
|
||||||
public int magFilter = 2;
|
public STTextureWrapMode WrapModeW = STTextureWrapMode.Clamp;
|
||||||
public int mipDetail = 6;
|
|
||||||
|
public STTextureMinFilter MinFilter = STTextureMinFilter.Linear;
|
||||||
|
public STTextureMagFilter MagFilter = STTextureMagFilter.Linear;
|
||||||
|
|
||||||
public uint texWidth = 0;
|
public uint texWidth = 0;
|
||||||
public uint texHeight = 0;
|
public uint texHeight = 0;
|
||||||
}
|
}
|
||||||
|
@ -277,12 +280,12 @@ namespace Toolbox.Library.Forms
|
||||||
//Draws a textured plan for our uvs to show on
|
//Draws a textured plan for our uvs to show on
|
||||||
GL.Enable(EnableCap.Texture2D);
|
GL.Enable(EnableCap.Texture2D);
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texid);
|
GL.BindTexture(TextureTarget.Texture2D, texid);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)STGenericMatTexture.wrapmode[activeTexture.wrapModeS]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)STGenericMatTexture.wrapmode[activeTexture.WrapModeS]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)STGenericMatTexture.wrapmode[activeTexture.wrapModeT]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)STGenericMatTexture.wrapmode[activeTexture.WrapModeT]);
|
||||||
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)STGenericMatTexture.wrapmode[activeTexture.wrapModeS]);
|
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)STGenericMatTexture.wrapmode[activeTexture.wrapModeS]);
|
||||||
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)STGenericMatTexture.wrapmode[activeTexture.wrapModeT]);
|
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)STGenericMatTexture.wrapmode[activeTexture.wrapModeT]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[activeTexture.minFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[activeTexture.MinFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[activeTexture.magFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[activeTexture.MagFilter]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -335,13 +335,13 @@ namespace Toolbox.Library.Forms.test
|
||||||
private void DrawTexturedPlane(float scale, uint TextureWidth, uint TextureHeight)
|
private void DrawTexturedPlane(float scale, uint TextureWidth, uint TextureHeight)
|
||||||
{
|
{
|
||||||
//Draws a textured plan for our uvs to show on
|
//Draws a textured plan for our uvs to show on
|
||||||
GL.Enable(EnableCap.Texture2D);
|
/* GL.Enable(EnableCap.Texture2D);
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texid);
|
GL.BindTexture(TextureTarget.Texture2D, texid);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)STGenericMatTexture.wrapmode[activeTexture.wrapModeS]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)STGenericMatTexture.wrapmode[activeTexture.wrapModeS]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)STGenericMatTexture.wrapmode[activeTexture.wrapModeT]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)STGenericMatTexture.wrapmode[activeTexture.wrapModeT]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[activeTexture.minFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[activeTexture.minFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[activeTexture.magFilter]);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[activeTexture.magFilter]);
|
||||||
|
*/
|
||||||
|
|
||||||
float HalfWidth = (float)gL_ControlLegacy2D1.Width / 2.0f;
|
float HalfWidth = (float)gL_ControlLegacy2D1.Width / 2.0f;
|
||||||
float HalfHeight = (float)gL_ControlLegacy2D1.Height / 2.0f;
|
float HalfHeight = (float)gL_ControlLegacy2D1.Height / 2.0f;
|
||||||
|
|
|
@ -7,15 +7,38 @@ using OpenTK.Graphics.OpenGL;
|
||||||
|
|
||||||
namespace Toolbox.Library
|
namespace Toolbox.Library
|
||||||
{
|
{
|
||||||
|
public enum STTextureWrapMode
|
||||||
|
{
|
||||||
|
Repeat,
|
||||||
|
Mirror,
|
||||||
|
Clamp,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum STTextureMagFilter
|
||||||
|
{
|
||||||
|
Nearest,
|
||||||
|
Linear,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum STTextureMinFilter
|
||||||
|
{
|
||||||
|
LinearMipMapNearest,
|
||||||
|
Nearest,
|
||||||
|
Linear,
|
||||||
|
NearestMipmapLinear,
|
||||||
|
NearestMipmapNearest,
|
||||||
|
}
|
||||||
|
|
||||||
public class STGenericMatTexture
|
public class STGenericMatTexture
|
||||||
{
|
{
|
||||||
public int mapMode = 0;
|
public int mapMode = 0;
|
||||||
public int wrapModeS = 1;
|
public STTextureWrapMode WrapModeS = STTextureWrapMode.Repeat;
|
||||||
public int wrapModeT = 1;
|
public STTextureWrapMode WrapModeT = STTextureWrapMode.Repeat;
|
||||||
public int wrapModeW = 1; //Used for 3D textures
|
public STTextureWrapMode WrapModeW = STTextureWrapMode.Clamp;
|
||||||
public int minFilter = 3;
|
|
||||||
public int magFilter = 2;
|
public STTextureMinFilter MinFilter = STTextureMinFilter.Linear;
|
||||||
public int mipDetail = 6;
|
public STTextureMagFilter MagFilter = STTextureMagFilter.Linear;
|
||||||
|
|
||||||
public string Name;
|
public string Name;
|
||||||
public string SamplerName;
|
public string SamplerName;
|
||||||
public int textureUnit;
|
public int textureUnit;
|
||||||
|
@ -56,24 +79,28 @@ namespace Toolbox.Library
|
||||||
SubSurfaceScattering = 15,
|
SubSurfaceScattering = 15,
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly Dictionary<int, TextureMinFilter> minfilter = new Dictionary<int, TextureMinFilter>()
|
public static readonly Dictionary<STTextureMinFilter, TextureMinFilter> minfilter = new Dictionary<STTextureMinFilter, TextureMinFilter>()
|
||||||
{
|
{
|
||||||
{ 0x00, TextureMinFilter.LinearMipmapLinear},
|
{ STTextureMinFilter.LinearMipMapNearest, TextureMinFilter.LinearMipmapLinear},
|
||||||
{ 0x01, TextureMinFilter.Nearest},
|
{ STTextureMinFilter.Nearest, TextureMinFilter.Nearest},
|
||||||
{ 0x02, TextureMinFilter.Linear},
|
{ STTextureMinFilter.Linear, TextureMinFilter.Linear},
|
||||||
{ 0x03, TextureMinFilter.NearestMipmapLinear},
|
{ STTextureMinFilter.NearestMipmapLinear, TextureMinFilter.NearestMipmapLinear},
|
||||||
|
{ STTextureMinFilter.NearestMipmapNearest, TextureMinFilter.NearestMipmapNearest},
|
||||||
};
|
};
|
||||||
public static readonly Dictionary<int, TextureMagFilter> magfilter = new Dictionary<int, TextureMagFilter>()
|
public static readonly Dictionary<STTextureMagFilter, TextureMagFilter> magfilter = new Dictionary<STTextureMagFilter, TextureMagFilter>()
|
||||||
{
|
{
|
||||||
{ 0x00, TextureMagFilter.Linear},
|
{ STTextureMagFilter.Linear, TextureMagFilter.Linear},
|
||||||
{ 0x01, TextureMagFilter.Nearest},
|
{ STTextureMagFilter.Nearest, TextureMagFilter.Nearest},
|
||||||
{ 0x02, TextureMagFilter.Linear}
|
{ (STTextureMagFilter)3, TextureMagFilter.Linear},
|
||||||
};
|
};
|
||||||
public static Dictionary<int, TextureWrapMode> wrapmode = new Dictionary<int, TextureWrapMode>(){
|
|
||||||
{ 0x00, TextureWrapMode.Repeat},
|
public static Dictionary<STTextureWrapMode, TextureWrapMode> wrapmode = new Dictionary<STTextureWrapMode, TextureWrapMode>(){
|
||||||
{ 0x01, TextureWrapMode.MirroredRepeat},
|
{ STTextureWrapMode.Repeat, TextureWrapMode.Repeat},
|
||||||
{ 0x02, TextureWrapMode.ClampToEdge},
|
{ STTextureWrapMode.Mirror, TextureWrapMode.MirroredRepeat},
|
||||||
{ 0x03, TextureWrapMode.MirroredRepeat},
|
{ STTextureWrapMode.Clamp, TextureWrapMode.ClampToEdge},
|
||||||
|
{ (STTextureWrapMode)3, TextureWrapMode.ClampToEdge},
|
||||||
|
{ (STTextureWrapMode)4, TextureWrapMode.ClampToEdge},
|
||||||
|
{ (STTextureWrapMode)5, TextureWrapMode.ClampToEdge},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,10 +362,10 @@ namespace Toolbox.Library.Rendering
|
||||||
|
|
||||||
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
// GL.ActiveTexture(TextureUnit.Texture0 + texid);
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.RenderableTex.TexID);
|
GL.BindTexture(TextureTarget.Texture2D, texture.RenderableTex.TexID);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)tex.wrapModeS);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)STGenericMatTexture.wrapmode[tex.WrapModeS]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)tex.wrapModeT);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)STGenericMatTexture.wrapmode[tex.WrapModeT]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)tex.minFilter);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)STGenericMatTexture.minfilter[tex.MinFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)tex.magFilter);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)STGenericMatTexture.magfilter[tex.MagFilter]);
|
||||||
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
GL.TexParameter(TextureTarget.Texture2D, (TextureParameterName)ExtTextureFilterAnisotropic.TextureMaxAnisotropyExt, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -258,7 +258,7 @@
|
||||||
<Compile Include="Rendering\GenericModelRenderer\GenericRenderedObject.cs" />
|
<Compile Include="Rendering\GenericModelRenderer\GenericRenderedObject.cs" />
|
||||||
<Compile Include="Security\Cryptography\crc32.cs" />
|
<Compile Include="Security\Cryptography\crc32.cs" />
|
||||||
<Compile Include="DrawableContainer.cs" />
|
<Compile Include="DrawableContainer.cs" />
|
||||||
<Compile Include="FileFormats\3DS\ETC1.cs" />
|
<Compile Include="Texture Decoding\3DS\ETC1.cs" />
|
||||||
<Compile Include="FileFormats\Animation\SMD.cs" />
|
<Compile Include="FileFormats\Animation\SMD.cs" />
|
||||||
<Compile Include="FileFormats\APNG\APNG.cs" />
|
<Compile Include="FileFormats\APNG\APNG.cs" />
|
||||||
<Compile Include="FileFormats\APNG\CRC.cs" />
|
<Compile Include="FileFormats\APNG\CRC.cs" />
|
||||||
|
|
Loading…
Reference in a new issue