PerfomanceComponent(double elapsedMilliseconds, double fPS) : this() { Tag = ElementTag.New(); ElapsedMilliseconds = elapsedMilliseconds; IsValid = true; FPS = fPS; }
CollidedWithEntityByRayComponent(ElementTag with, Vector3 intersectionPositionWorld) : this() { Tag = ElementTag.New("CollidedWith"); With = with; IsValid = true; IntersectionPositionWorld = intersectionPositionWorld; }
public SpherePointComponent(Vector3 center, float radius) : this() { Center = center; Radius = radius; IsValid = true; Tag = ElementTag.New(); }
ColorComponent(Vector4 color, ColorTypes type) : this() { IsValid = true; Tag = ElementTag.New(); Color = color; Type = type; }
public GameObject DrawPolyline(string key, Vector3[] margin, Vector4 green) { var line = VisualPolylineObject.Create(Context, ElementTag.New($"{key}_polyline"), margin, green, true); return(line); }
static void _Create(IContextState context, IEnumerable <IFileGeometry3D> meshes, FileInfo texture, string name, LoadedVisualObject visual) { List <ElementTag> t = new List <ElementTag>(); var details = new LoadedObjectDetails(); var baseTag = ElementTag.New(); var index = 0; AxisAlignedBox fullBox = AxisAlignedBox.Zero; foreach (var geo in meshes) { var tag = Create(context, baseTag.WithPrefix(geo.Name ?? index.ToString()), new GeometryStructures <IFileGeometry3D>(geo), texture, out var box); t.Add(tag); fullBox = fullBox.Merge(box.Bounds); details.VertexCount += geo.Positions.Count; details.TriangleCount += (geo.Indices.Count / 3); index++; } visual.tags.AddRange(t); visual.Details = details; var size = fullBox.Size(); visual.worldX = VisualPolylineObject.Create(context, baseTag.WithPrefix("WorldX"), new[] { Vector3.Zero + Vector3.UnitX * size.X * -2f, Vector3.Zero + Vector3.UnitX * size.X * 2f }, V4Colors.Red, false); visual.worldX.IsVisible = false; visual.worldY = VisualPolylineObject.Create(context, baseTag.WithPrefix("WorldY"), new[] { Vector3.Zero + Vector3.UnitY * size.Y * -2f, Vector3.Zero + Vector3.UnitY * size.Y * 2f }, V4Colors.Green, false); visual.worldY.IsVisible = false; visual.worldZ = VisualPolylineObject.Create(context, baseTag.WithPrefix("WorldZ"), new[] { Vector3.Zero + Vector3.UnitZ * size.Z * -2f, Vector3.Zero + Vector3.UnitZ * size.Z * 2f }, V4Colors.Blue, false); visual.worldZ.IsVisible = false; }
public GameObject DrawCylinder(string key, CylinderDetails cyl) { var geo = GeometryBuilder.BuildCylinder(cyl.Start, cyl.Axis, cyl.Radius, cyl.Length); var en = EntityBuilders.BuildColored(Context, ElementTag.New(key), geo, cyl.Color, SharpDX.Direct3D11.CullMode.None); return(new SingleVisualObject(en.Tag, key)); }
public GameObject DrawPoint(string key, Vector3 center, Vector4 color) { return(VisualSphereObject.Create(Context, ElementTag.New($"{key}_Point"), new VisualSphereObject.Data { Center = center, Color = color, Radius = .1f })); }
public static RenderableComponent AsTriangleColoredList(CullMode mode) => new RenderableComponent(mode, PrimitiveTopology.TriangleList, RenderTechniques.TriangleColored) { Tag = ElementTag.New(), IsValid = true, HasBlendState = true, RasterizerStateDescription = D3DRasterizerStateDescriptions.Default(mode), BlendStateDescription = D3DBlendStateDescriptions.BlendStateEnabled, };
LightComponent(float intensity, int index, Vector3 position, Vector3 direction, LightTypes type) : this() { Tag = ElementTag.New(); IsValid = true; Intensity = intensity; Index = index; Position = position; Direction = direction; Type = type; }
public RenderableComponent SwitchCullModeTo(CullMode mode) { Tag = ElementTag.New(); IsRenderable = true; var rast = RasterizerStateDescription; rast.CullMode = mode; RasterizerStateDescription = rast; return(this); }
static RenderableComponent AsLineList(RasterizerStateDescription2 rast, RenderTechniques technique) => new RenderableComponent(CullMode.None, PrimitiveTopology.LineList, technique) { Tag = ElementTag.New(), IsValid = true, HasBlendState = true, RasterizerStateDescription = rast, DepthStencilStateDefinition = D3DDepthStencilDefinition.DepthEnabled, BlendStateDescription = D3DBlendStateDescriptions.BlendStateDisabled, };
CameraMovementComponent(CameraState state, MovementData movementData, MovementTypes movementType, int delta, float speedValue) : this() { Tag = ElementTag.New(); IsValid = true; State = state; MovementData = movementData; MovementType = movementType; Delta = delta; SpeedValue = speedValue; }
static RenderableComponent AsTriangleList(CullMode mode, D3DDepthStencilDefinition depth, RenderTechniques technique) => new RenderableComponent(mode, PrimitiveTopology.TriangleList, technique) { Tag = ElementTag.New(), IsValid = true, HasBlendState = true, DepthStencilStateDefinition = depth, RasterizerStateDescription = D3DRasterizerStateDescriptions.Default(mode), BlendStateDescription = D3DBlendStateDescriptions.BlendStateEnabled, };
public static GraphicEntity BuildColored(IContextState context, IReadOnlyCollection <Vector3> pos, IReadOnlyCollection <int> indexes, IReadOnlyCollection <Vector3> norm, Vector4 v4color, CullMode cullMode) { var mormals = norm ?? pos.ToList().CalculateNormals(indexes.ToList()).AsReadOnly(); return(BuildColored(context, ElementTag.New("TriangleColored"), new ImmutableGeometryData( pos, mormals, indexes), v4color, cullMode)); }
public static RenderableComponent AsTriangleColored(PrimitiveTopology topology) { var mode = CullMode.Front; return(new RenderableComponent(mode, topology, RenderTechniques.TriangleColored) { Tag = ElementTag.New(), IsValid = true, HasBlendState = true, DepthStencilStateDefinition = D3DDepthStencilDefinition.DepthEnabled, RasterizerStateDescription = D3DRasterizerStateDescriptions.Default(mode), BlendStateDescription = D3DBlendStateDescriptions.BlendStateEnabled, }); }
public MaterialColorComponent( Vector4 ambient, Vector4 diffuse, Vector4 specular, Vector4 reflection, float specularFactor, bool hasAlpha, bool isModified) : this() { Tag = ElementTag.New(); IsValid = true; IsModified = isModified; Ambient = ambient; Diffuse = diffuse; Specular = specular; Reflection = reflection; SpecularFactor = specularFactor; HasAlpha = hasAlpha; }
/// <summary> /// NOTE: the text inside image has gap need to move attachment point backford a little bit /// </summary> /// <param name="position"></param> /// <param name="text"></param> /// <param name="fontSize"></param> /// <param name="textColor"></param> /// <param name="mode"></param> /// <param name="point"></param> /// <returns></returns> public static BillboardTextComponent CreateUpdatable(Vector3 position, string text, double fontSize, Vector4 textColor, BillboardSizeModes mode, BillboardAttacmentPoints point) { return(new BillboardTextComponent { Tag = ElementTag.New("BILLTEX_"), AttacmentType = point, Type = BillboardTypes.Updatable, SizeMode = mode, Position = position, FontSize = fontSize, Text = text, TextColor = textColor, //OffsetToAttachmentPoint = 0.05f }); }
public void Draw(IContextState context, List <VisualPolylineObject> drawed) { if (IsLeaf()) { drawed.Add(VisualPolylineObject.CreateBox(context, ElementTag.New(), Bounds, V4Colors.Yellow)); } else { var nodes = Nodes.ToArray(); for (int i = 0; i < nodes.Length; i++) { nodes[i].Draw(context, drawed); } } foreach (var i in items.ToList()) { drawed.Add(VisualPolylineObject.CreateBox(context, ElementTag.New("DEBUG_BOX_"), i.Bound, V4Colors.Blue)); } }
public static RenderableComponent AsBackground() => new RenderableComponent(CullMode.None, PrimitiveTopology.TriangleStrip, RenderTechniques.Background) { Tag = ElementTag.New(), IsValid = true, DepthStencilStateDefinition = D3DDepthStencilDefinition.DepthDisabled, RasterizerStateDescription = new RasterizerStateDescription2() { CullMode = CullMode.None, FillMode = FillMode.Solid, IsMultisampleEnabled = false, IsFrontCounterClockwise = false, IsScissorEnabled = false, IsAntialiasedLineEnabled = false, DepthBias = 0, DepthBiasClamp = .0f, SlopeScaledDepthBias = .0f }, HasBlendState = true, BlendStateDescription = D3DBlendStateDescriptions.BlendStateEnabled, };
public GameObject DrawArrow(string key, ArrowDetails arrowData) { var llength = 10; var tt = new ArrowData { axis = arrowData.Axis, orthogonal = arrowData.Orthogonal, center = arrowData.Center + arrowData.Axis * (llength - 2), lenght = 2.1f, radius = .8f, color = arrowData.Color }; var points = new[] { arrowData.Center, arrowData.Center + arrowData.Axis * llength, }; var arrow = ArrowGameObject.Create(Context, ElementTag.New($"{key}_arrowhead"), tt); var line = VisualPolylineObject.Create(Context, ElementTag.New($"{key}_arrowline"), points, arrowData.Color, true); return(new MultiVisualObject(new[] { arrow.Tag, line.Tag }, key)); }
GeometryBoundsComponent(AxisAlignedBox bounds) : this() { Tag = ElementTag.New(); Bounds = bounds; IsValid = true; }
BlackAndWhiteRenderComponent(bool isValid) : this() { IsValid = isValid; Tag = ElementTag.New(); }
CaptureTargetUnderMouseComponent(Vector2 screenPosition) : this() { ScreenPosition = screenPosition; Tag = ElementTag.New(); IsValid = true; }
HittableComponent(uint priorityIndex) : this() { PriorityIndex = priorityIndex; IsValid = true; Tag = ElementTag.New(); }
public static FollowCameraDirectLightComponent Create() { return(new FollowCameraDirectLightComponent(ElementTag.New())); }
public GeometryPoolComponent(Guid index) : this() { Key = index; Tag = ElementTag.New(); IsValid = true; }
public WireframeGeometryComponent(bool isValid) : this() { IsValid = isValid; Tag = ElementTag.New(); }
FlatShadingGeometryComponent(bool isValid) : this() { Tag = ElementTag.New(); IsValid = isValid; }
public static ZoomToAllCompponent Create() => new ZoomToAllCompponent(ElementTag.New());