public override void UpdateGpuProgramsParams(IRenderable rend, Pass pass, AutoParamDataSource source, Core.Collections.LightList lightList) { if (this.isTableDataUpdated == false) { this.isTableDataUpdated = true; for (int j = 0; j < TextureAtlasSampler.MaxTextures; j++) { if (this.isAtlasTextureUnits[j] == true) { //Update the information of the size of the atlas textures //TODO: Replace -1, -1 with actual dimensions var texSizeInt = new Math.Tuple <int, int>(-1, -1); // = pass.GetTextureUnitState(j).Dimensions; var texSize = new Vector2(texSizeInt.First, texSizeInt.Second); this.psTextureSizes[j].SetGpuParameter(texSize); //Update the information of which texture exists where in the atlas GpuProgramParameters vsGpuParams = pass.VertexProgramParameters; var buffer = new List <float>(this.atlasTableDatas[j].Count * 4); for (int i = 0; i < this.atlasTableDatas[j].Count; i++) { buffer[i * 4] = this.atlasTableDatas[j][i].posU; buffer[i * 4 + 1] = this.atlasTableDatas[j][i].posV; buffer[i * 4 + 2] = (float)Axiom.Math.Utility.Log2((int)this.atlasTableDatas[j][i].width * (int)texSize.x); buffer[i * 4 + 3] = (float)Axiom.Math.Utility.Log2((int)this.atlasTableDatas[j][i].height * (int)texSize.y); } vsGpuParams.SetNamedConstant(this.vsTextureTable[j].Name, buffer.ToArray(), this.atlasTableDatas[j].Count); } } } }
/// <summary> /// Update the GPU programs constant parameters before a renderable is rendered. /// </summary> /// <param name="rend"> The renderable object that is going to be rendered </param> /// <param name="pass"> the pass that is used to do the rendering operation </param> /// <param name="source"> The auto parameter auto source instance </param> /// <param name="lightList"> The light list used for the current rendering operation </param> public void UpdateGpuProgramsParams(IRenderable rend, Pass pass, AutoParamDataSource source, LightList lightList) { for (int i = 0; i < SubRenderStateList.Count; i++) { var curSubRenderState = SubRenderStateList[i]; curSubRenderState.UpdateGpuProgramsParams(rend, pass, source, lightList); } }
UpdateGpuProgramsParams(IRenderable rend, Pass pass, AutoParamDataSource source, Core.Collections.LightList lightList) { if (this.reflectionPowerChanged) { GpuProgramParameters fsParams = pass.FragmentProgramParameters; this.reflectionPower.SetGpuParameter(this.reflectionPowerValue); this.reflectionPowerChanged = false; } }
public override void UpdateGpuProgramsParams(IRenderable rend, Pass pass, AutoParamDataSource source, Core.Collections.LightList lightList) { if (this.fogMode == FogMode.None) { return; } FogMode fMode; ColorEx newFogColor; Real newFogStart, newFogEnd, newFogDensity; if (this.passOverrideParams) { fMode = pass.FogMode; newFogColor = pass.FogColor; newFogStart = pass.FogStart; newFogEnd = pass.FogEnd; newFogDensity = pass.FogDensity; } else { var sceneMgr = ShaderGenerator.Instance.ActiveSceneManager; fMode = sceneMgr.FogMode; newFogColor = sceneMgr.FogColor; newFogStart = sceneMgr.FogStart; newFogEnd = sceneMgr.FogEnd; newFogDensity = sceneMgr.FogDensity; } SetFogProperties(fMode, newFogColor, newFogStart, newFogEnd, newFogDensity); //Per pixel fog if (this.calcMode == CalcMode.PerPixel) { this.fogParams.SetGpuParameter(this.fogParamsValue); } //per vertex fog else { this.fogParams.SetGpuParameter(this.fogParamsValue); } this.fogColor.SetGpuParameter(this.fogColorValue); }