public override void Release() { if (variableNodes != null) { for (int i = 0; i < variableNodes.Count; i++) { variableNodes[i].Release(); } variableNodes.Clear(); LightList <VariableDefinitionNode> .Release(ref variableNodes); } if (optionNodes != null) { for (int i = 0; i < optionNodes.Count; i++) { optionNodes[i].Release(); } optionNodes.Clear(); LightList <AnimationOptionNode> .Release(ref optionNodes); } if (keyframeNodes != null) { for (int i = 0; i < keyframeNodes.Count; i++) { keyframeNodes[i].Release(); } keyframeNodes.Clear(); LightList <KeyFrameNode> .Release(ref keyframeNodes); } StyleASTNodeFactory.s_AnimationRootNodePool.Release(this); }
public void Tick() { Initialize(); if (m_ActiveTransitions.Count == 0) { return; } for (int i = 0; i < m_ActiveTransitions.Count; i++) { RouteTransitionState state = m_ActiveTransitions[i].fn(tickElapsed); if (state == RouteTransitionState.Cancelled) { // reset transition state m_ActiveTransitions.Clear(); return; } if (state == RouteTransitionState.Completed) { m_ActiveTransitions.RemoveAt(i--); } } if (m_ActiveTransitions.Count == 0) { EnterRoute(default);
public virtual void OnUpdate() { m_KeyboardState = keyboardInputManager.UpdateKeyboardInputState(); ProcessKeyboardEvents(); ProcessMouseInput(); LightList <UIElement> bindingUpdateList = BuildBindingUpdateList(m_ElementsThisFrame.Count > 0 ? m_ElementsThisFrame[0] : null); RunBindings(bindingUpdateList); if (!IsDragging) { ProcessMouseEvents(); } else { RunMouseEvents(m_ExitedElements, InputEventType.MouseExit); } ProcessDragEvents(); RunWriteBindingsAndReleaseList(bindingUpdateList); List <UIElement> temp = m_ElementsLastFrame; m_ElementsLastFrame = m_ElementsThisFrame; m_ElementsThisFrame = temp; for (int i = 0; i < m_ElementsLastFrame.Count; i++) { if (m_ElementsLastFrame[i].isDisabled || m_ElementsLastFrame[i].isDestroyed) { m_ElementsLastFrame.RemoveAt(i--); } } m_ElementsThisFrame.Clear(); m_EnteredElements.Clear(); m_ExitedElements.Clear(); if (IsMouseLeftUpThisFrame) { m_MouseDownElements.Clear(); } }
public void Destroy() { for (int i = 0; i < dynamicPool.Count; i++) { Object.Destroy(dynamicPool[i].mesh); } dynamicPool.Clear(); }
public override void Release() { for (int index = 0; index < children.Count; index++) { children[index].Release(); } children.Clear(); }
private void ResetSharedStyles(LightList <UIStyleGroupContainer> updatedStyles) { int count = updatedStyles.Count; UIStyleGroupContainer[] updatedStyleArray = updatedStyles.array; for (int i = 0; i < styleGroupContainers.size; i++) { if (!updatedStyles.Contains(styleGroupContainers.array[i])) { for (int j = 0; j < styleGroupContainers.array[i].groups.Length; j++) { RunCommands(styleGroupContainers.array[i].groups[j].normal.runCommands, false); } } } availableStyles.Clear(); styleGroupContainers.Clear(); isInheritedMap = 0; propertyMap.Clear(); styleGroupContainers.EnsureCapacity(updatedStyles.size); containedStates = 0; hasAttributeStyles = false; LightList <StylePropertyId> toUpdate = LightList <StylePropertyId> .Get(); if (instanceStyle != null) { CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.normal, StyleType.Instance, StyleState.Normal, 0); CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.hover, StyleType.Instance, StyleState.Hover, 0); CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.focused, StyleType.Instance, StyleState.Focused, 0); CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.active, StyleType.Instance, StyleState.Active, 0); } for (int i = 0; i < count; i++) { CreateStyleGroups(updatedStyleArray[i], toUpdate); styleGroupContainers.array[i] = updatedStyleArray[i]; } styleGroupContainers.size = count; SortStyles(); UpdatePropertyMap(toUpdate); LightList <StylePropertyId> .Release(ref toUpdate); }
public VertigoMaterial GetInstance(string materialName, string keyword0 = null, string keyword1 = null, string keyword2 = null, string keyword3 = null) { if (keyword0 != null) { s_Keywords.Add(keyword0); } if (keyword1 != null) { s_Keywords.Add(keyword1); } if (keyword2 != null) { s_Keywords.Add(keyword2); } if (keyword3 != null) { s_Keywords.Add(keyword3); } VertigoMaterial retn = GetInstance(materialName, s_Keywords); s_Keywords.Clear(); return(retn); }
/// <summary> /// Populate a light list with an ordered set of the lights which are closest /// </summary> /// <remarks> /// <p> /// Note that since directional lights have no position, they are always considered /// closer than any point lights and as such will always take precedence. /// </p> /// <p> /// Subclasses of the default SceneManager may wish to take into account other issues /// such as possible visibility of the light if that information is included in their /// data structures. This basic scenemanager simply orders by distance, eliminating /// those lights which are out of range. /// </p> /// <p> /// The number of items in the list max exceed the maximum number of lights supported /// by the renderer, but the extraneous ones will never be used. In fact the limit will /// be imposed by Pass::getMaxSimultaneousLights. /// </p> /// </remarks> /// <param name="position">The position at which to evaluate the list of lights</param> /// <param name="radius">The bounding radius to test</param> /// <param name="destList">List to be populated with ordered set of lights; will be cleared by this method before population.</param> public virtual void PopulateLightList( Vector3 position, float radius, LightList destList ) { // Really basic trawl of the lights, then sort // Subclasses could do something smarter destList.Clear(); float squaredRadius = radius * radius; MovableObjectCollection lightList = this.GetMovableObjectCollection( LightFactory.TypeName ); // loop through the scene lights an add ones in range foreach ( Light light in lightList.Values ) { if ( light.IsVisible ) { if ( light.Type == LightType.Directional ) { // no distance light.tempSquaredDist = 0.0f; destList.Add( light ); } else { light.tempSquaredDist = ( light.DerivedPosition - position ).LengthSquared; light.tempSquaredDist -= squaredRadius; // only add in-range lights float range = light.AttenuationRange; if ( light.tempSquaredDist <= ( range * range ) ) { destList.Add( light ); } } } // if } // for // Sort Destination light list. // TODO: Not needed yet since the current LightList is a sorted list under the hood already //destList.Sort(); }
/// <summary> /// Render a group with the added complexity of additive texture shadows. /// </summary> /// <param name="group">Render queue group.</param> private void RenderAdditiveTextureShadowedQueueGroupObjects( RenderQueueGroup group ) { LightList tempLightList = new LightList(); foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values ) { // Sort the queue first priorityGroup.Sort( this.cameraInProgress ); // Clear light list tempLightList.Clear(); // Render all the ambient passes first, no light iteration, no lights this.RenderSolidObjects( priorityGroup.solidPasses, false, tempLightList ); // Also render any objects which have receive shadows disabled this.renderingNoShadowQueue = true; this.RenderSolidObjects( priorityGroup.solidPassesNoShadow, true ); this.renderingNoShadowQueue = false; // only perform this next part if we're in the 'normal' render stage, to avoid // doing it during the render to texture if ( this.illuminationStage == IlluminationRenderStage.None ) { // Iterate over lights, render masked int sti = 0; foreach ( Light light in this.lightsAffectingFrustum ) { // Set light state if ( light.CastShadows && sti < this.shadowTextures.Count ) { Texture shadowTex = this.shadowTextures[ sti ]; // Get camera for current shadow texture Camera camera = shadowTex.GetBuffer().GetRenderTarget().GetViewport( 0 ).Camera; // Hook up receiver texture Pass targetPass = this.shadowTextureCustomReceiverPass != null ? this.shadowTextureCustomReceiverPass : this.shadowReceiverPass; targetPass.GetTextureUnitState( 0 ).SetTextureName( shadowTex.Name ); // Hook up projection frustum targetPass.GetTextureUnitState( 0 ).SetProjectiveTexturing( true, camera ); this.autoParamDataSource.TextureProjector = camera; // Remove any spot fader layer if ( targetPass.TextureUnitStageCount > 1 && targetPass.GetTextureUnitState( 1 ).TextureName == "spot_shadow_fade.png" ) { // remove spot fader layer (should only be there if // we previously used modulative shadows) targetPass.RemoveTextureUnitState( 1 ); } // Set lighting / blending modes targetPass.SetSceneBlending( SceneBlendFactor.One, SceneBlendFactor.One ); targetPass.LightingEnabled = true; targetPass.Load(); // increment shadow texture since used ++sti; this.illuminationStage = IlluminationRenderStage.RenderReceiverPass; } else { this.illuminationStage = IlluminationRenderStage.None; } // render lighting passes for this light tempLightList.Clear(); tempLightList.Add( light ); this.RenderSolidObjects( priorityGroup.solidPassesDiffuseSpecular, false, tempLightList ); } // for each light this.illuminationStage = IlluminationRenderStage.None; // Now render decal passes, no need to set lights as lighting will be disabled this.RenderSolidObjects( priorityGroup.solidPassesDecal, false ); } } // for each priority foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values ) { // Do transparents this.RenderTransparentObjects( priorityGroup.transparentPasses, true ); } // for each priority }
/// <summary> /// Render a group with the added complexity of additive stencil shadows. /// </summary> /// <param name="group">Render queue group.</param> protected virtual void RenderAdditiveStencilShadowedQueueGroupObjects( RenderQueueGroup group ) { LightList tempLightList = new LightList(); foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values ) { // sort the group first priorityGroup.Sort( this.cameraInProgress ); // Clear light list tempLightList.Clear(); // Render all the ambient passes first, no light iteration, no lights this.illuminationStage = IlluminationRenderStage.Ambient; this.RenderSolidObjects( priorityGroup.solidPasses, false, tempLightList ); // Also render any objects which have receive shadows disabled this.renderingNoShadowQueue = true; this.RenderSolidObjects( priorityGroup.solidPassesNoShadow, true ); this.renderingNoShadowQueue = false; // Now iterate per light this.illuminationStage = IlluminationRenderStage.PerLight; foreach ( Light light in lightsAffectingFrustum ) { // Set light state if ( light.CastShadows ) { // Clear stencil this.targetRenderSystem.ClearFrameBuffer( FrameBufferType.Stencil ); this.RenderShadowVolumesToStencil( light, this.cameraInProgress ); // turn stencil check on this.targetRenderSystem.StencilCheckEnabled = true; // NB we render where the stencil is equal to zero to render lit areas this.targetRenderSystem.SetStencilBufferParams( CompareFunction.Equal, 0 ); } // render lighting passes for this light tempLightList.Clear(); tempLightList.Add( light ); this.RenderSolidObjects( priorityGroup.solidPassesDiffuseSpecular, false, tempLightList ); // Reset stencil params this.targetRenderSystem.SetStencilBufferParams(); this.targetRenderSystem.StencilCheckEnabled = false; this.targetRenderSystem.SetDepthBufferParams(); } // for each light // Now render decal passes, no need to set lights as lighting will be disabled this.illuminationStage = IlluminationRenderStage.Decal; this.RenderSolidObjects( priorityGroup.solidPassesDecal, false ); } // for each priority // reset lighting stage this.illuminationStage = IlluminationRenderStage.None; // Iterate again foreach ( RenderPriorityGroup priorityGroup in group.PriorityGroups.Values ) { // Do transparents this.RenderTransparentObjects( priorityGroup.transparentPasses, true ); } // for each priority }
public void OnReset() { m_Routers.Clear(); }
public void Release() { importedStyleConstants.Clear(); constantsWithReferences.Clear(); constants.Clear(); }
public void Clear() { store.Clear(); }
/// <summary> /// Overriden from SceneManager. /// </summary> /// <param name="position">The position at which to evaluate the list of lights</param> /// <param name="radius">The bounding radius to test</param> /// <param name="destList">List to be populated with ordered set of lights; will be cleared by this method before population.</param> protected override void PopulateLightList(Vector3 position, float radius, LightList destList) { BspNode positionNode = level.FindLeaf(position); BspNode[] lightNodes = new BspNode[lightList.Count]; for (int i = 0; i < lightList.Count; i++) { Light light = lightList[i]; lightNodes[i] = (BspNode) level.objectToNodeMap.FindFirst(light); } // Trawl of the lights that are visible from position, then sort destList.Clear(); float squaredRadius = radius * radius; // loop through the scene lights an add ones in range and visible from positionNode for(int i = 0; i < lightList.Count; i++) { TextureLight light = (TextureLight) lightList[i]; if(light.IsVisible && level.IsLeafVisible(positionNode, lightNodes[i])) { if(light.Type == LightType.Directional) { // no distance light.TempSquaredDist = 0.0f; destList.Add(light); } else { light.TempSquaredDist = (light.DerivedPosition - position).LengthSquared; light.TempSquaredDist -= squaredRadius; // only add in-range lights float range = light.AttenuationRange; if(light.TempSquaredDist <= (range * range)) { destList.Add(light); } } } // if } // for // Sort Destination light list. // TODO: Not needed yet since the current LightList is a sorted list under the hood already //destList.Sort(); }