mirror of
https://github.com/LazyDuchess/OpenTS2.git
synced 2025-01-23 08:41:47 -05:00
Remove more useless debug lines, fix 32 bit texture loading
This commit is contained in:
parent
2435117d96
commit
c32541ba12
4 changed files with 13 additions and 6 deletions
|
@ -113,17 +113,17 @@ namespace OpenTS2.Content.DBPF.Scenegraph
|
||||||
{
|
{
|
||||||
// TODO: For now these just use the standard shader, see if we need something different.
|
// TODO: For now these just use the standard shader, see if we need something different.
|
||||||
var shader = Shader.Find("OpenTS2/StandardMaterial/AlphaCutOut");
|
var shader = Shader.Find("OpenTS2/StandardMaterial/AlphaCutOut");
|
||||||
var material = new Material(shader);
|
|
||||||
|
|
||||||
Debug.Log("imposter material: " + MaterialDefinition);
|
|
||||||
string textureName;
|
string textureName;
|
||||||
if (MaterialDefinition.MaterialName.Contains("terrainmaterial"))
|
if (MaterialDefinition.MaterialName.Contains("terrainmaterial"))
|
||||||
{
|
{
|
||||||
textureName = "terrain_txtr";
|
textureName = "terrain_txtr";
|
||||||
|
shader = Shader.Find("OpenTS2/StandardMaterial/AlphaBlended");
|
||||||
}
|
}
|
||||||
else if (MaterialDefinition.MaterialName.Contains("roof"))
|
else if (MaterialDefinition.MaterialName.Contains("roof"))
|
||||||
{
|
{
|
||||||
textureName = "roofs_txtr";
|
textureName = "roofs_txtr";
|
||||||
|
// TODO: roofs need a special shader, they UV map based on just their x and y coordinates on the lot.
|
||||||
}
|
}
|
||||||
else if (MaterialDefinition.MaterialName.Contains("wall"))
|
else if (MaterialDefinition.MaterialName.Contains("wall"))
|
||||||
{
|
{
|
||||||
|
@ -138,11 +138,14 @@ namespace OpenTS2.Content.DBPF.Scenegraph
|
||||||
throw new NotImplementedException($"Unknown imposter material: {MaterialDefinition.MaterialName}");
|
throw new NotImplementedException($"Unknown imposter material: {MaterialDefinition.MaterialName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var material = new Material(shader);
|
||||||
|
|
||||||
var texture = ContentProvider.Get().GetAsset<ScenegraphTextureAsset>(
|
var texture = ContentProvider.Get().GetAsset<ScenegraphTextureAsset>(
|
||||||
new ResourceKey(textureName, GlobalTGI.GroupID, TypeIDs.SCENEGRAPH_TXTR)
|
new ResourceKey(textureName, GlobalTGI.GroupID, TypeIDs.SCENEGRAPH_TXTR)
|
||||||
);
|
);
|
||||||
_textures.Add(texture);
|
_textures.Add(texture);
|
||||||
material.mainTexture = texture.GetSelectedImageAsUnityTexture(ContentProvider.Get());
|
material.mainTexture = texture.GetSelectedImageAsUnityTexture(ContentProvider.Get());
|
||||||
|
material.SetFloat(AlphaCutOff, 0.5f);
|
||||||
|
|
||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,8 @@ namespace OpenTS2.Content.DBPF.Scenegraph
|
||||||
{
|
{
|
||||||
var unityFormat = format switch
|
var unityFormat = format switch
|
||||||
{
|
{
|
||||||
ScenegraphTextureFormat.RGBA32 => TextureFormat.RGBA32,
|
ScenegraphTextureFormat.RGBA32 => TextureFormat.BGRA32,
|
||||||
|
// TODO: this might be wrong as the game uses BRGA for 32-bit textures.
|
||||||
ScenegraphTextureFormat.RGB24 => TextureFormat.RGB24,
|
ScenegraphTextureFormat.RGB24 => TextureFormat.RGB24,
|
||||||
ScenegraphTextureFormat.Alpha8 => TextureFormat.Alpha8,
|
ScenegraphTextureFormat.Alpha8 => TextureFormat.Alpha8,
|
||||||
ScenegraphTextureFormat.DXT1 => TextureFormat.DXT1,
|
ScenegraphTextureFormat.DXT1 => TextureFormat.DXT1,
|
||||||
|
@ -118,6 +119,7 @@ namespace OpenTS2.Content.DBPF.Scenegraph
|
||||||
ScenegraphTextureFormat.Luminance8 => TextureFormat.R8,
|
ScenegraphTextureFormat.Luminance8 => TextureFormat.R8,
|
||||||
ScenegraphTextureFormat.Luminance16 => TextureFormat.R16,
|
ScenegraphTextureFormat.Luminance16 => TextureFormat.R16,
|
||||||
ScenegraphTextureFormat.DXT5 => TextureFormat.DXT5,
|
ScenegraphTextureFormat.DXT5 => TextureFormat.DXT5,
|
||||||
|
// TODO: this might be wrong as the game uses BRGA for 32-bit textures.
|
||||||
ScenegraphTextureFormat.RGB24_repeat => TextureFormat.RGB24,
|
ScenegraphTextureFormat.RGB24_repeat => TextureFormat.RGB24,
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(format), format, null)
|
_ => throw new ArgumentOutOfRangeException(nameof(format), format, null)
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,6 @@ namespace OpenTS2.Files.Formats.DBPF.Scenegraph.Block
|
||||||
{
|
{
|
||||||
var graphNode = ObjectGraphNodeBlock.Deserialize(reader);
|
var graphNode = ObjectGraphNodeBlock.Deserialize(reader);
|
||||||
var resource = ScenegraphResource.Deserialize(reader);
|
var resource = ScenegraphResource.Deserialize(reader);
|
||||||
Debug.Log($"resource: {resource}, version: {blockTypeInfo.Version}");
|
|
||||||
|
|
||||||
if (blockTypeInfo.Version > 6)
|
if (blockTypeInfo.Version > 6)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +63,6 @@ namespace OpenTS2.Files.Formats.DBPF.Scenegraph.Block
|
||||||
|
|
||||||
// Read an object reference to the actual geometry data.
|
// Read an object reference to the actual geometry data.
|
||||||
var geometryDataRef = ObjectReference.Deserialize(reader);
|
var geometryDataRef = ObjectReference.Deserialize(reader);
|
||||||
Debug.Log($"Object reference idx: {geometryDataRef.Index}");
|
|
||||||
|
|
||||||
return new GeometryNodeBlock(blockTypeInfo, resource, geometryDataRef);
|
return new GeometryNodeBlock(blockTypeInfo, resource, geometryDataRef);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using OpenTS2.Common;
|
using OpenTS2.Common;
|
||||||
using OpenTS2.Content;
|
using OpenTS2.Content;
|
||||||
using OpenTS2.Content.DBPF;
|
using OpenTS2.Content.DBPF;
|
||||||
|
@ -31,10 +32,13 @@ namespace OpenTS2.Scenes
|
||||||
// Render lot imposters.
|
// Render lot imposters.
|
||||||
foreach (var lot in NeighborhoodManager.CurrentNeighborhood.Lots)
|
foreach (var lot in NeighborhoodManager.CurrentNeighborhood.Lots)
|
||||||
{
|
{
|
||||||
|
if (!lot.LotPackage.ToLower().Contains("lot3"))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
var model = lot.GetLotImposterResource();
|
var model = lot.GetLotImposterResource();
|
||||||
Debug.Log($"lot imposter resource: {model.ResourceCollection}");
|
Debug.Log($"lot imposter resource: {model.ResourceCollection}");
|
||||||
model.CreateGameObjectForShape();
|
model.CreateGameObjectForShape();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue