public static AnimationModel Load(FigureDefinition figureDefinition, string startingAnimationName) { List <Animation> animations = new List <Animation>(); Animation activeAnimation = null; Animation noneAnimation = Animation.MakeNone(figureDefinition.BoneSystem); animations.Add(noneAnimation); activeAnimation = noneAnimation; IArchiveDirectory animationDir = figureDefinition.Directory.Subdirectory("animations"); if (animationDir != null) { foreach (IArchiveFile animationFile in animationDir.GetFiles()) { Animation animation = Animation.Load(animationFile); animations.Add(animation); if (animation.Label == startingAnimationName) { activeAnimation = animation; } } } return(new AnimationModel(animations, activeAnimation)); }
public CharactersMenuLevel(FigureDefinition definition, FigureModel model) { var materialSetDict = definition.MaterialSetOptions.ToDictionary(item => item.Label, item => item); var shapesMenuLevel = new ShapesMenuLevel(definition, model); var materialsMenuLevel = new MaterialsMenuLevel(definition, model); var advancedMenuLevel = new StaticMenuLevel( new SubLevelMenuItem("Shape", shapesMenuLevel), new SubLevelMenuItem("Skin", materialsMenuLevel) ); var detailsMenuLevel = new MaterialSetVariantsMenuLevel(definition, model); items = new List <IMenuItem> { }; items.Add(new SubLevelMenuItem("Mix & Match", advancedMenuLevel)); items.Add(new SubLevelMenuItem("Character Details", detailsMenuLevel)); foreach (var shape in definition.ShapeOptions) { if (materialSetDict.TryGetValue(shape.Label, out var materialSet)) { items.Add(new CharacterMenuItem(model, shape, materialSet)); } } }
public static ActorModel Load(FigureDefinition definition, string initialAnimationName) { AnimationModel animationModel = AnimationModel.Load(definition, initialAnimationName); BehaviorModel behaviorModel = new BehaviorModel(); return(new ActorModel(definition, animationModel, behaviorModel)); }
public static FigureDefinition Load(IArchiveDirectory dataDir, string name, FigureDefinition parent) { IArchiveDirectory figureDir = dataDir.Subdirectory("figures").Subdirectory(name); var channelSystemRecipe = Persistance.Load <ChannelSystemRecipe>(figureDir.File("channel-system-recipe.dat")); var channelSystem = channelSystemRecipe.Bake(parent?.ChannelSystem); BoneSystem boneSystem; RigidTransform[] childToParentBindPoseTransforms; if (parent != null) { boneSystem = parent.BoneSystem; childToParentBindPoseTransforms = Persistance.Load <RigidTransform[]>(figureDir.File("child-to-parent-bind-pose-transforms.dat")); } else { var boneSystemRecipe = Persistance.Load <BoneSystemRecipe>(figureDir.File("bone-system-recipe.dat")); boneSystem = boneSystemRecipe.Bake(channelSystem.ChannelsByName); childToParentBindPoseTransforms = null; } var shapeOptions = Shape.LoadAllForFigure(figureDir, channelSystem); var materialSetOptions = MaterialSetOption.LoadAllForFigure(figureDir); return(new FigureDefinition(name, figureDir, channelSystem, boneSystem, childToParentBindPoseTransforms, shapeOptions, materialSetOptions)); }
public GpuShaper(Device device, ShaderCache shaderCache, FigureDefinition definition, ShaperParameters parameters) { this.device = device; this.withDeltasShader = shaderCache.GetComputeShader <GpuShaper>("figure/shaping/shader/Shaper-WithDeltas"); this.withoutDeltasShader = shaderCache.GetComputeShader <GpuShaper>("figure/shaping/shader/Shaper-WithoutDeltas"); this.vertexCount = parameters.InitialPositions.Length; this.morphChannelIndices = parameters.MorphChannelIndices; this.boneIndices = parameters.BoneIndices; this.occlusionSurrogates = OcclusionSurrogate.MakeAll(definition, parameters.OcclusionSurrogateParameters); this.initialPositionsView = BufferUtilities.ToStructuredBufferView(device, parameters.InitialPositions); this.deltaSegmentsView = BufferUtilities.ToStructuredBufferView(device, parameters.MorphDeltas.Segments); this.deltaElemsView = BufferUtilities.ToStructuredBufferView(device, parameters.MorphDeltas.Elems); this.morphWeightsBufferManager = new StructuredBufferManager <float>(device, parameters.MorphCount); if (parameters.BaseDeltaWeights != null) { this.baseDeltaWeightSegmentsView = BufferUtilities.ToStructuredBufferView(device, parameters.BaseDeltaWeights.Segments); this.baseDeltaWeightElemsView = BufferUtilities.ToStructuredBufferView(device, parameters.BaseDeltaWeights.Elems); } else { this.baseDeltaWeightSegmentsView = null; this.baseDeltaWeightElemsView = null; } this.boneWeightSegmentsView = BufferUtilities.ToStructuredBufferView(device, parameters.BoneWeights.Segments); this.boneWeightElemsView = BufferUtilities.ToStructuredBufferView(device, parameters.BoneWeights.Elems); this.boneTransformsBufferManager = new StructuredBufferManager <StagedSkinningTransform>(device, parameters.BoneCount); this.occlusionSurrogateMapView = BufferUtilities.ToStructuredBufferView(device, parameters.OcclusionSurrogateMap); this.occlusionSurrogateFacesView = BufferUtilities.ToStructuredBufferView(device, OcclusionSurrogateCommon.Mesh.Faces.ToArray()); this.occlusionSurrogateInfosBufferManager = new StructuredBufferManager <OcclusionSurrogate.Info>(device, parameters.OcclusionSurrogateParameters.Length); }
public OccluderLoader(Device device, ShaderCache shaderCache, FigureDefinition figureDefinition) { this.device = device; this.shaderCache = shaderCache; channelSystem = figureDefinition.ChannelSystem; unmorphedOcclusionDirectory = figureDefinition.Directory.Subdirectory("occlusion"); }
public FigureFacade(Device device, ShaderCache shaderCache, FigureDefinition definition, FigureModel model, ControlVertexProvider controlVertexProvider, FigureRendererLoader figureRendererLoader) { this.definition = definition; this.model = model; this.controlVertexProvider = controlVertexProvider; this.figureRendererLoader = figureRendererLoader; }
public void AddFigure() { var figure = new FigureDefinition(); mSettings.Geometry_Figures.Add(figure); Instantiate(mFigurePrefab, mTree).GetComponent <Figure>().Init(figure); Instantiate(mUIFigurePrefab, mUITree).GetComponent <UIFigure>().Init(figure); }
public void Init(FigureDefinition figureDefinition) { mFigureDefinition = figureDefinition; mFigureDefinition.PropertyChanged += OnValueChanged; mFigureDefinition.DoneAction += OnDoneAction; mText.text = mFigureDefinition.Type.GetDescription(); mToggle.isOn = mFigureDefinition.Enabled; }
public FigureFacade(Device device, ShaderCache shaderCache, FigureDefinition definition, FigureModel model, ControlVertexProvider controlVertexProvider, FigureRendererLoader figureRendererLoader) { this.definition = definition; this.model = model; this.controlVertexProvider = controlVertexProvider; this.figureRendererLoader = figureRendererLoader; model.MaterialSetChanged += Model_MaterialSetChanged; SyncMaterialSet(); }
public InverseKinematicsAnimator(ControllerManager controllerManager, FigureDefinition definition, InverterParameters inverterParameters) { channelSystem = definition.ChannelSystem; boneSystem = new RigidBoneSystem(definition.BoneSystem); goalProvider = new InverseKinematicsUserInterface(controllerManager, channelSystem, boneSystem, inverterParameters); //goalProvider = new DemoInverseKinematicsGoalProvider(boneSystem); solver = new HarmonicInverseKinematicsSolver(boneSystem, inverterParameters.BoneAttributes); poseDeltas = boneSystem.MakeZeroInputs(); Reset(); }
public FigureDefinition GetNewFigureDefinition() { var figureDefinition = new FigureDefinition(); figureDefinition.Enabled = enabled; figureDefinition.Type = Type; figureDefinition.Params = Params; figureDefinition.Position = transform.position; figureDefinition.Rotation = transform.eulerAngles; return(figureDefinition); }
public ActorModel(FigureDefinition mainDefinition, AnimationModel animation, BehaviorModel behavior) { this.mainDefinition = mainDefinition; this.animation = animation; this.behavior = behavior; inputs = mainDefinition.ChannelSystem.MakeZeroChannelInputs(); //hack to turn on eCTRLConfident at start mainDefinition.ChannelSystem.ChannelsByName["eCTRLConfident?value"].SetValue(inputs, 1); }
public static ControlVertexProvider Load(Device device, ShaderCache shaderCache, FigureDefinition definition) { var shaperParameters = Persistance.Load <ShaperParameters>(definition.Directory.File("shaper-parameters.dat")); var occluderLoader = new OccluderLoader(device, shaderCache, definition); var provider = new ControlVertexProvider( device, shaderCache, occluderLoader, definition, shaperParameters); return(provider); }
public StandardProceduralAnimator(FigureDefinition definition, BehaviorModel behaviorModel) { var channelSystem = definition.ChannelSystem; var boneSystem = definition.BoneSystem; animators = new IProceduralAnimator[] { //new HeadLookAtAnimator(channelSystem, boneSystem), new EyeLookAtAnimator(channelSystem, boneSystem, behaviorModel), new BreastGravityAnimator(channelSystem, boneSystem), new BlinkAnimator(channelSystem), //new ExpressionAnimator(channelSystem), //new SpeechAnimator(channelSystem, boneSystem) }; }
public void MoveFigureUp(FigureDefinition figureDefinition) { var pos = mSettings.Geometry_Figures.IndexOf(figureDefinition); var action = FigureAction.MovedUP; if (pos == 0) { pos = mSettings.Geometry_Figures.Count; action = FigureAction.MoveLast; } mSettings.Geometry_Figures.Remove(figureDefinition); mSettings.Geometry_Figures.Insert(pos - 1, figureDefinition); figureDefinition.DoAction(action); }
public FigureFacade Load(string figureName, FigureDefinition parentDefinition) { InitialSettings.Shapes.TryGetValue(figureName, out string initialShapeName); InitialSettings.MaterialSets.TryGetValue(figureName, out string initialMaterialSetName); var recipe = new FigureFacade.Recipe { name = figureName, isVisible = true, shape = initialShapeName, materialSet = initialMaterialSetName }; return(Load(recipe, parentDefinition)); }
public void Init(FigureDefinition figureDefinition) { mFigureDefinition = figureDefinition; mFigureDefinition.PropertyChanged += OnValueChanged; mFigureDefinition.DoneAction += OnDoneAction; gameObject.SetActive(mFigureDefinition.Enabled); name = mFigureDefinition.Type.ToString(); transform.position = mFigureDefinition.Position; transform.eulerAngles = mFigureDefinition.Rotation; Type = mFigureDefinition.Type; Params = mFigureDefinition.Params; }
public void MoveFigureDown(FigureDefinition figureDefinition) { var pos = mSettings.Geometry_Figures.IndexOf(figureDefinition); var action = FigureAction.MovedDown; if (pos == mSettings.Geometry_Figures.Count - 1) { pos = -1; action = FigureAction.MoveFirsrt; } mSettings.Geometry_Figures.Remove(figureDefinition); mSettings.Geometry_Figures.Insert(pos + 1, figureDefinition); figureDefinition.DoAction(action); }
public ControlVertexProvider(Device device, ShaderCache shaderCache, OccluderLoader occluderLoader, FigureDefinition definition, ShaperParameters shaperParameters) { this.occluderLoader = occluderLoader; this.definition = definition; this.shaper = new GpuShaper(device, shaderCache, definition, shaperParameters); this.vertexCount = shaperParameters.InitialPositions.Length; controlVertexInfosBufferManager = new InOutStructuredBufferManager <ControlVertexInfo>(device, vertexCount); if (definition.ChannelSystem.Parent == null) { this.controlVertexInfoStagingBufferManager = new StagingStructuredBufferManager <ControlVertexInfo>(device, vertexCount, BackingArrayCount); } }
public FigureFacade Load(FigureFacade.Recipe recipe, FigureDefinition parentDefinition) { FigureDefinition definition = FigureDefinition.Load(dataDir, recipe.name, parentDefinition); var model = new FigureModel(definition) { IsVisible = recipe.isVisible, ShapeName = recipe.shape, MaterialSetName = recipe.materialSet }; var controlVertexProvider = ControlVertexProvider.Load(device, shaderCache, definition); var facade = new FigureFacade(device, shaderCache, definition, model, controlVertexProvider, figureRendererLoader); return(facade); }
public CharactersMenuLevel(List <Character> characters, FigureDefinition definition, FigureModel model) { var shapesMenuLevel = new ShapesMenuLevel(definition, model); var materialsMenuLevel = new MaterialsMenuLevel(definition, model); var advancedMenuLevel = new StaticMenuLevel( new SubLevelMenuItem("Shape", shapesMenuLevel), new SubLevelMenuItem("Skin", materialsMenuLevel) ); var detailsMenuLevel = new MaterialSetVariantsMenuLevel(definition, model); items = new List <IMenuItem> { }; items.Add(new SubLevelMenuItem("Mix & Match", advancedMenuLevel)); items.Add(new SubLevelMenuItem("Character Details", detailsMenuLevel)); foreach (var character in characters) { items.Add(new CharacterMenuItem(model, character)); } }
public static OcclusionSurrogate Make(FigureDefinition definition, OcclusionSurrogateParameters parameters) { return(new OcclusionSurrogate(definition.BoneSystem.Bones[parameters.BoneIndex], parameters.OffsetInOcclusionInfos)); }
public Kralica(FigureDefinition definition) : base(definition) { }
public static List <OcclusionSurrogate> MakeAll(FigureDefinition definition, OcclusionSurrogateParameters[] parametersList) { return(parametersList.Select(parameters => Make(definition, parameters)).ToList()); }
public void ShowDetails(FigureDefinition figureDefinition) { mUIDetails.RemoveChilds(); Instantiate(mUIDetailsPrefab, mUIDetails).GetComponent <UIDetails>().Init(figureDefinition); }
public void DeleteFigure(FigureDefinition figureDefinition) { mUIDetails.RemoveChilds(); mSettings.Geometry_Figures.Remove(figureDefinition); figureDefinition.DoAction(FigureAction.Deleted); }
public MaterialSetVariantsMenuLevel(FigureDefinition definition, FigureModel model) { this.definition = definition; this.model = model; }
public ShapesMenuLevel(FigureDefinition definition, FigureModel model) { this.definition = definition; this.model = model; }
public FigureModel(FigureDefinition definition) { this.definition = definition; }