ModelForm fragment render refactor, Grass setting

This commit is contained in:
dexyfex 2017-10-01 18:07:45 +11:00
parent 4084ecf3e9
commit 3e46c2e60a
5 changed files with 50 additions and 23 deletions

View File

@ -85,6 +85,9 @@
<setting name="ShadowCascades" serializeAs="String">
<value>6</value>
</setting>
<setting name="Grass" serializeAs="String">
<value>True</value>
</setting>
<setting name="ShowStatusBar" serializeAs="String">
<value>True</value>
</setting>

View File

@ -1112,28 +1112,7 @@ namespace CodeWalker.Forms
hash = Yft?.RpfFileEntry?.ShortNameHash ?? 0;
arch = TryGetArchetype(hash);
RenderDrawable(f.Drawable, arch, null, -camera.Position, hash);
if (f.Unknown_F8h_Data != null) //cloth
{
RenderDrawable(f.Unknown_F8h_Data, arch, null, -camera.Position, hash);
}
//vehicle wheels...
if ((f.PhysicsLODGroup != null) && (f.PhysicsLODGroup.PhysicsLOD1 != null))
{
var pl1 = f.PhysicsLODGroup.PhysicsLOD1;
if ((pl1.Children != null) && (pl1.Children.data_items != null))
{
for (int i = 0; i < pl1.Children.data_items.Length; i++)
{
var pch = pl1.Children.data_items[i];
if ((pch.Drawable1 != null) && (pch.Drawable1.AllModels.Length != 0))
{
//RenderDrawable(pch.Drawable1, null, null, -camera.Position, hash);
}
}
}
}
RenderFragment(arch, null, f, hash);
}
}
}
@ -1173,7 +1152,36 @@ namespace CodeWalker.Forms
private bool RenderFragment(Archetype arch, YmapEntityDef ent, FragType f, uint txdhash = 0)
{
var pos = ent?.Position ?? Vector3.Zero;
RenderDrawable(f.Drawable, arch, ent, pos - camera.Position, txdhash);
if (f.Unknown_F8h_Data != null) //cloth
{
RenderDrawable(f.Unknown_F8h_Data, arch, ent, pos - camera.Position, txdhash);
}
//vehicle wheels...
if ((f.PhysicsLODGroup != null) && (f.PhysicsLODGroup.PhysicsLOD1 != null))
{
var pl1 = f.PhysicsLODGroup.PhysicsLOD1;
if ((pl1.Children != null) && (pl1.Children.data_items != null))
{
for (int i = 0; i < pl1.Children.data_items.Length; i++)
{
var pch = pl1.Children.data_items[i];
if ((pch.Drawable1 != null) && (pch.Drawable1.AllModels.Length != 0))
{
//RenderDrawable(pch.Drawable1, arch, ent, -camera.Position, hash);
}
}
}
}
return true;
}
private bool RenderDrawable(DrawableBase drawable, Archetype arche, YmapEntityDef entity, Vector3 camrel, uint txdHash = 0)
{
@ -1189,7 +1197,6 @@ namespace CodeWalker.Forms
return RenderRenderable(rndbl, arche, entity, camrel);
}
private bool RenderRenderable(Renderable rndbl, Archetype arche, YmapEntityDef entity, Vector3 camrel)
{
//enqueue a single renderable for rendering.

View File

@ -323,6 +323,18 @@ namespace CodeWalker.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Grass {
get {
return ((bool)(this["Grass"]));
}
set {
this["Grass"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]

View File

@ -77,6 +77,9 @@
<Setting Name="ShadowCascades" Type="System.Int32" Scope="User">
<Value Profile="(Default)">6</Value>
</Setting>
<Setting Name="Grass" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ShowStatusBar" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>

View File

@ -6282,6 +6282,7 @@ namespace CodeWalker
HDRRenderingCheckBox.Checked = s.HDR;
ShadowsCheckBox.Checked = s.Shadows;
SkydomeCheckBox.Checked = s.Skydome;
GrassCheckBox.Checked = s.Grass;
TimedEntitiesCheckBox.Checked = s.ShowTimedEntities;
CollisionMeshesCheckBox.Checked = s.ShowCollisionMeshes;
CollisionMeshRangeTrackBar.Value = s.CollisionMeshRange;
@ -6315,6 +6316,7 @@ namespace CodeWalker
s.HDR = HDRRenderingCheckBox.Checked;
s.Shadows = ShadowsCheckBox.Checked;
s.Skydome = SkydomeCheckBox.Checked;
s.Grass = GrassCheckBox.Checked;
s.ShowTimedEntities = TimedEntitiesCheckBox.Checked;
s.ShowCollisionMeshes = CollisionMeshesCheckBox.Checked;
s.CollisionMeshRange = CollisionMeshRangeTrackBar.Value;