public override void load(Variant conf, IShader mtrl = null, Action onFin = null) { this.m_billBoard = this.m_world.scene3d.createBillboard(); this.m_billBoard.asset = os.asset.getAsset <IAssetBitmap>(conf["file"]._str); this.m_billBoard.setHeight = (float)(conf.ContainsKey("height") ? conf["height"]._int : this.m_billBoard.asset.height); this.m_billBoard.setWidth = (float)(conf.ContainsKey("width") ? conf["width"]._int : this.m_billBoard.asset.width); base.rootObj.addChild(this.m_billBoard); this.m_billBoard.helper["$graphObj"] = this; BoundBox boxCollider = new BoundBox(new Vec3(float.Parse((this.m_billBoard.setWidth / 2f).ToString()), float.Parse((-this.m_billBoard.setHeight / 2f).ToString()), float.Parse("0.5")), new Vec3(float.Parse(this.m_billBoard.setWidth.ToString()), float.Parse(this.m_billBoard.setHeight.ToString()), float.Parse("1"))); this.m_billBoard.boxCollider = boxCollider; }
protected override void InitializeOther(GameObject itemGo) { base.InitializeOther(itemGo); _glowBillboard = itemGo.GetSingleInterfaceInChildren<IBillboard>(); var starLight = itemGo.GetComponentInChildren<Light>(); // UNCLEAR no runtime assessable option to set Baking = Realtime starLight.type = LightType.Point; starLight.range = References.GameManager.GameSettings.UniverseSize.Radius(); //References.DebugControls.UniverseSize.Radius(); starLight.intensity = 1F; //starLight.bounceIntensity = 1F; // bounce light shadowing not currently supported for point lights starLight.shadows = LightShadows.None; // point light shadows are expensive starLight.renderMode = LightRenderMode.Auto; starLight.cullingMask = StarLightCullingMask; starLight.enabled = true; _revolvers = itemGo.GetSafeInterfacesInChildren<IRevolver>(); //_revolvers.ForAll(r => r.IsActivated = false); // enabled = false in Awake //TODO Revolver settings }
public override void Apply(IBillboard billboard) { base.Apply(billboard); }
/// <summary> /// Cull Visitor for billboard /// </summary> /// <param name="billboard"></param> public override void Apply(IBillboard billboard) { var bb = billboard.GetBoundingBox(); if (IsCulled(bb, ModelMatrixStack.Peek())) { return; } IPipelineState pso = null; // Node specific state if (billboard.HasPipelineState) { pso = billboard.PipelineState; } // Shared State else if (PipelineStateStack.Count != 0) { pso = PipelineStateStack.Peek(); } // Fallback else { pso = PipelineState.Create(); } var eyeLocal = GetEyeLocal(); var modelView = GetModelViewMatrix(); foreach (var drawable in billboard.Drawables) { // TODO - need to modify is culled to handle billboard matrix offset //if (IsCulled(drawable.GetBoundingBox(), ModelMatrixStack.Peek())) continue; var billboardMatrix = billboard.ComputeMatrix(modelView, eyeLocal); var drawablePso = pso; if (drawable.HasPipelineState) { drawablePso = drawable.PipelineState; } // // This allocates / updates vbo/ibos // drawable.ConfigureDeviceBuffers(GraphicsDevice, ResourceFactory); var renderElementCache = new Dictionary <IRenderGroupState, RenderGroupElement>(); foreach (var pset in drawable.PrimitiveSets) { // TODO - need to modify is culled to handle billboard matrix offset //if (IsCulled(pset.GetBoundingBox(), ModelMatrixStack.Peek())) continue; // // Sort into appropriate render group // IRenderGroupState renderGroupState = null; if (drawablePso.BlendStateDescription.AttachmentStates.Contains(BlendAttachmentDescription.AlphaBlend)) { renderGroupState = TransparentRenderGroup.GetOrCreateState(drawablePso, pset.PrimitiveTopology, drawable.VertexLayout); } else { renderGroupState = OpaqueRenderGroup.GetOrCreateState(drawablePso, pset.PrimitiveTopology, drawable.VertexLayout); } if (false == renderElementCache.TryGetValue(renderGroupState, out var renderElement)) { renderElement = new RenderGroupElement() { ModelViewMatrix = billboardMatrix.PostMultiply(modelView), VertexBuffer = drawable.GetVertexBufferForDevice(GraphicsDevice), IndexBuffer = drawable.GetIndexBufferForDevice(GraphicsDevice), PrimitiveSets = new List <IPrimitiveSet>() }; renderGroupState.Elements.Add(renderElement); renderElementCache.Add(renderGroupState, renderElement); } renderElement.PrimitiveSets.Add(pset); } } }
/// <summary> /// Default Implementation for Billboard /// </summary> /// <param name="billboard"></param> public virtual void Apply(IBillboard billboard) { Apply((IGeode)billboard); }
public void RenderBillboard(IBillboard primitive, BillboardRenderParameter renderParam) { BillboardInfoList[Buffer].Add(new BillboardInfo() { Billboard = primitive, RenderParam = renderParam }); }
public override void Apply(IBillboard billboard) { // TODO IMPLEMENT FOR BILLBOARDS base.Apply(billboard); }