private BillboardVertex[] CreateBillboardVertexArray() { var billboardGeometry = geometryInternal as IBillboardText; // Gather all of the textInfo offsets. // These should be equal in number to the positions. billboardType = billboardGeometry.Type; billboardGeometry.DrawTexture(); var position = billboardGeometry.Positions; var vertexCount = billboardGeometry.Positions.Count; var array = ReuseVertexArrayBuffer && vertexArrayBuffer != null && vertexArrayBuffer.Length >= vertexCount ? vertexArrayBuffer : new BillboardVertex[vertexCount]; if (ReuseVertexArrayBuffer) { vertexArrayBuffer = array; } var allOffsets = billboardGeometry.TextureOffsets; for (var i = 0; i < vertexCount; i++) { var tc = billboardGeometry.TextureCoordinates[i]; array[i].Position = new Vector4(position[i], 1.0f); array[i].Color = billboardGeometry.Colors[i]; array[i].TexCoord = new Vector4(tc.X, tc.Y, allOffsets[i].X, allOffsets[i].Y); } return(array); }
public Response Insert(BillboardType data) { string message = "Failed"; bool result = false; Response res = new Response(); try { if (data.ID == Guid.Empty) { data.ID = Guid.NewGuid(); db.Add(data); db.SaveChanges(); message = "Save data success"; result = true; } res.ID = data.ID; res.Message = message; res.Result = result; return(res); } catch (Exception ex) { res.Message = ex.Message; res.Result = false; return(res); } }
/// <summary> /// Called when [create vertex buffer]. /// </summary> /// <param name="context">The context.</param> /// <param name="buffer">The buffer.</param> /// <param name="geometry">The geometry.</param> /// <param name="deviceResources">The device resources.</param> /// <param name="bufferIndex"></param> protected override void OnCreateVertexBuffer(DeviceContextProxy context, IElementsBufferProxy buffer, int bufferIndex, Geometry3D geometry, IDeviceResources deviceResources) { if (geometry is IBillboardText billboardGeometry) { billboardGeometry.DrawTexture(deviceResources); if (billboardGeometry.BillboardVertices != null && billboardGeometry.BillboardVertices.Count > 0) { Type = billboardGeometry.Type; buffer.UploadDataToBuffer(context, billboardGeometry.BillboardVertices, billboardGeometry.BillboardVertices.Count, 0, geometry.PreDefinedVertexCount); if (textureStream != billboardGeometry.Texture) { RemoveAndDispose(ref textureView); textureStream = billboardGeometry.Texture; if (textureStream != null) { textureView = Collect(deviceResources.MaterialTextureManager.Register(textureStream)); } } } else { RemoveAndDispose(ref textureView); textureStream = null; buffer.UploadDataToBuffer(context, emptyVerts, 0); } } }
void Awake() { active = this; for (int i = 0; i < billboardTypes.Count; i++) { BillboardType billboardType = billboardTypes[i]; BillboardRenderer billboardRenderer = new BillboardRenderer { billboardMaterial = Instantiate(billboardMaterial), n = 0, mesh = billboardType.prefab.GetComponent <MeshFilter>().sharedMesh, materials = billboardType.prefab.GetComponent <MeshRenderer>().sharedMaterials, lodDistance = billboardType.lodDistance, treeMode = billboardType.treeMode, castShadows = billboardType.castShadows, receiveShadows = billboardType.receiveShadows, resolution = billboardType.resolution, positions = new NativeArray <float3>(0, Allocator.Persistent), lightTransform = lightTransform }; billboardRenderer.Start(); billboardRenderers.Add(billboardRenderer); } }
public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); m_billboardType = (BillboardType)Enum.Parse(typeof(BillboardType), GetCurrentParam(ref nodeParams)); SetAdditonalTitleText(string.Format(Constants.SubTitleTypeFormatStr, m_billboardType)); m_rotationIndependent = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); }
public virtual void setBillboardType(BillboardType bbt) { OgrePINVOKE.BillboardSet_setBillboardType(swigCPtr, (int)bbt); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public void ReadFromString(ref uint index, ref string[] nodeParams) { m_isBillboard = Convert.ToBoolean(nodeParams[index++]); m_billboardType = (BillboardType)Enum.Parse(typeof(BillboardType), nodeParams[index++]); if (UIUtils.CurrentShaderVersion() > 11007) { m_rotationIndependent = Convert.ToBoolean(nodeParams[index++]); } }
public override void DrawProperties() { base.DrawProperties(); NodeUtils.DrawPropertyGroup(ref m_propertiesFoldout, Constants.ParameterLabelStr, () => { m_billboardType = ( BillboardType )EditorGUILayoutEnumPopup(BillboardOpHelper.BillboardTypeStr, m_billboardType); m_rotationIndependent = EditorGUILayoutToggle(BillboardOpHelper.BillboardRotIndStr, m_rotationIndependent); }); EditorGUILayout.HelpBox(WarningMessage, MessageType.Warning); }
public virtual BillboardType getBillboardType() { BillboardType ret = (BillboardType)OgrePINVOKE.BillboardSet_getBillboardType(swigCPtr); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public override void Draw(DrawInfo drawInfo) { base.Draw(drawInfo); EditorGUI.BeginChangeCheck(); m_billboardType = (BillboardType)m_upperLeftWidget.DrawWidget(this, m_billboardType); if (EditorGUI.EndChangeCheck()) { SetAdditonalTitleText(string.Format(Constants.SubTitleTypeFormatStr, m_billboardType)); } }
public BillboardNode( BillboardType type, int textureKey, Vector2 size) : base() { this.type = type; this.textureKey = textureKey; this.size = size; this.LocalBounds = new BoundingSphere( Vector3.Zero, (size.X > size.Y) ? size.X / 2 : size.Y / 2); }
public static string[] GetMultilineInstructions(BillboardType billboardType, bool rotationIndependent, string vertexPosValue, string vertexNormalValue) { // This method is only used on Surface ... no HD variation is needed List <string> body = new List <string>(); switch (billboardType) { case BillboardType.Cylindrical: { for (int i = 0; i < BillboardCylindricalInstructions.Length; i++) { body.Add(BillboardCylindricalInstructions[i]); } } break; case BillboardType.Spherical: { for (int i = 0; i < BillboardCylindricalInstructions.Length; i++) { body.Add(BillboardSphericalInstructions[i]); } } break; } for (int i = 0; i < BillboardCommonInstructions.Length; i++) { string value = (i == 3) ? string.Format(BillboardCommonInstructions[i], vertexNormalValue) : BillboardCommonInstructions[i]; body.Add(value); } if (rotationIndependent) { for (int i = 0; i < BillboardRotIndependent.Length; i++) { string value = (i != 5) ? string.Format(BillboardRotIndependent[i], vertexPosValue) : BillboardRotIndependent[i]; body.Add(value); } } else { for (int i = 0; i < BillboardRotDependent.Length; i++) { string value = (i > 1) ? string.Format(BillboardRotDependent[i], vertexPosValue) : BillboardRotDependent[i]; body.Add(value); } } return(body.ToArray()); }
public override void DrawProperties() { base.DrawProperties(); NodeUtils.DrawPropertyGroup(ref m_propertiesFoldout, Constants.ParameterLabelStr, () => { EditorGUI.BeginChangeCheck(); m_billboardType = ( BillboardType )EditorGUILayoutEnumPopup(BillboardOpHelper.BillboardTypeStr, m_billboardType); if (EditorGUI.EndChangeCheck()) { SetAdditonalTitleText(string.Format(Constants.SubTitleTypeFormatStr, m_billboardType)); } m_rotationIndependent = EditorGUILayoutToggle(BillboardOpHelper.BillboardRotIndStr, m_rotationIndependent); }); EditorGUILayout.HelpBox(WarningMessage, MessageType.Warning); }
public void Draw( ParentNode owner ) { bool visible = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedVertexOptions: bool enabled = m_isBillboard: NodeUtils.DrawPropertyGroup( owner, ref visible, ref m_isBillboard, BillboardTitleStr, () => { m_billboardType = (BillboardType)owner.EditorGUILayoutEnumPopup( BillboardTypeStr, m_billboardType ): m_rotationIndependent = owner.EditorGUILayoutToggle( BillboardRotIndStr, m_rotationIndependent ): } ): owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedVertexOptions = visible: if( m_isBillboard != enabled ) { UIUtils.RequestSave(): } }
public AddBillboardTypeOutputModel Save(AddBillboardTypeInputModel data) { BillboardType temp = new BillboardType(); temp.Kode = data.Kode; temp.Type = data.Type; BillboardTypeRepository repo = new BillboardTypeRepository(db); var res = repo.Insert(temp); AddBillboardTypeOutputModel output = new AddBillboardTypeOutputModel(); output.ID = res.ID; return(output); }
public void Draw() { bool visible = EditorVariablesManager.ExpandedVertexOptions.Value; bool enabled = m_isBillboard; NodeUtils.DrawPropertyGroup(ref visible, ref m_isBillboard, BillboardTitleStr, () => { m_billboardType = ( BillboardType )EditorGUILayout.EnumPopup(BillboardTypeStr, m_billboardType); }); EditorVariablesManager.ExpandedVertexOptions.Value = visible; if (m_isBillboard != enabled) { UIUtils.RequestSave(); } }
public void Draw(UndoParentNode owner) { bool visible = EditorVariablesManager.ExpandedVertexOptions.Value; bool enabled = m_isBillboard; NodeUtils.DrawPropertyGroup(owner, ref visible, ref m_isBillboard, BillboardTitleStr, () => { m_billboardType = ( BillboardType )owner.EditorGUILayoutEnumPopup(BillboardTypeStr, m_billboardType); m_rotationIndependent = owner.EditorGUILayoutToggle(BillboardRotIndStr, m_rotationIndependent); }); EditorVariablesManager.ExpandedVertexOptions.Value = visible; if (m_isBillboard != enabled) { UIUtils.RequestSave(); } }
public Response Update(BillboardType data) { string message = "Failed"; bool result = false; Response res = new Response(); try { if (data != null) { var find = db.BillboardType.Where(x => x.ID == data.ID).FirstOrDefault(); if (find != null) { find.Kode = data.Kode; find.Type = data.Type; find.LastUpdateDate = DateTime.Now; find.LastUpdateByUserID = data.LastUpdateByUserID; message = "Save data success"; result = true; } else { message = "Billboard type not found"; result = true; } } res.ID = data.ID; res.Message = message; res.Result = result; return(res); } catch (Exception ex) { res.Message = ex.Message; res.Result = false; return(res); } }
/// <summary> /// Called when [create vertex buffer]. /// </summary> /// <param name="context">The context.</param> /// <param name="buffer">The buffer.</param> /// <param name="geometry">The geometry.</param> /// <param name="deviceResources">The device resources.</param> /// <param name="bufferIndex"></param> protected override void OnCreateVertexBuffer(DeviceContextProxy context, IElementsBufferProxy buffer, int bufferIndex, Geometry3D geometry, IDeviceResources deviceResources) { var billboardGeometry = geometry as IBillboardText; billboardGeometry.DrawTexture(deviceResources); if (billboardGeometry != null && billboardGeometry.BillboardVertices != null && billboardGeometry.BillboardVertices.Count > 0) { Type = billboardGeometry.Type; var data = OnBuildVertexArray(billboardGeometry, deviceResources); buffer.UploadDataToBuffer(context, data, billboardGeometry.BillboardVertices.Count); RemoveAndDispose(ref textureView); if (billboardGeometry.Texture != null) { textureView = Collect(deviceResources.MaterialTextureManager.Register(billboardGeometry.Texture)); } } else { textureView = null; buffer.DisposeAndClear(); } }
//used to draw billboards that have a texture public BillboardPrimitiveObject(string id, ActorType actorType, Transform3D transform, Effect effect, IVertexData vertexData, Texture2D texture, Color color, float alpha, StatusType statusType, BillboardType billBoardType) : base(id, actorType, transform, effect, vertexData, texture, color, alpha, statusType) { this.billboardParameters = new BillboardParameters(); this.BillboardType = billBoardType; }
public string Get(object target) { BillboardType t = ((BillboardParticleRenderer)target).BillboardType; return(ScriptEnumAttribute.GetScriptAttribute((int)t, typeof(BillboardType))); }
public BillboardPrimitiveObject(string id, ActorType actorType, Transform3D transform, EffectParameters effectParameters, StatusType statusType, IVertexData vertexData, BillboardType billboardType) : base(id, actorType, transform, effectParameters, statusType, vertexData) { //create blank set of parameters and set type to be Normal - developer can change after instanciation - see Main::InitializeBillboards() this.billboardOrientationParameters = new BillboardOrientationParameters(); this.BillboardType = billboardType; }
public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); m_billboardType = ( BillboardType )Enum.Parse(typeof(BillboardType), GetCurrentParam(ref nodeParams)); m_rotationIndependent = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); }
public Billboard(BillboardType bt) { billboardTexture = billboardTextures[(int)bt]; }
//used to draw billboards that have a texture public BillboardPrimitiveObject(string id, ObjectType objectType, Transform3D transform, IVertexData vertexData, Effect effect, Color color, float alpha, Texture2D texture, BillboardType billBoardType) : base(id, objectType, transform, vertexData, effect, color, alpha, texture) { this.billBoardType = billBoardType; this.billboardParameters = new BillboardParameters(); if (billBoardType == BillboardType.Normal) { this.billboardParameters.Technique = "Normal"; this.billboardParameters.BillboardType = BillboardType.Normal; } else if (billBoardType == BillboardType.Cylindrical) { this.billboardParameters.Technique = "Cylindrical"; this.billboardParameters.BillboardType = BillboardType.Cylindrical; this.billboardParameters.Up = this.Transform3D.Up; } else { this.billboardParameters.Technique = "Spherical"; this.billboardParameters.BillboardType = BillboardType.Spherical; } }
// This should be called after the Vertex Offset and Vertex Normal ports are analised public static void FillDataCollector(ref MasterNodeDataCollector dataCollector, BillboardType billboardType, bool rotationIndependent, string vertexPosValue, string vertexNormalValue, bool vertexIsFloat3) { switch (billboardType) { case BillboardType.Cylindrical: { for (int i = 0; i < BillboardCylindricalInstructions.Length; i++) { dataCollector.AddVertexInstruction(BillboardCylindricalInstructions[i] + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } break; case BillboardType.Spherical: { for (int i = 0; i < BillboardCylindricalInstructions.Length; i++) { dataCollector.AddVertexInstruction(BillboardSphericalInstructions[i] + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } break; } for (int i = 0; i < BillboardCommonInstructions.Length; i++) { string value = (i == 3) ? string.Format(BillboardCommonInstructions[i], vertexNormalValue) : BillboardCommonInstructions[i]; dataCollector.AddVertexInstruction(value + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } if (rotationIndependent) { for (int i = 0; i < BillboardRotIndependent.Length; i++) { string value = string.Empty; if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD) { value = (i != 5) ? string.Format(BillboardHDRotIndependent[i], vertexPosValue) : BillboardHDRotIndependent[i]; } else { value = (i != 5) ? string.Format(BillboardRotIndependent[i], vertexPosValue) : BillboardRotIndependent[i]; } dataCollector.AddVertexInstruction(value + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } else { string vertexPosConverted = vertexIsFloat3 ? string.Format("float4({0},0)", vertexPosValue) : vertexPosValue; for (int i = 0; i < BillboardRotDependent.Length; i++) { string value = string.Empty; if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD) { value = (i > 1) ? string.Format(BillboardHDRotDependent[i], vertexPosValue, vertexPosConverted, (vertexIsFloat3 ? ".xyz" : string.Empty)) : BillboardHDRotDependent[i]; } else { value = (i > 1) ? string.Format(BillboardRotDependent[i], vertexPosValue, vertexPosConverted, (vertexIsFloat3 ? ".xyz" : string.Empty)) : BillboardRotDependent[i]; } dataCollector.AddVertexInstruction(value + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } }
// This should be called after the Vertex Offset and Vertex Normal ports are analised public static void FillDataCollector(ref MasterNodeDataCollector dataCollector, BillboardType billboardType, bool rotationIndependent, string vertexPosValue, string vertexNormalValue) { switch (billboardType) { case BillboardType.Cylindrical: { for (int i = 0; i < BillboardCylindricalInstructions.Length; i++) { dataCollector.AddVertexInstruction(BillboardCylindricalInstructions[i] + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } break; case BillboardType.Spherical: { for (int i = 0; i < BillboardCylindricalInstructions.Length; i++) { dataCollector.AddVertexInstruction(BillboardSphericalInstructions[i] + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } break; } for (int i = 0; i < BillboardCommonInstructions.Length; i++) { string value = (i == 3) ? string.Format(BillboardCommonInstructions[i], vertexNormalValue) : BillboardCommonInstructions[i]; dataCollector.AddVertexInstruction(value + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } if (rotationIndependent) { for (int i = 0; i < BillboardRotIndependent.Length; i++) { string value = (i != 5) ? string.Format(BillboardRotIndependent[i], vertexPosValue) : BillboardRotIndependent[i]; dataCollector.AddVertexInstruction(value + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } else { for (int i = 0; i < BillboardRotDependent.Length; i++) { string value = (i > 1) ? string.Format(BillboardRotDependent[i], vertexPosValue) : BillboardRotDependent[i]; dataCollector.AddVertexInstruction(value + (dataCollector.IsTemplate ? ";" : string.Empty), -1, true); } } }
public void ReadFromString(ref uint index, ref string[] nodeParams) { m_isBillboard = Convert.ToBoolean(nodeParams[index++]); m_billboardType = ( BillboardType )Enum.Parse(typeof(BillboardType), nodeParams[index++]); }
// Constructors public BillboardNode() : base() { this.type = BillboardType.Decorative; this.textureKey = -1; }
public void SetBillboarding(BillboardType billboard) => EngineApplicationInterface.IMetaMesh.SetBillboarding(this.Pointer, billboard);