public ChannelInputsGroup(ChannelInputsGroup group) { ParentInputs = new ChannelInputs(group.ParentInputs); ChildInputs = group.ChildInputs .Select(inputs => new ChannelInputs(inputs)) .ToArray(); }
public ChannelOutputsGroup Evaluate(ChannelInputsGroup inputsGroup) { var parentOutputs = Parent.Evaluate(null, inputsGroup.ParentInputs); var childOutputs = Enumerable.Zip(children, inputsGroup.ChildInputs, (child, childInputs) => child.Evaluate(parentOutputs, childInputs)) .ToArray(); return(new ChannelOutputsGroup(parentOutputs, childOutputs)); }
private void DumpSimpleOcclusion(DirectoryInfo shapeDirectory, ChannelInputs shapeInputs, float[] faceTransparencies) { FileInfo occlusionInfosFile = shapeDirectory.File("occlusion-infos.array"); FileInfo parentOcclusionInfosFile = shapeDirectory.File("parent-occlusion-infos.array"); if (occlusionInfosFile.Exists) { return; } Console.WriteLine("Calculating occlusion..."); if (faceTransparencies == null) { faceTransparencies = FaceTransparencies.For(figure); } FigureGroup figureGroup; FaceTransparenciesGroup faceTransparenciesGroup; if (figure == parentFigure) { figureGroup = new FigureGroup(figure); faceTransparenciesGroup = new FaceTransparenciesGroup(faceTransparencies); } else { var parentFaceTransparencies = FaceTransparencies.For(parentFigure); figureGroup = new FigureGroup(parentFigure, figure); faceTransparenciesGroup = new FaceTransparenciesGroup(parentFaceTransparencies, faceTransparencies); } var inputs = new ChannelInputsGroup(parentFigure.MakeDefaultChannelInputs(), new ChannelInputs[] { shapeInputs }); var outputs = figureGroup.Evaluate(inputs); FigureOcclusionCalculator.Result occlusionResult; using (var occlusionCalculator = new FigureOcclusionCalculator(fileLocator, device, shaderCache, figureGroup, faceTransparenciesGroup)) { occlusionResult = occlusionCalculator.CalculateOcclusionInformation(outputs); } shapeDirectory.Create(); if (figure == parentFigure) { occlusionInfosFile.WriteArray(OcclusionInfo.PackArray(occlusionResult.ParentOcclusion)); } else { occlusionInfosFile.WriteArray(OcclusionInfo.PackArray(occlusionResult.ChildOcclusions[0])); parentOcclusionInfosFile.WriteArray(OcclusionInfo.PackArray(occlusionResult.ParentOcclusion)); } }