void refin(List <Vec3> vert, List <int> faceGr, List <Vector2> uv, AdaptiveOptionsCs option) { Init( ); using (var refi = new Refiner(vert, faceGr, 3)) { refi.AddChannel(new FVarChannelCs(faceGr, uv.Count)); for (int i = 0; i < uv.Count; i++) { refi.SetUV(uv[i].X, uv[i].Y); } refi.AddOption(option); refi.OnFace = OnFace; refi.OnUV = OnUV; refi.OnVert = OnVert; refi.DoRefine( ); } }
static void Main(string[] args) { #if true RefineMMD refine = new RefineMMD(); var path = "debugRect.pmx";//ex.pmx"; OpenFileDialog dialog = new OpenFileDialog( ); dialog.Filter = ".pmx|*.pmx"; if (dialog.ShowDialog( ) == DialogResult.OK) { path = dialog.FileName; } refine.DebugRect(path); //RefineMMD debugRef = new RefineMMD( ); //debugRef.DebugRect( path + "ex.pmx" ); #else var exePath = AppDomain.CurrentDomain.BaseDirectory; var path = @"miku.csv"; string[] lines = File.ReadAllLines(path); //;Face,親材質名,面Index,頂点Index1,頂点Index2,頂点Index3 //Face,"スカート腕ヘドフォン",0,858,840,855 // のように最初の文字列がVertexだと頂点 Faceだと面になる ;が最初に来るものは説明用のものなので弾く var gr = lines.GroupBy(l => l.Split(',')[0]); var gs = gr.Where(g => !g.Key.Contains(";")).ToDictionary(s => s.Key, g => g.ToList( )); var Vertice = ParseCSV(gs["Vertex"]).ToList( ); var faceGr = //.GroupBy( s => s.Split( ',' )[ 1 ] ).ToDictionary( s => s.Key , g => g.ToList( ) ); Util.ParseFaceCSVAll(gs["Face"]).SelectMany(x => x).ToList(); var verts = new List <Vec3> { new Vec3(-0.5f, -0.5f, 0.5f), new Vec3(0.5f, -0.5f, 0.5f), new Vec3(-0.5f, 0.5f, 0.5f), new Vec3(0.5f, 0.5f, 0.5f), new Vec3(-0.5f, 0.5f, -0.5f), new Vec3(0.5f, 0.5f, -0.5f), new Vec3(-0.5f, -0.5f, -0.5f), new Vec3(0.5f, -0.5f, -0.5f), }; var faces = new List <int> { 0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4 }; var option = new AdaptiveOptionsCs(1); option.UseInfSharpPatch = true; option.UseSingleCreasePatch = true; // far_tutorial_6 がパラメトリックにずらす // far_tutorial_3 uvなど using (var refi = new Refiner(Vertice, faceGr, 3)) { refi.AddOption(option); refi.DoRefine( ); } #endif }