.MakeGenericMethod(source, collection, result);
=> GetDiagnosticsAsync(source, analyzerDiagnosticsOnly: true, extraUsings);
TrySingle(source, zero, one, many, ValueTuple.Create);
protected mesh CreatePalletMesh(PalletProperties palletProperties) { // build pallet object Pallet pallet = new Pallet(palletProperties); // build list of boxes List <Box> listBoxes = pallet.BuildListOfBoxes(); // build list of vertices / normals / UVs ulong vertexCount = 0, normalCount = 0, uvCount = 0, triangleCount = 0, boxCount = 0; string triangle_string = string.Empty; List <double> doubleArrayPosition = new List <double>(), doubleArrayNormal = new List <double>(), doubleArrayUV = new List <double>(); foreach (Box box in listBoxes) { foreach (Vector3D p in box.Points) { doubleArrayPosition.Add(p.X); doubleArrayPosition.Add(p.Y); doubleArrayPosition.Add(p.Z); ++vertexCount; } foreach (Vector3D n in box.Normals) { doubleArrayNormal.Add(n.X); doubleArrayNormal.Add(n.Y); doubleArrayNormal.Add(n.Z); ++normalCount; } foreach (Vector2D uv in box.UVs) { doubleArrayUV.Add(uv.X); doubleArrayUV.Add(uv.Y); ++uvCount; } foreach (TriangleIndices tr in box.Triangles) { triangle_string += tr.ConvertToString(boxCount); ++triangleCount; } ++boxCount; } mesh palletMesh = new mesh(); // position source source palletPositionSource = new source() { id = "pallet_position", name = "pallet_position" }; float_array farrayPosition = new float_array { id = "pallet_position_float_array", count = (ulong)doubleArrayPosition.Count, Values = doubleArrayPosition.ToArray() }; palletPositionSource.technique_common = new sourceTechnique_common() { accessor = new accessor() { stride = 3, count = vertexCount, source = "#pallet_position_float_array", param = new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } } } }; palletPositionSource.Item = farrayPosition; // normal source source palletPositionNormal = new source() { id = "pallet_normal", name = "pallet_normal" }; float_array farrayNormal = new float_array { id = "pallet_normal_float_array", count = (ulong)doubleArrayNormal.Count, Values = doubleArrayNormal.ToArray() }; palletPositionNormal.technique_common = new sourceTechnique_common() { accessor = new accessor() { stride = 3, count = normalCount, source = "#pallet_normal_float_array", param = new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } } } }; palletPositionNormal.Item = farrayNormal; // uv source source palletPositionUV = new source() { id = "pallet_UV", name = "pallet_UV" }; float_array farrayUV = new float_array { id = "pallet_UV_float_array", count = (ulong)doubleArrayUV.Count, Values = doubleArrayUV.ToArray() }; palletPositionUV.technique_common = new sourceTechnique_common() { accessor = new accessor() { stride = 2, count = vertexCount, source = "#pallet_UV_float_array", param = new param[] { new param() { name = "S", type = "float" }, new param() { name = "T", type = "float" } } } }; palletPositionUV.Item = farrayUV; // insert sources palletMesh.source = new source[] { palletPositionSource, palletPositionNormal, palletPositionUV }; // vertices InputLocal verticesInput = new InputLocal() { semantic = "POSITION", source = "#pallet_position" }; palletMesh.vertices = new vertices() { id = "pallet_vertex", input = new InputLocal[] { verticesInput } }; triangles trianglesPallet = new triangles() { material = "materialPallet", count = triangleCount }; trianglesPallet.input = new InputLocalOffset[] { new InputLocalOffset() { semantic = "VERTEX", source = "#pallet_vertex", offset = 0 } , new InputLocalOffset() { semantic = "NORMAL", source = "#pallet_normal", offset = 1 } , new InputLocalOffset() { semantic = "TEXCOORD", source = "#pallet_UV", offset = 2, set = 0, setSpecified = true } }; trianglesPallet.p = triangle_string; palletMesh.Items = new object[] { trianglesPallet }; return(palletMesh); }
protected void CreateChannel(List <object> listAnimationObjects, uint caseIndex, string sData, string sDataType, string sTarget, List <double> lValues) { string sTime = string.Format("sTime_{0}_ID", caseIndex); string sInterp = string.Format("sInterp_{0}_ID", caseIndex); // source source source_ = new source() { id = string.Format("sValue_{0}_{1}_ID", caseIndex, sData), name = string.Format("sValue_{0}_{1}", caseIndex, sData), Item = new float_array() { id = string.Format("fa_{0}_{1}_ID", caseIndex, sData), count = (ulong)lValues.Count, Values = lValues.ToArray() }, technique_common = new sourceTechnique_common() { accessor = new accessor() { source = string.Format("#fa_{0}_{1}_ID", caseIndex, sData), count = (ulong)lValues.Count, stride = 1, param = new param[] { new param() { name = sDataType, type = "float" } } } } }; listAnimationObjects.Add(source_); // sampler sampler sampler_ = new sampler() { id = string.Format("sampler_{0}_{1}_ID", caseIndex, sData), input = new InputLocal[] { new InputLocal() { semantic = "INPUT", source = "#" + sTime }, new InputLocal() { semantic = "OUTPUT", source = "#" + source_.id }, new InputLocal() { semantic = "INTERPOLATION", source = "#" + sInterp } } }; listAnimationObjects.Add(sampler_); // channel channel channel_ = new channel() { source = "#" + sampler_.id, target = sTarget }; listAnimationObjects.Add(channel_); }
yield return(CreateCloneMemberExpression(source, destination, cache, target.Item1, target.Item2));
ComponentUtility.TryGetConcreteTypes <T>(out var types) && Copy(source, target, types, include);
target is AggregateType aggTarget && HasGenericDelegateExplicitReferenceConversion(source, aggTarget);
: super(source) { }
=> base.GetDiagnosticsAsync(source, extraUsings.Concat(new[] { "Microsoft.EntityFrameworkCore.Internal" }).ToArray());
Assert.IsNotNull(source, nameof(source));
byte.Parse(source, provider: format);
void AddFacesFromPolyList(polylist list, mesh mesh, ModelPrim prim, Matrix4 transform) { string material = list.material; source posSrc = null; source normalSrc = null; source uvSrc = null; ulong stride = 0; int posOffset = -1; int norOffset = -1; int uvOffset = -1; foreach (var inp in list.input) { stride = Math.Max(stride, inp.offset); if (inp.semantic == "VERTEX") { posSrc = FindSource(mesh.source, mesh.vertices.input[0].source); posOffset = (int)inp.offset; } else if (inp.semantic == "NORMAL") { normalSrc = FindSource(mesh.source, inp.source); norOffset = (int)inp.offset; } else if (inp.semantic == "TEXCOORD") { uvSrc = FindSource(mesh.source, inp.source); uvOffset = (int)inp.offset; } } stride += 1; if (posSrc == null) { return; } var vcount = StrToArray(list.vcount); var idx = StrToArray(list.p); Vector3[] normals = null; if (normalSrc != null) { var norVal = ((float_array)normalSrc.Item).Values; normals = new Vector3[norVal.Length / 3]; for (int i = 0; i < normals.Length; i++) { normals[i] = new Vector3((float)norVal[i * 3 + 0], (float)norVal[i * 3 + 1], (float)norVal[i * 3 + 2]); normals[i] = Vector3.TransformNormal(normals[i], transform); normals[i].Normalize(); } } Vector2[] uvs = null; if (uvSrc != null) { var uvVal = ((float_array)uvSrc.Item).Values; uvs = new Vector2[uvVal.Length / 2]; for (int i = 0; i < uvs.Length; i++) { uvs[i] = new Vector2((float)uvVal[i * 2 + 0], (float)uvVal[i * 2 + 1]); } } ModelFace face = new ModelFace(); face.MaterialID = list.material; if (face.MaterialID != null) { if (MatSymTarget.ContainsKey(list.material)) { ModelMaterial mat = Materials.Find(m => m.ID == MatSymTarget[list.material]); if (mat != null) { face.Material = mat; } } } int curIdx = 0; for (int i = 0; i < vcount.Length; i++) { var nvert = vcount[i]; if (nvert < 3 || nvert > 4) { throw new InvalidDataException("Only triangles and quads supported"); } Vertex[] verts = new Vertex[nvert]; for (int j = 0; j < nvert; j++) { verts[j].Position = prim.Positions[idx[curIdx + posOffset + (int)stride * j]]; if (normals != null) { verts[j].Normal = normals[idx[curIdx + norOffset + (int)stride * j]]; } if (uvs != null) { verts[j].TexCoord = uvs[idx[curIdx + uvOffset + (int)stride * j]]; } } if (nvert == 3) // add the triangle { face.AddVertex(verts[0]); face.AddVertex(verts[1]); face.AddVertex(verts[2]); } else if (nvert == 4) // quad, add two triangles { face.AddVertex(verts[0]); face.AddVertex(verts[1]); face.AddVertex(verts[2]); face.AddVertex(verts[0]); face.AddVertex(verts[2]); face.AddVertex(verts[3]); } curIdx += (int)stride * nvert; } prim.Faces.Add(face); }
void AddPositions(mesh mesh, ModelPrim prim, Matrix4 transform) { prim.Positions = new List <Vector3>(); source posSrc = FindSource(mesh.source, mesh.vertices.input[0].source); double[] posVals = ((float_array)posSrc.Item).Values; for (int i = 0; i < posVals.Length / 3; i++) { Vector3 pos = new Vector3((float)posVals[i * 3], (float)posVals[i * 3 + 1], (float)posVals[i * 3 + 2]); pos = Vector3.Transform(pos, transform); prim.Positions.Add(pos); } prim.BoundMin = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); prim.BoundMax = new Vector3(float.MinValue, float.MinValue, float.MinValue); foreach (var pos in prim.Positions) { if (pos.X > prim.BoundMax.X) { prim.BoundMax.X = pos.X; } if (pos.Y > prim.BoundMax.Y) { prim.BoundMax.Y = pos.Y; } if (pos.Z > prim.BoundMax.Z) { prim.BoundMax.Z = pos.Z; } if (pos.X < prim.BoundMin.X) { prim.BoundMin.X = pos.X; } if (pos.Y < prim.BoundMin.Y) { prim.BoundMin.Y = pos.Y; } if (pos.Z < prim.BoundMin.Z) { prim.BoundMin.Z = pos.Z; } } prim.Scale = prim.BoundMax - prim.BoundMin; prim.Position = prim.BoundMin + (prim.Scale / 2); // Fit vertex positions into identity cube -0.5 .. 0.5 for (int i = 0; i < prim.Positions.Count; i++) { Vector3 pos = prim.Positions[i]; pos = new Vector3( prim.Scale.X == 0 ? 0 : ((pos.X - prim.BoundMin.X) / prim.Scale.X) - 0.5f, prim.Scale.Y == 0 ? 0 : ((pos.Y - prim.BoundMin.Y) / prim.Scale.Y) - 0.5f, prim.Scale.Z == 0 ? 0 : ((pos.Z - prim.BoundMin.Z) / prim.Scale.Z) - 0.5f ); prim.Positions[i] = pos; } }
public void StopSound(source p_source) { switch (p_source) { case source.MUSIC: musicSound.Stop(); break; case source.ENGINE: engineSound.Stop(); break; case source.BOOST: boostSound.Stop(); break; case source.NORMAL_WEAPON: normalWeaponSound.Stop(); break; case source.SPECIAL_WEAPON: specialweaponSound.Stop(); break; } }
public static void ExportIOModelAsDAE(string FileName, IOModel m) { COLLADA colladaFile = new COLLADA(); List <geometry> list_geometries = new List <geometry>(m.Meshes.Count); if (m.HasMeshes) { foreach (IOMesh iomesh in m.Meshes) { geometry g = new geometry(); g.name = iomesh.Name; g.id = iomesh.Name + $"_{m.Meshes.IndexOf(iomesh)}"; List <double> list_positions = new List <double>(); List <double> list_normals = new List <double>(); List <double> list_uvs = new List <double>(); List <double> list_colors = new List <double>(); foreach (IOVertex v in iomesh.Vertices) { list_positions.Add(v.Position.X); list_positions.Add(v.Position.Y); list_positions.Add(v.Position.Z); list_normals.Add(v.Normal.X); list_normals.Add(v.Normal.Y); list_normals.Add(v.Normal.Z); list_uvs.Add(v.UV0.X); list_uvs.Add(v.UV0.Y); } // Position source source_position = new source(); { float_array floats = new float_array(); floats.count = (ulong)list_positions.Count; floats.id = g.id + "_pos_arr"; floats.Values = list_positions.ToArray(); source_position = CreateSource(list_positions.Count, 3, floats.id, floats, new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } }); } // Normal source source_normal = new source(); { float_array floats = new float_array(); floats.count = (ulong)list_normals.Count; floats.id = g.id + "_nrm_arr"; floats.Values = list_normals.ToArray(); source_normal = CreateSource(list_normals.Count, 3, floats.id, floats, new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } }); } // UV0 source source_uv0 = new source(); { float_array floats = new float_array(); floats.count = (ulong)list_uvs.Count; floats.id = g.id + "_uv0_arr"; floats.Values = list_uvs.ToArray(); source_uv0 = CreateSource(list_uvs.Count, 2, floats.id, floats, new param[] { new param() { name = "S", type = "float" }, new param() { name = "T", type = "float" } }); } // vertices vertices vertices = new vertices(); vertices.id = g.id + "_verts"; vertices.input = new InputLocal[] { new InputLocal() { source = "#" + source_position.id, semantic = "POSITION" }, new InputLocal() { source = "#" + source_normal.id, semantic = "NORMAL" }, new InputLocal() { source = "#" + source_uv0.id, semantic = "TEXCOORD" } }; // triangles triangles triangles = new triangles(); triangles.count = (ulong)iomesh.Indices.Count; triangles.input = new InputLocalOffset[] { new InputLocalOffset() { offset = 0, semantic = "VERTEX", source = "#" + vertices.id } }; triangles.p = string.Join(" ", iomesh.Indices); // creating mesh mesh geomesh = new mesh(); geomesh.source = new source[] { source_position, source_normal, source_uv0 }; geomesh.Items = new object[] { triangles }; geomesh.vertices = vertices; g.Item = geomesh; list_geometries.Add(g); } } library_geometries lib_geometry = new library_geometries(); lib_geometry.geometry = list_geometries.ToArray(); // controllers List <controller> list_controller = new List <controller>(); if (m.HasMeshes && m.HasSkeleton) { // create lists List <source> skinSources = new List <source>(); List <string> boneNames = new List <string>(); List <double> InverseBinds = new List <double>(); foreach (RBone b in m.Skeleton.Bones) { boneNames.Add(b.Name); InverseBinds.AddRange(new double[] { b.InvWorldTransform.M11, b.InvWorldTransform.M21, b.InvWorldTransform.M31, b.InvWorldTransform.M41, b.InvWorldTransform.M12, b.InvWorldTransform.M22, b.InvWorldTransform.M32, b.InvWorldTransform.M42, b.InvWorldTransform.M13, b.InvWorldTransform.M23, b.InvWorldTransform.M33, b.InvWorldTransform.M43, b.InvWorldTransform.M14, b.InvWorldTransform.M24, b.InvWorldTransform.M34, b.InvWorldTransform.M44, }); } // setup controllers foreach (IOMesh iomesh in m.Meshes) { controller controller = new controller() { id = iomesh.Name + "_" + m.Meshes.IndexOf(iomesh) + "_controller" }; list_controller.Add(controller); // create source for weights List <double> weights = new List <double>(); List <int> bones = new List <int>(); List <int> boneCount = new List <int>(); StringBuilder build_v = new StringBuilder(); foreach (IOVertex v in iomesh.Vertices) { int bcount = 0; if (v.BoneWeights.X > 0) { if (!weights.Contains(v.BoneWeights.X)) { weights.Add(v.BoneWeights.X); } build_v.Append($"{(int)v.BoneIndices.X} {weights.IndexOf(v.BoneWeights.X)} "); bcount++; } if (v.BoneWeights.Y > 0) { if (!weights.Contains(v.BoneWeights.Y)) { weights.Add(v.BoneWeights.Y); } build_v.Append($"{(int)v.BoneIndices.Y} {weights.IndexOf(v.BoneWeights.Y)} "); bcount++; } if (v.BoneWeights.Z > 0) { if (!weights.Contains(v.BoneWeights.Z)) { weights.Add(v.BoneWeights.Z); } build_v.Append($"{(int)v.BoneIndices.Z} {weights.IndexOf(v.BoneWeights.Z)} "); bcount++; } if (v.BoneWeights.W > 0) { if (!weights.Contains(v.BoneWeights.W)) { weights.Add(v.BoneWeights.W); } build_v.Append($"{(int)v.BoneIndices.W} {weights.IndexOf(v.BoneWeights.W)} "); bcount++; } boneCount.Add(bcount); } // skin Name_array arr_name = new Name_array(); arr_name.count = (ulong)boneNames.Count; arr_name.id = controller.id + "joints"; arr_name.Values = boneNames.ToArray(); source source_skin = CreateSource(boneNames.Count, 1, arr_name.id, arr_name, new param[] { new param() { name = "JOINT", type = "name" } }); // bind float_array arr_bind = new float_array(); arr_bind.count = (ulong)InverseBinds.Count; arr_bind.id = controller.id + "binds"; arr_bind.Values = InverseBinds.ToArray(); source source_binds = CreateSource(InverseBinds.Count, 16, arr_bind.id, arr_bind, new param[] { new param() { name = "TRANSFORM", type = "float4x4" } }); // weight source source_weight = new source(); { float_array floats = new float_array(); floats.count = (ulong)weights.Count; floats.id = controller.id + "_weights"; floats.Values = weights.ToArray(); source_weight = CreateSource(weights.Count, 1, floats.id, floats, new param[] { new param() { name = "WEIGHT", type = "float" }, }); } skin skin = new skin(); skin.source1 = "#" + iomesh.Name + $"_{m.Meshes.IndexOf(iomesh)}"; skin.source = new source[] { source_skin, source_binds, source_weight }; skin.joints = new skinJoints() { input = new InputLocal[] { new InputLocal() { semantic = "JOINT", source = "#" + source_skin.id }, new InputLocal() { semantic = "INV_BIND_MATRIX", source = "#" + source_binds.id } } }; //skin weights skin.vertex_weights = new skinVertex_weights(); skin.vertex_weights.count = (ulong)iomesh.Vertices.Count; skin.vertex_weights.input = new InputLocalOffset[] { new InputLocalOffset() { semantic = "JOINT", source = "#" + source_skin.id, offset = 0 }, new InputLocalOffset() { semantic = "WEIGHT", source = "#" + source_weight.id, offset = 1 } }; skin.vertex_weights.vcount = string.Join(" ", boneCount); skin.vertex_weights.v = build_v.ToString(); controller.Item = skin; } } library_controllers lib_controllers = new library_controllers(); lib_controllers.controller = list_controller.ToArray(); // scene nodes List <node> scene_nodes = new List <node>(); int visual_index = 0; if (m.HasSkeleton) { Dictionary <RBone, node> boneToNode = new Dictionary <RBone, node>(); foreach (RBone b in m.Skeleton.Bones) { // create bone node node node = new node(); node.name = b.Name; node.id = "bone" + visual_index++; node.sid = b.Name; node.type = NodeType.JOINT; // add transform matrix mat = new matrix() { Values = new double[] { b.Transform.M11, b.Transform.M21, b.Transform.M31, b.Transform.M41, b.Transform.M12, b.Transform.M22, b.Transform.M32, b.Transform.M42, b.Transform.M13, b.Transform.M23, b.Transform.M33, b.Transform.M43, b.Transform.M14, b.Transform.M24, b.Transform.M34, b.Transform.M44, } }; node.ItemsElementName = new ItemsChoiceType2[] { ItemsChoiceType2.matrix }; node.Items = new object[] { mat }; // deal with parenting boneToNode.Add(b, node); if (b.ParentID == -1) { scene_nodes.Add(node); } else { if (boneToNode[m.Skeleton.Bones[b.ParentID]].node1 == null) { boneToNode[m.Skeleton.Bones[b.ParentID]].node1 = new node[0]; } node[] parentnode = boneToNode[m.Skeleton.Bones[b.ParentID]].node1; Array.Resize <node>(ref parentnode, parentnode.Length + 1); parentnode[parentnode.Length - 1] = node; boneToNode[m.Skeleton.Bones[b.ParentID]].node1 = parentnode; } } } if (m.HasMeshes) { foreach (IOMesh iomesh in m.Meshes) { node node = new node() { id = "mesh" + visual_index++, name = iomesh.Name, type = NodeType.NODE }; if (m.HasSkeleton) { instance_controller controller = new instance_controller() { url = iomesh.Name + "_" + m.Meshes.IndexOf(iomesh) + "_controller" }; controller.skeleton = new string[] { "#bone0" }; node.instance_controller = new instance_controller[] { controller }; } scene_nodes.Add(node); } } // visual scene root library_visual_scenes scenes = new library_visual_scenes(); scenes.visual_scene = new visual_scene[] { new visual_scene() { id = "visualscene0", name = "rdmscene" } }; scenes.visual_scene[0].node = scene_nodes.ToArray(); // scene COLLADAScene scene = new COLLADAScene(); scene.instance_visual_scene = new InstanceWithExtra() { url = "#visualscene0" }; // putting it all together colladaFile.Items = new object[] { lib_geometry, lib_controllers, scenes }; colladaFile.scene = scene; colladaFile.Save(FileName); }
=> ContainsError(source, error, null);
await VerifyCSharpDiagnosticAsync(source, Descriptors.PX1036_WrongDacPrimaryKeyName.CreateFor(
ComponentUtility.Abstract <T> .TryConcrete(out var metadata) ? Copy(source, target, metadata, include) :
static (source, count, observer) => WindowCore(source, observer, (o, d) => AsyncObserver.Window(o, d, count))));
=> _session?.UpdateActiveStatementSpans(source, spans);
=> Init(source, model, context, length);
public void CreateAnimation(uint caseIndex, uint caseCount, List <object> listAnimationObjects, BoxPosition bPos) { const int iStep = 5; _zOffset = _palletSolution.PalletHeight + 100.0; // build list of time List <double> listTime = new List <double>(); List <string> listInterp = new List <string>(); listTime.Add(0.0); listInterp.Add("LINEAR"); for (int i = 0; i < iStep; ++i) { listTime.Add(((double)caseIndex + (double)i / (double)(iStep - 1))); listInterp.Add("LINEAR"); } listTime.Add(caseCount); listInterp.Add("LINEAR"); BProperties bProperties = _palletSolution.Analysis.BProperties; PalletProperties pProperties = _palletSolution.Analysis.PalletProperties; double yOffset = 0.5 * (_palletSolution.Analysis.PalletProperties.Width - bProperties.Length); BoxPosition bPosFinal = GetFinalBoxPosition(caseIndex); List <BoxPosition> listBoxPosition = new List <BoxPosition>(); // -1. listBoxPosition.Add(GetInitialBoxPosition(caseIndex)); // 0. initialbox position listBoxPosition.Add(GetInitialBoxPosition(caseIndex)); // 1. position at out storing area listBoxPosition.Add(new BoxPosition(new Vector3D(_xOffset, yOffset, _zOffset), HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N)); // 2. position above pallet listBoxPosition.Add(new BoxPosition(new Vector3D(pProperties.Length * 0.5, pProperties.Width * 0.5, _zOffset), bPosFinal.DirectionLength, bPosFinal.DirectionWidth)); // 3. position above final position listBoxPosition.Add(new BoxPosition(new Vector3D(bPosFinal.Position.X, bPosFinal.Position.Y, _zOffset), bPosFinal.DirectionLength, bPosFinal.DirectionWidth)); // 4. final position listBoxPosition.Add(bPosFinal); // 5. listBoxPosition.Add(bPosFinal); List <double> listX = new List <double>(); List <double> listY = new List <double>(); List <double> listZ = new List <double>(); List <double> listRX = new List <double>(); List <double> listRY = new List <double>(); List <double> listRZ = new List <double>(); BoxPosition bPprev0 = listBoxPosition[0]; listX.Add(bPprev0.Position.X); listY.Add(bPprev0.Position.Y); listZ.Add(bPprev0.Position.Z); Vector3D vRotPrev0 = bPprev0.Transformation.Rotations; listRX.Add(vRotPrev0.X); listRY.Add(vRotPrev0.Y); listRZ.Add(vRotPrev0.Z); for (int i = 1; i < listBoxPosition.Count; ++i) { BoxPosition bP = listBoxPosition[i]; listX.Add(bP.Position.X); listY.Add(bP.Position.Y); listZ.Add(bP.Position.Z); Vector3D vRot = bP.Transformation.Rotations; listRX.Add(vRot.X); listRY.Add(vRot.Y); listRZ.Add(vRot.Z); } // time source sTime = new source() { id = string.Format("sTime_{0}_ID", caseIndex), name = string.Format("sTime_{0}", caseIndex), Item = new float_array() { id = string.Format("fa_time_{0}_ID", caseIndex), count = (ulong)listTime.Count, Values = listTime.ToArray() }, technique_common = new sourceTechnique_common() { accessor = new accessor() { source = string.Format("#fa_time_{0}_ID", caseIndex), count = (ulong)listTime.Count, stride = 1, param = new param[] { new param() { name = "TIME", type = "float" } } } } }; listAnimationObjects.Add(sTime); // interp source sInterp = new source() { id = string.Format("sInterp_{0}_ID", caseIndex), name = string.Format("sInterp_{0}", caseIndex), Item = new Name_array() { id = string.Format("na_interp_{0}_ID", caseIndex), count = (ulong)listInterp.Count, Values = listInterp.ToArray() }, technique_common = new sourceTechnique_common() { accessor = new accessor() { source = string.Format("#na_interp_{0}_ID", caseIndex), count = (ulong)listInterp.Count, stride = 1, param = new param[] { new param() { name = "INTERPOLATION", type = "name" } } } } }; listAnimationObjects.Add(sInterp); CreateChannel(listAnimationObjects, caseIndex, "X", "TIME", string.Format("CaseNode_{0}_ID/t.X", caseIndex), listX); CreateChannel(listAnimationObjects, caseIndex, "Y", "TIME", string.Format("CaseNode_{0}_ID/t.Y", caseIndex), listY); CreateChannel(listAnimationObjects, caseIndex, "Z", "TIME", string.Format("CaseNode_{0}_ID/t.Z", caseIndex), listZ); CreateChannel(listAnimationObjects, caseIndex, "RX", "ANGLE", string.Format("CaseNode_{0}_ID/rx.ANGLE", caseIndex), listRX); CreateChannel(listAnimationObjects, caseIndex, "RY", "ANGLE", string.Format("CaseNode_{0}_ID/ry.ANGLE", caseIndex), listRY); CreateChannel(listAnimationObjects, caseIndex, "RZ", "ANGLE", string.Format("CaseNode_{0}_ID/rz.ANGLE", caseIndex), listRZ); }
=> Init(source, model, context, TO_EOF);
protected mesh CreateCaseMesh(BoxProperties caseProperties) { // build box Box box = new Box(0, caseProperties); // build list of vertices / normals / UVs ulong vertexCount = 0, normalCount = 0, uvCount = 0; List <double> doubleArrayPosition = new List <double>(), doubleArrayNormal = new List <double>(), doubleArrayUV = new List <double>(); foreach (Vector3D p in box.PointsSmallOffset) { doubleArrayPosition.Add(p.X); doubleArrayPosition.Add(p.Y); doubleArrayPosition.Add(p.Z); ++vertexCount; } foreach (Vector3D n in box.Normals) { doubleArrayNormal.Add(n.X); doubleArrayNormal.Add(n.Y); doubleArrayNormal.Add(n.Z); ++normalCount; } foreach (Vector2D uv in box.UVs) { doubleArrayUV.Add(uv.X); doubleArrayUV.Add(uv.Y); ++uvCount; } mesh caseMesh = new mesh(); // position source source casePositionSource = new source() { id = "case_position", name = "case_position" }; float_array farrayPosition = new float_array { id = "case_position_float_array", count = (ulong)doubleArrayPosition.Count, Values = doubleArrayPosition.ToArray() }; casePositionSource.technique_common = new sourceTechnique_common() { accessor = new accessor() { stride = 3, count = vertexCount, source = "#case_position_float_array", param = new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } } } }; casePositionSource.Item = farrayPosition; // normal source source casePositionNormal = new source() { id = "case_normal", name = "case_normal" }; float_array farrayNormal = new float_array { id = "case_normal_float_array", count = (ulong)doubleArrayNormal.Count, Values = doubleArrayNormal.ToArray() }; casePositionNormal.technique_common = new sourceTechnique_common() { accessor = new accessor() { stride = 3, count = normalCount, source = "#case_normal_float_array", param = new param[] { new param() { name = "X", type = "float" }, new param() { name = "Y", type = "float" }, new param() { name = "Z", type = "float" } } } }; casePositionNormal.Item = farrayNormal; // uv source source casePositionUV = new source() { id = "case_UV", name = "pallet_UV" }; float_array farrayUV = new float_array { id = "case_UV_float_array", count = (ulong)doubleArrayUV.Count, Values = doubleArrayUV.ToArray() }; casePositionUV.technique_common = new sourceTechnique_common() { accessor = new accessor() { stride = 2, count = vertexCount, source = "#case_UV_float_array", param = new param[] { new param() { name = "S", type = "float" }, new param() { name = "T", type = "float" } } } }; casePositionUV.Item = farrayUV; // insert sources caseMesh.source = new source[] { casePositionSource, casePositionNormal, casePositionUV }; // vertices InputLocal verticesInput = new InputLocal() { semantic = "POSITION", source = "#case_position" }; caseMesh.vertices = new vertices() { id = "case_vertex", input = new InputLocal[] { verticesInput } }; List <object> trianglesList = new List <object>(); // build list of triangles foreach (HalfAxis.HAxis axis in HalfAxis.All) { triangles trianglesCase = new triangles() { material = string.Format("materialCase{0}", (uint)axis), count = 2 }; trianglesCase.input = new InputLocalOffset[] { new InputLocalOffset() { semantic = "VERTEX", source = "#case_vertex", offset = 0 } , new InputLocalOffset() { semantic = "NORMAL", source = "#case_normal", offset = 1 } , new InputLocalOffset() { semantic = "TEXCOORD", source = "#case_UV", offset = 2, set = 0, setSpecified = true } }; string triangle_string = string.Empty; foreach (TriangleIndices tr in box.TrianglesByFace(axis)) { triangle_string += tr.ConvertToString(0); } trianglesCase.p = triangle_string; trianglesList.Add(trianglesCase); } // build list of lines lines linesCase = new lines() { material = "materialCaseLines", count = 12, input = new InputLocalOffset[] { new InputLocalOffset() { semantic = "VERTEX", source = "#case_vertex", offset = 0 } }, p = "0 1 1 2 2 3 3 0 4 5 5 6 6 7 7 4 0 4 1 5 2 6 3 7" }; trianglesList.Add(linesCase); caseMesh.Items = trianglesList.ToArray(); return(caseMesh); }
var(source, destination) = item;
get => selector(source[index]);
protected node AddToCollada(List <material> materials, List <effect> effects, List <geometry> geometries, List <string> visitedAttaches, bool hasTextures, ref int nodeID) { BasicAttach attach = Attach as BasicAttach; if (attach == null || visitedAttaches.Contains(attach.Name)) { goto skipAttach; } visitedAttaches.Add(attach.Name); int m = 0; foreach (NJS_MATERIAL item in attach.Material) { materials.Add(new material { id = "material_" + attach.Name + "_" + m, name = "material_" + attach.Name + "_" + m, instance_effect = new instance_effect { url = "#" + "material_" + attach.Name + "_" + m + "_eff" } }); if (hasTextures & item.UseTexture) { effects.Add(new effect { id = "material_" + attach.Name + "_" + m + "_eff", name = "material_" + attach.Name + "_" + m + "_eff", Items = new effectFx_profile_abstractProfile_COMMON[] { new effectFx_profile_abstractProfile_COMMON { Items = new object[] { new common_newparam_type { sid = "material_" + attach.Name + "_" + m + "_eff_surface", /*Item = new Collada141.fx_sampler2D_common() * { instance_image = new Collada141.instance_image() { url = "#image_" + (item.TextureID + 1).ToString(System.Globalization.NumberFormatInfo.InvariantInfo) } }, * ItemElementName = Collada141.ItemChoiceType.sampler2D*/ Item = new fx_surface_common { type = fx_surface_type_enum.Item2D, init_from = new fx_surface_init_from_common[] { new fx_surface_init_from_common { Value = "image_" + (item.TextureID + 1).ToString(NumberFormatInfo.InvariantInfo) } } }, ItemElementName = ItemChoiceType.surface } }, technique = new effectFx_profile_abstractProfile_COMMONTechnique { sid = "standard", Item = new effectFx_profile_abstractProfile_COMMONTechniquePhong { ambient = new common_color_or_texture_type { Item = new common_color_or_texture_typeTexture { texture = "material_" + attach.Name + "_" + m + "_eff_surface", texcoord = "CHANNEL0" } }, diffuse = new common_color_or_texture_type { Item = new common_color_or_texture_typeColor { Values = new double[] { item.DiffuseColor.R / 255d, item.DiffuseColor.G / 255d, item.DiffuseColor.B / 255d, item.UseAlpha ? item.DiffuseColor.A / 255d : 1 } } } } } } } }); } else { effects.Add(new effect { id = "material_" + attach.Name + "_" + m + "_eff", name = "material_" + attach.Name + "_" + m + "_eff", Items = new effectFx_profile_abstractProfile_COMMON[] { new effectFx_profile_abstractProfile_COMMON { technique = new effectFx_profile_abstractProfile_COMMONTechnique { sid = "standard", Item = new effectFx_profile_abstractProfile_COMMONTechniquePhong { diffuse = new common_color_or_texture_type { Item = new common_color_or_texture_typeColor { Values = new double[] { item.DiffuseColor.R / 255d, item.DiffuseColor.G / 255d, item.DiffuseColor.B / 255d, item.UseAlpha ? item.DiffuseColor.A / 255d : 1 } } } } } } } }); } m++; } List <double> verts = new List <double>(); foreach (Vertex item in attach.Vertex) { verts.Add(item.X); verts.Add(item.Y); verts.Add(item.Z); } source pos = new source { id = attach.Name + "_position", Item = new float_array { id = attach.Name + "_position_array", count = (ulong)verts.Count, Values = verts.ToArray() }, technique_common = new sourceTechnique_common { accessor = new accessor { source = "#" + attach.Name + "_position_array", count = (ulong)(verts.Count / 3), stride = 3, param = new param[] { new param { name = "X", type = "float" }, new param { name = "Y", type = "float" }, new param { name = "Z", type = "float" } } } } }; verts = new List <double>(); foreach (Vertex item in attach.Normal) { verts.Add(item.X); verts.Add(item.Y); verts.Add(item.Z); } source nor = new source { id = attach.Name + "_normal", Item = new float_array { id = attach.Name + "_normal_array", count = (ulong)verts.Count, Values = verts.ToArray() }, technique_common = new sourceTechnique_common { accessor = new accessor { source = "#" + attach.Name + "_normal_array", count = (ulong)(verts.Count / 3), stride = 3, param = new param[] { new param { name = "X", type = "float" }, new param { name = "Y", type = "float" }, new param { name = "Z", type = "float" } } } } }; List <source> srcs = new List <source> { pos, nor }; foreach (NJS_MESHSET mitem in attach.Mesh) { if (mitem.UV != null) { verts = new List <double>(); foreach (UV item in mitem.UV) { verts.Add(item.U); verts.Add(-item.V); } srcs.Add(new source { id = mitem.UVName, Item = new float_array { id = mitem.UVName + "_array", count = (ulong)verts.Count, Values = verts.ToArray() }, technique_common = new sourceTechnique_common { accessor = new accessor { source = "#" + mitem.UVName + "_array", count = (ulong)(verts.Count / 2), stride = 2, param = new param[] { new param { name = "S", type = "float" }, new param { name = "T", type = "float" } } } } }); } } List <triangles> tris = new List <triangles>(); foreach (NJS_MESHSET mesh in attach.Mesh) { bool hasVColor = mesh.VColor != null; bool hasUV = mesh.UV != null; uint currentstriptotal = 0; foreach (Poly poly in mesh.Poly) { List <uint> inds = new List <uint>(); switch (mesh.PolyType) { case Basic_PolyType.Triangles: for (uint i = 0; i < 3; i++) { inds.Add(poly.Indexes[i]); if (hasUV) { inds.Add(currentstriptotal + i); } } currentstriptotal += 3; break; case Basic_PolyType.Quads: for (uint i = 0; i < 3; i++) { inds.Add(poly.Indexes[i]); if (hasUV) { inds.Add(currentstriptotal + i); } } for (uint i = 1; i < 4; i++) { inds.Add(poly.Indexes[i]); if (hasUV) { inds.Add(currentstriptotal + i); } } currentstriptotal += 4; break; case Basic_PolyType.NPoly: case Basic_PolyType.Strips: bool flip = !((Strip)poly).Reversed; for (int k = 0; k < poly.Indexes.Length - 2; k++) { flip = !flip; if (!flip) { for (uint i = 0; i < 3; i++) { inds.Add(poly.Indexes[k + i]); if (hasUV) { inds.Add(currentstriptotal + i); } } } else { inds.Add(poly.Indexes[k + 1]); if (hasUV) { inds.Add(currentstriptotal + 1); } inds.Add(poly.Indexes[k]); if (hasUV) { inds.Add(currentstriptotal); } inds.Add(poly.Indexes[k + 2]); if (hasUV) { inds.Add(currentstriptotal + 2); } } currentstriptotal += 1; } currentstriptotal += 2; break; } string[] indstr = new string[inds.Count]; for (int i = 0; i < inds.Count; i++) { indstr[i] = inds[i].ToString(NumberFormatInfo.InvariantInfo); } List <InputLocalOffset> inp = new List <InputLocalOffset> { new InputLocalOffset { semantic = "VERTEX", offset = 0, source = "#" + attach.Name + "_vertices" } }; if (hasUV) { inp.Add(new InputLocalOffset { semantic = "TEXCOORD", offset = 1, source = "#" + mesh.UVName, setSpecified = true }); } tris.Add(new triangles { material = "material_" + attach.Name + "_" + mesh.MaterialID, count = (ulong)(inds.Count / (hasUV ? 6 : 3)), input = inp.ToArray(), p = string.Join(" ", indstr) }); } } geometries.Add(new geometry { id = attach.Name, name = attach.Name, Item = new mesh { source = srcs.ToArray(), vertices = new vertices { id = attach.Name + "_vertices", input = new InputLocal[] { new InputLocal { semantic = "POSITION", source = "#" + attach.Name + "_position" }, new InputLocal { semantic = "NORMAL", source = "#" + attach.Name + "_normal" } } }, Items = tris.ToArray() } }); skipAttach: ++nodeID; node node = new node { id = $"{nodeID:000}_{Name}", name = $"{nodeID:000}_{Name}", Items = new object[] { new TargetableFloat3 { sid = "translate", Values = new double[] { Position.X, Position.Y, Position.Z } }, new rotate { sid = "rotateZ", Values = new double[] { 0, 0, 1, Rotation.BAMSToDeg(Rotation.Z) } }, new rotate { sid = "rotateX", Values = new double[] { 1, 0, 0, Rotation.BAMSToDeg(Rotation.X) } }, new rotate { sid = "rotateY", Values = new double[] { 0, 1, 0, Rotation.BAMSToDeg(Rotation.Y) } }, new TargetableFloat3 { sid = "scale", Values = new double[] { Scale.X, Scale.Y, Scale.Z } } }, ItemsElementName = new ItemsChoiceType2[] { ItemsChoiceType2.translate, ItemsChoiceType2.rotate, ItemsChoiceType2.rotate, ItemsChoiceType2.rotate, ItemsChoiceType2.scale } }; if (attach != null) { List <instance_material> mats = new List <instance_material>(); foreach (NJS_MESHSET item in attach.Mesh) { mats.Add(new instance_material { symbol = "material_" + attach.Name + "_" + item.MaterialID, target = "#" + "material_" + attach.Name + "_" + item.MaterialID }); } node.instance_geometry = new instance_geometry[] { new instance_geometry { url = "#" + attach.Name, bind_material = new bind_material { technique_common = mats.ToArray() } } }; } List <node> childnodes = new List <node>(); foreach (NJS_OBJECT item in Children) { childnodes.Add(item.AddToCollada(materials, effects, geometries, visitedAttaches, hasTextures, ref nodeID)); } node.node1 = childnodes.ToArray(); return(node); }
await VerifyCSharpDiagnosticAsync(source, Descriptors.PX1035_MultipleKeyDeclarationsInDacWithSameFields.CreateFor(
sut = new PropertyTypeFilter(source, propertyType);
//System.Collections.Generic.List<IPlayable> typeA = IncludeTask.GetEntities(TypeA, in controller, source, target, stack?.Playables); //System.Collections.Generic.List<IPlayable> typeB = IncludeTask.GetEntities(TypeB, in controller, source, target, stack?.Playables); AddSourceAndTargetToVector(source, target);
=> base.GetDiagnosticsAsync(source, extraUsings.Concat(new[] { "Orleans.Concurrency" }).ToArray());
public void PlaySound(source p_source, AudioClip p_clip) { switch (p_source) { case source.MUSIC: musicSound.clip = p_clip; musicSound.Play(); break; case source.ENGINE: engineSound.clip = p_clip; engineSound.Play(); break; case source.BOOST: if (!boostSound.isPlaying) { boostSound.clip = p_clip; boostSound.Play(); } break; case source.NORMAL_WEAPON: normalWeaponSound.clip = p_clip; normalWeaponSound.Play(); break; case source.SPECIAL_WEAPON: specialweaponSound.clip = p_clip; specialweaponSound.Play(); break; case source.BARREL: barrelRollSound.clip = p_clip; barrelRollSound.Play(); break; case source.SAND_HIT: monsterSound.clip = p_clip; monsterSound.Play(); break; } }
public Segment(source.mode.parsers.Source source_parameter) { source = source_parameter; }