public void GetData_Rotation() { this.LineSketchObject.transform.rotation = Quaternion.Euler(0, 25, 0); LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; Assert.That(data.Rotation, Is.EqualTo(Quaternion.Euler(0, 25, 0)).Using(QuaternionEqualityComparer.Instance)); }
public void GetData_Scale() { this.LineSketchObject.transform.localScale = new Vector3(3, 3, 3); LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; Assert.AreEqual(new Vector3(3, 3, 3), data.Scale); }
SerializableComponentData ISerializableComponent.GetData() { LineSketchObjectData data = base.GetData(); data.Interpolation = LineSketchObjectData.InterpolationType.Linear; return(data); }
public void GetData_Position() { this.LineSketchObject.transform.position = new Vector3(1, 2, 3); LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; Assert.AreEqual(new Vector3(1, 2, 3), data.Position); }
public void ApplyData_Scale() { LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; data.Scale = new Vector3(1, 2, 3); this.SerializableSketchObject.ApplyData(data); Assert.AreEqual(new Vector3(1, 2, 3), this.LineSketchObject.gameObject.transform.localScale); }
public void ApplyData_Rotation() { LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; data.Rotation = Quaternion.Euler(10, 20, 30); this.SerializableSketchObject.ApplyData(data); Assert.That(this.LineSketchObject.gameObject.transform.rotation, Is.EqualTo(Quaternion.Euler(10, 20, 30)).Using(QuaternionEqualityComparer.Instance)); }
public void ApplyData_Position() { LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; data.Position = new Vector3(2, 5, 8); this.SerializableSketchObject.ApplyData(data); Assert.AreEqual(new Vector3(2, 5, 8), this.LineSketchObject.gameObject.transform.position); }
public void GetData_ControlPoints() { this.LineSketchObject.SetControlPointsLocalSpace(new List <Vector3> { new Vector3(1, 2, 3), new Vector3(3, 2, 1), new Vector3(1, 1, 1), new Vector3(2, 2, 2) }); LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; Assert.AreEqual(new Vector3(3, 2, 1), data.ControlPoints[1]); }
private void ApplyData(LineSketchObjectData data) { this.transform.position = Vector3.zero; this.transform.rotation = Quaternion.identity; this.SetInterpolationSteps(data.InterpolationSteps); this.SetLineCrossSection(data.CrossSectionVertices, data.CrossSectionNormals, data.CrossSectionScale); this.SetControlPointsLocalSpace(data.ControlPoints); data.ApplyDataToTransform(this.transform); this.SetMaterial(Defaults.GetMaterialFromDictionary(data.SketchMaterial)); }
public void ApplyData_ControlPoints() { LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; data.ControlPoints = new List <Vector3> { new Vector3(1, 2, 3), new Vector3(3, 2, 1), new Vector3(1, 1, 1), new Vector3(2, 2, 2) }; this.SerializableSketchObject.ApplyData(data); Assert.AreEqual(new Vector3(3, 2, 1), this.LineSketchObject.GetControlPoints()[1]); Assert.AreEqual((3 * 20 + 2) * 7, this.LineSketchObject.gameObject.GetComponent <MeshFilter>().sharedMesh.vertexCount); }
public void GetData_CrossSection() { List <Vector3> crossSection = new List <Vector3> { new Vector3(0, 0, 1), new Vector3(.5f, 0, 0), new Vector3(-.5f, 0, 0) }; this.LineSketchObject.SetLineCrossSection(crossSection, crossSection, .3f); LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; Assert.AreEqual(new Vector3(.5f, 0, 0), data.CrossSectionVertices[1]); Assert.AreEqual(new Vector3(0, 0, 1), data.CrossSectionVertices[0]); Assert.AreEqual(.3f, data.CrossSectionScale); }
public void ApplyData_CrossSection() { LineSketchObjectData data = this.SerializableSketchObject.GetData() as LineSketchObjectData; List <Vector3> crossSection = new List <Vector3> { new Vector3(0, 0, 1), new Vector3(.5f, 0, 0), new Vector3(-.5f, 0, 0) }; data.ControlPoints = new List <Vector3> { new Vector3(1, 2, 3), new Vector3(3, 2, 1), new Vector3(1, 1, 1), new Vector3(2, 2, 2) }; data.CrossSectionVertices = crossSection; data.CrossSectionNormals = crossSection; data.CrossSectionScale = 3.0f; this.SerializableSketchObject.ApplyData(data); Assert.AreEqual(new Vector3(3, 2, 1), this.LineSketchObject.GetControlPoints()[1]); Assert.AreEqual((3 * 20 + 2) * 3, this.LineSketchObject.gameObject.GetComponent <MeshFilter>().sharedMesh.vertexCount); }
protected LineSketchObjectData GetData() { LineSketchObjectData data = new LineSketchObjectData { Interpolation = LineSketchObjectData.InterpolationType.Cubic, ControlPoints = GetControlPoints(), CrossSectionScale = this.lineDiameter, InterpolationSteps = this.InterpolationSteps }; data.SetDataFromTransform(this.transform); SplineMesh.GetCrossSectionShape(out data.CrossSectionVertices, out data.CrossSectionNormals); data.SketchMaterial = new SketchMaterialData(this.meshRenderer.sharedMaterial); return(data); }