clean up, import lights from map

This commit is contained in:
2022-04-24 22:17:34 +03:00
parent a60c27b55a
commit cbb2d530cb
10 changed files with 69 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -70,13 +70,13 @@
"Transform": {
"Translation": {
"X": 0.0,
"Y": 751.0,
"Y": 716.0,
"Z": 0.0
}
},
"Control": "FlaxEngine.GUI.Label",
"Data": {
"Text": "eFPS: 120 uTime: 5.1785762\nuFPS: 120 uTime: 0.00833330024033785\nrFPS: 120 rTime: 0\npFPS: 30 pTime: 0",
"Text": "eFPS: 15 uTime: 297.4087306\nuFPS: 15 uTime: 0.00833330024033785\nrFPS: 15 rTime: 0\npFPS: 30 pTime: 0",
"TextColor": {
"R": 1.0,
"G": 1.0,
@@ -123,7 +123,7 @@
},
"Offsets": {
"Left": 0.0,
"Right": 231.0,
"Right": 224.0,
"Top": -97.0,
"Bottom": 64.0
},

View File

@@ -502,9 +502,8 @@ namespace Game
brushIndex = 0;
foreach (var geom in brushGeometries)
{
StaticModel childModel = Actor.AddChild<StaticModel>();
StaticModel childModel = worldSpawnActor.AddChild<StaticModel>();
childModel.Name = "Brush_" + brushIndex;
childModel.Parent = worldSpawnActor;
childModel.Model = geom.model;
childModel.Position = geom.offset;
@@ -682,6 +681,71 @@ namespace Game
sw.Stop();
Console.Print("Pass 2: model and collision: " + sw.Elapsed.TotalMilliseconds + "ms");
}
// Handle entities
{
sw.Restart();
int lightIndex = 0;
foreach (var lightEntity in root.entities.Where(x =>
x.properties.ContainsKey("classname") && x.properties["classname"] == "light"))
{
Vector3 ParseOrigin(string origin)
{
string[] points = origin.Split(new char[] { ' ' });
return new Vector3(float.Parse(points[0]), float.Parse(points[2]), float.Parse(points[1]));
}
Color ParseColor(string origin)
{
string[] points = origin.Split(new char[] { ' ' });
return new Color(float.Parse(points[0]), float.Parse(points[1]), float.Parse(points[2]));
}
//Console.Print("light");
PointLight light = worldSpawnActor.AddChild<PointLight>();
light.Name = "Light_" + lightIndex;
light.LocalPosition = ParseOrigin(lightEntity.properties["origin"]);
//"_color" "0.752941 0.752941 0"
//"light" "200"
if (lightEntity.properties.TryGetValue("_color", out string colorStr))
{
//light.Color = ParseColor(colorStr);
}
float lightamm = 200f;
if (lightEntity.properties.TryGetValue("light", out string lightStr))
{
lightamm = float.Parse(lightStr);
}
light.Brightness = lightamm / 128f;
light.Layer = 1;
light.Radius = 1000f * 0.5f;
light.UseInverseSquaredFalloff = false;
light.FallOffExponent = 8;
light.ShadowsDistance = 2000f * 1f;
if (true)
{
// match FTEQW dynamic only light values
}
//Console.Print("light pos: " + light.Position);
lightIndex++;
}
Console.Print("test: " + (new Vector2(1f,0f) == Vector2.Zero));
Console.Print("light parsing time: " + sw.Elapsed.TotalMilliseconds + "ms");
}
}
public override void OnDestroy()