本文整理汇总了C#中Renderer.AddCamera方法的典型用法代码示例。如果您正苦于以下问题:C# Renderer.AddCamera方法的具体用法?C# Renderer.AddCamera怎么用?C# Renderer.AddCamera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderer
的用法示例。
在下文中一共展示了Renderer.AddCamera方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadEntities
//.........这里部分代码省略.........
LoadEntities(lump2, renderer, path, package);
}
foreach (var entity in entityLump.Datas)
{
var scale = string.Empty;
var position = string.Empty;
var angles = string.Empty;
var model = string.Empty;
var skin = string.Empty;
var colour = new byte[0];
var classname = string.Empty;
var name = string.Empty;
foreach (var property in entity)
{
//metadata
switch (property.Item2)
{
case 3368008710: //World Model
model = property.Item3 as string;
break;
case 3827302934: //Position
position = property.Item3 as string;
break;
case 3130579663: //Angles
angles = property.Item3 as string;
break;
case 432137260: //Scale
scale = property.Item3 as string;
break;
case 2020856412: //Skin
skin = property.Item3 as string;
break;
case 588463423: //Colour
colour = property.Item3 as byte[];
break;
case 3323665506: //Classname
classname = property.Item3 as string;
break;
case 1094168427:
name = property.Item3 as string;
break;
}
}
if (scale == string.Empty || position == string.Empty || angles == string.Empty)
{
continue;
}
if (classname == "point_camera" || classname == "vr_teleport_marker" || model != string.Empty)
{
var scaleMatrix = Matrix4.CreateScale(ParseCoordinates(scale));
var positionMatrix = Matrix4.CreateTranslation(ParseCoordinates(position));
var rotationVector = ParseCoordinates(angles);
var rotationMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(rotationVector.Z));
rotationMatrix *= Matrix4.CreateRotationY(MathHelper.DegreesToRadians(rotationVector.X));
rotationMatrix *= Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(rotationVector.Y));
var megaMatrix = scaleMatrix * rotationMatrix * positionMatrix;
var objColor = Vector4.One;
// Parse colour if present
if (colour.Length == 4)
{
for (var i = 0; i < 4; i++)
{
objColor[i] = colour[i] / 255.0f;
}
}
//This model is hardcoded into the FGD
if (classname == "vr_teleport_marker")
{
model = "models/effects/teleport/teleport_marker.vmdl";
}
if (classname == "point_camera")
{
renderer.AddCamera(name == string.Empty ? $"Camera {anonymousCameraCount++}" : name, megaMatrix);
}
else
{
var newEntity = FileExtensions.LoadFileByAnyMeansNecessary(model + "_c", path, package);
if (newEntity == null)
{
Console.WriteLine("unable to load entity " + model + "_c");
continue;
}
var entityModel = new Model(newEntity);
entityModel.LoadMeshes(renderer, path, megaMatrix, objColor, package, skin);
}
}
}
}