/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="modelData">Document data.</param>
        public ViewModelStore(ModelData modelData)
        {
            this.viewModelEventManager = new ViewModelEventManager();
            this.modelData = modelData;

            HookUpEvents();
        }
Example #2
0
    static SalesOrderReport()
    {
        model = new ModelData();
        orders = model.GetOrders();
        sales = model.GetSalesStatus(orders);

    }
Example #3
0
        public override void Convert(Apoc3D.Vfs.ResourceLocation source, Apoc3D.Vfs.ResourceLocation dest)
        {
            ModelData mdlData = new ModelData();
            //Model model = new Model(new ResourceHandle<ModelData>(null, true));


        }
        protected override void Load(string fileName, bool isReload)
        {
            MetaModel.BaseGlobalDirectory = MetaModelLibraryBase.GetBaseDirectory(fileName);
            LoadVModell(fileName, isReload);

            MetaModel model = this.RootElement as MetaModel;
            model.IsTopMost = true;

            // set locks to imported libraries
            SetLocksToImportedLibraries(model);
            
            // create model data, store and view model
            ModelData = new ModelData(model);
            ViewModelStore = new ViewModelStore(ModelData);
            ViewModel = new MainSurfaceViewModel(ViewModelStore);

            // register known windows
            try
            {
                IUIVisualizerService popupVisualizer = ViewModel.GlobalServiceProvider.Resolve<IUIVisualizerService>();
                popupVisualizer.Register("TargetSelectorForm", typeof(TargetSelectorForm));
                popupVisualizer.Register("CategorizedSelectionPopup", typeof(CategorizedSelectionPopup));
                popupVisualizer.Register("DiagramClassTemplateSelector", typeof(DiagramClassTemplateSelector));
                popupVisualizer.Register("DataTemplatePresetsPopup", typeof(DataTemplatePresetsPopup));
                popupVisualizer.Register("OptimizationControl", typeof(OptimizationControl));
            }
            catch { }
        }
    public int Add(ModelData modelData, bool transparent, int texture, float centerX, float centerY, float centerZ, float radius)
    {
        int id;
        if (emptyCount > 0)
        {
            id = empty[emptyCount - 1];
            emptyCount--;
        }
        else
        {
            id = modelsCount;
            modelsCount++;
        }

        Model model = game.platform.CreateModel(modelData);

        ListInfo li = models[id];
        li.indicescount = modelData.GetIndicesCount();
        li.centerX = centerX;
        li.centerY = centerY;
        li.centerZ = centerZ;
        li.radius = radius;
        li.transparent = transparent;
        li.empty = false;
        li.texture = GetTextureId(texture);
        li.model = model;

        return id;
    }
Example #6
0
    public void BuildFace(ModelData data, Vector3 start, Vector3 offset1, Vector3 offset2)
    {
        int index = data.verts.Count;

        Vector3 scale = GetScale();
        start.Scale(scale);
        offset1.Scale(scale);
        offset2.Scale(scale);

        if (IsCentered())
        {
            Vector3 o = data.offset;
            o.Scale(scale);
            start -= o;
        }

        data.verts.Add(start);
        data.verts.Add(start + offset1);
        data.verts.Add(start + offset2);
        data.verts.Add(start + offset1 + offset2);

        data.tris.Add(index + 0);
        data.tris.Add(index + 1);
        data.tris.Add(index + 2);
        data.tris.Add(index + 3);
        data.tris.Add(index + 2);
        data.tris.Add(index + 1);
    }
		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>   Gets the model data from the tag. </summary>
		///
		/// <param name="tagIndex">     The parent tag index. </param>
		/// <param name="tagManager">   The tags' manager. </param>
		///
		/// <returns>   The model data. </returns>
		private ModelData GetModelData(TagIndexBase tagIndex, BlamLib.Managers.TagManager tagManager)
		{
			var data = new ModelData();

			data.CollectData(tagIndex, tagManager);

			return data;
		}
Example #8
0
 public PointsDummy()
 {
     _modelData1 = new ModelData();
     _modelData2 = new ModelData();
     _modelData3 = new ModelData();
     _modelData4 = new ModelData();
     _modelData5 = new ModelData();
 }
        public BuildingBlocks(AnvilWorld world, ModelData md, BuildingType buildingType)
        {
            BlockManager bm = world.GetBlockManager();
            ModelDataModel mdm = md.GetModelByTypeId((int)buildingType);

            if (mdm == null)
            {
                // This can happen until we have models for everything in the config file
                Height = 0;
                GroundLevelOffset = 0;
                return;
            }

            GroundLevelOffset = mdm.GroundLevelOffset;

            IntVector3 corner1 = new IntVector3();
            corner1.X = mdm.Corner1[0].x;
            corner1.Y = mdm.Corner1[0].y;
            corner1.Z = mdm.Corner1[0].z;

            IntVector3 corner2 = new IntVector3();
            corner2.X = mdm.Corner2[0].x;
            corner2.Y = mdm.Corner2[0].y;
            corner2.Z = mdm.Corner2[0].z;

            // Handle rotation
            /*
                * Block entities aren't drawing right.  We're flipping the Z-axis here which might be the cause..
                *
            blocks = new AlphaBlock[Math.Abs(corner1.X - corner2.X) + 1, Math.Abs(corner1.Y - corner2.Y) + 1, Math.Abs(corner1.Z - corner2.Z) + 1];

            for (int x = corner1.X; x <= corner2.X; x++)
            {
                for (int y = corner1.Y; y <= corner2.Y; y++)
                {
                    for (int z = 0; z <= Math.Abs(corner2.Z - corner1.Z); z++)
                    {
                        blocks[x - corner1.X, y - corner1.Y, z] = bm.GetBlock(x, y, corner2.Z - z);
                    }
                }
            }
            */

            blocks = new AlphaBlock[Math.Abs(corner1.X - corner2.X) + 1, Math.Abs(corner1.Y - corner2.Y) + 1, Math.Abs(corner1.Z - corner2.Z) + 1];

            for (int x = corner1.X; x <= corner2.X; x++)
            {
                for (int y = corner1.Y; y <= corner2.Y; y++)
                {
                    for (int z = corner1.Z; z <= corner2.Z; z++)
                    {
                        blocks[x - corner1.X, y - corner1.Y, z - corner1.Z] = bm.GetBlock(x, y, z);
                    }
                }
            }

            Height = Math.Abs(corner1.Y - corner2.Y) + 1;
        }
    public static ModelData CreateModelData(Transform model, List<Vector3> controlPoints, List<RotationPoint> rotationPoints, List<List<Vector3>> detailLoaPoints, int strength)
    {
        ModelData modelData = new ModelData();
        modelData.model = GenerateNode(model);
        //PrintAllNodes(modelData.model, "-");
        foreach(Vector3 point in controlPoints)
        {
            modelData.controlPoints.Add(new Vector()
            {
                x = point.x,
                y = point.y,
                z = point.z
            });
        }
        foreach(List<Vector3> layer in detailLoaPoints)
        {
            // Find closest index
            int index;
            FindClosestIntersect.Search (controlPoints, layer [layer.Count / 2], out index);
            AnimationLayer animationLayer = new AnimationLayer()
            {
                startFrame = Math.Min(strength, index + 1),
                numFrames = Math.Max(index - strength, 0)
            };
            foreach(Vector3 point in layer)
            {
                animationLayer.layerPoints.Add(new Vector()
                {
                    x = point.x,
                    y = point.y,
                    z = point.z
                });
            }
            modelData.animationLayers.Add (animationLayer);
        }
        if (rotationPoints != null)
        {
            foreach (RotationPoint rotPoint in rotationPoints)
            {
                swellanimations.RotationPoint nrp = new swellanimations.RotationPoint()
                {
                    Rotation = new Vector()
                    {
                        x = rotPoint.rotation.eulerAngles.x,
                        y = rotPoint.rotation.eulerAngles.y,
                        z = rotPoint.rotation.eulerAngles.z
                    }
                };
                nrp.numFrames = Math.Min(strength, rotPoint.index + 1);
                nrp.startFrame = Math.Max(rotPoint.index - strength, 0);
                modelData.rotationpoints.Add(nrp);
            }
        }

        return modelData;
    }
Example #11
0
		public void CreateBoxWithTheModelData()
		{
			var data = new ModelData(new BoxMesh(Vector3D.One, Color.Red));
			var box = new Box(data, Vector3D.Zero, Quaternion.Identity);
			var mesh = (BoxMesh)box.Get<ModelData>().Meshes[0];
			Assert.AreEqual(Vector3D.Zero, box.Position);
			Assert.AreEqual(Quaternion.Identity, box.Orientation);
			Assert.AreEqual(Color.Red, mesh.Color);
			Assert.AreEqual(Vector3D.One, mesh.Size);
		}
	// Use this for initialization
	void Start () {



		fsSerializer serializer = new fsSerializer();

		List<PairData> memoryCapacity =  new List<PairData> () {
			new PairData(6, 16), 
			new PairData(4, 8)};
		List<PairData> hdd =  new List<PairData> () {
			new PairData(4, 4), 
			new PairData(4, 8)};
		List<PairData> network =  new List<PairData> () {
			new PairData(2, 10), 
			new PairData(2, 1)};
		List<string> gpu =  new List<string> () {
			"GPU A",
			"GPU B",
			"GPU C"};

		ModelData modelData = new ModelData("Test Model",
		                                    true,
		                                    2,
		                                    4,
		                                    1000,
		                                    8,
		                                    1333,
		                                    memoryCapacity,
		                                    "RAID 0",
		                                    hdd,
		                                    network,
		                                    gpu,
		                                    3,
		                                    "Just a test",
		                                    System.DateTime.Now);

		fsData data;
		serializer.TrySerialize(modelData.GetType(), modelData, out data);

		string dataString = fsJsonPrinter.PrettyJson(data);
		data = fsJsonParser.Parse(dataString);

		Debug.Log(dataString);
		Debug.Log(modelData.ToString());

		object deserialized = null;
		serializer.TryDeserialize(data, typeof(ModelData), ref deserialized);

		ModelData newModelData = (ModelData) deserialized;
		Debug.Log(newModelData.ToString());

		PersistanceManager.StoreLocalModelData("Test Model", dataString, null);

	}
 public HandAnimator(ModelData modelData)
 {
     _fingers[0, 0] = modelData.Skeleton.GetBoneIndexByName("Fing11");
     _fingers[0, 1] = modelData.Skeleton.GetBoneIndexByName("Fing12");
     _fingers[1, 0] = modelData.Skeleton.GetBoneIndexByName("Fing21");
     _fingers[1, 1] = modelData.Skeleton.GetBoneIndexByName("Fing22");
     _fingers[2, 0] = modelData.Skeleton.GetBoneIndexByName("Fing31");
     _fingers[2, 1] = modelData.Skeleton.GetBoneIndexByName("Fing32");
     _fingers[3, 0] = modelData.Skeleton.GetBoneIndexByName("Fing41");
     _fingers[3, 1] = modelData.Skeleton.GetBoneIndexByName("Fing42");
     _fingers[4, 0] = modelData.Skeleton.GetBoneIndexByName("Fing51");
     _fingers[4, 1] = modelData.Skeleton.GetBoneIndexByName("Fing52");
 }
Example #14
0
            public static ModelData Create(CacheFile file)
            {
                var ret = new ModelData {Name = ShortenName(file.Name)};
                var rows = file.GetRows();
                ret.Rows = rows;
                if (rows.Count() == 0)
                    throw new InvalidDataException("Cache is empty");
                var singleRow = rows.First();
                ret.SingleRow = singleRow;

                // we need to go through all rows to find the maximum size type of all columns
                var fieldTypes = new FieldType[singleRow.Columns.Count];
                for (int i = 0; i < singleRow.Columns.Count; i++)
                    fieldTypes[i] = singleRow.Columns[i].Type;
                foreach (var row in rows)
                    for (int i = 0; i < row.Columns.Count; i++)
                        if (FieldTypeHelper.GetTypeBits(row.Columns[i].Type) > FieldTypeHelper.GetTypeBits(fieldTypes[i]))
                            fieldTypes[i] = row.Columns[i].Type;
                ret.FieldTypes = fieldTypes;

                // now build the creation query - fields, primary key, indices, cleanup
                var query = new StringBuilder();
                query.AppendLine("DROP TABLE IF EXISTS " + ret.Name + ";");
                query.AppendLine("CREATE TABLE " + ret.Name + " (");

                bool createAutoIncrement = !IsColumnUnique(rows, 0);
                string autoIncrementName = createAutoIncrement ? (singleRow.Columns.Any(c => c.Name == "id") ? "index" : "id") : "";
                if (createAutoIncrement)
                    query.AppendLine(Indention + autoIncrementName + " INT AUTO_INCREMENT,");

                for (int i = 0; i < singleRow.Columns.Count; i++)
                    query.AppendLine(Indention + singleRow.Columns[i].Name + " " + GetSQLType(fieldTypes[i]) + ",");

                if (createAutoIncrement)
                    query.AppendLine(Indention + "PRIMARY KEY (" + autoIncrementName + "),");
                else
                    query.AppendLine(Indention + "PRIMARY KEY (" + singleRow.Columns[0].Name + "),");

                for (int i = 1; i < singleRow.Columns.Count; i++)
                    if (singleRow.Columns[i].Name.EndsWith("ID"))
                        query.AppendLine(Indention + "INDEX " + singleRow.Columns[i].Name + " (" + singleRow.Columns[i].Name + "),");

                if (query[query.Length - 1] == '\n' && query[query.Length - 2] == '\r' && query[query.Length - 3] == ',')
                    query.Remove(query.Length - 3, 1);
                query.AppendLine(");");

                ret.CreationQuery = query.ToString();
                return ret;
            }
		public void UpdateInputsData (ModelData data) {
			nameField.value = data.name;
			isPrivateField.value = data.isPrivate;
			unitSizeField.value = data.unitSize.ToString();
			cpuCoresField.value = data.cpuCoresCount.ToString();
			cpuHzField.value = data.cpuHz.ToString();
			hddBaysField.value= data.hddBaysCount.ToString();
			memorySpeedField.value = data.memorySpeed.ToString();

			UpdateInputFieldsWithPairDatas(memoryCapacityFields, data.memoryCapacity);

			raidField.value = data.raid;

			UpdateInputFieldsWithPairDatas(hddFields, data.hdd);
			UpdateInputFieldsWithPairDatas(networkFields, data.network);
			UpdateInputFieldsWithString(gpuFields, data.gpu);
		}
Example #16
0
        public static void CreateData(ModelData model, StreamWriter writer)
        {
            var insBuilder = new StringBuilder();
            insBuilder.Append("INSERT INTO " + model.Name + " (");
            foreach (var col in model.SingleRow.Columns)
                insBuilder.Append(col.Name + ", ");
            insBuilder.Length -= 2;
            insBuilder.Append(") VALUES (");
            var ins = insBuilder.ToString();

            foreach (var row in model.Rows)
            {
                writer.Write(ins);
                for (int i = 0; i < row.Columns.Count; i++)
                    writer.Write(GetColumnValue(row.Columns[i]) + (i < (row.Columns.Count - 1) ? ", " : ""));
                writer.WriteLine(");");
            }
        }
        public bool ProcessBonesPreTransform(Transform[] boneSpaceTransforms, ModelData modelData,
            ReadOnlyArrayCollection<Transform> boneWorldSpaceTransforms, ReadOnlyArrayCollection<Transform> boneWorldSpaceInverseTransforms)
        {
            for (int i = 0; i < 5; i++)
            {
                Transform transform = Transform.Identity;
                Quaternion.CreateFromYawPitchRoll(_rotations[i], 0, 0, out transform.Rotation);
                transform.Translation.Z = _rotations[i] * 2;

                int parent1 = modelData.Skeleton.BoneData[_fingers[i, 0]].Parent;
                int parent2 = modelData.Skeleton.BoneData[_fingers[i, 1]].Parent;

                boneSpaceTransforms[_fingers[i, 0]] *= transform;
                boneSpaceTransforms[_fingers[i, 1]] *= transform;
            }

            return true;
        }
Example #18
0
        private async Task <List <ModelData> > GetSubDataList(string table, string query, Type dataType)
        {
            var resultData = new List <ModelData>();

            var result = await dbContext.Query(table).Where(query).ToDynamicListAsync();

            var subProps = dataType.GetProperties();

            foreach (var item in result)
            {
                var modelData = new ModelData();
                foreach (var subprop in subProps)
                {
                    modelData.Add(subprop.Name, subprop.GetValue(subprop)?.ToString() ?? "");
                }
                resultData.Add(modelData);
            }
            return(resultData);
        }
Example #19
0
 private static void checkConfig() {
     foreach (var item in ModelDataProcess._dicModelData) {
         ModelData cfg = item.Value;
         for (int i = 0; i < cfg._listAnimations.Count; i++) {
             int animateID = Convert.ToInt32(cfg._listAnimations[i]);
             if (((animateID >= 300 && animateID <= 400) || animateID >= 1000 )
                 && !cfg._dicAnimLoop[animateID.ToString()]) {
                 int index = cfg._listAnimEvents.FindIndex(dd => dd._nAnimID == animateID);
                 if (index >= 0) {
                     if (cfg._listAnimEvents[index]._listEvents.Count > 0) {
                         continue;
                     }
                 } 
                 LogSys.LogError(string.Format("没有关键帧 {0} {1}", cfg._strAssetName, animateID));
             }
         }
         //cfg._listAnimEvents;
     }
 }
        public void expands_the_variable_from_the_context()
        {
            var variable = new StubVariable {
                Value = "bar"
            };

            theRegistry.Variable = variable;

            var data   = new ModelData();
            var values = new Dictionary <string, object>
            {
                { "foo", "barbarbar" }
            };
            var context = new VariableExpanderContext(data, values);

            theExpander.PushContext(context);

            theExpander.Expand("${foo}").ShouldEqual("barbarbar");
        }
        private void populateSubRootMaps(ModelData dto, IEnumerable <ClarifyGenericMapEntry> childMapsForDtoType, ClarifyDataRow parentRecord)
        {
            var childSubRootMaps = childMapsForDtoType.Where(map => map.IsNewRoot());

            foreach (var childMap in childSubRootMaps)
            {
                var subRootGeneric = childMap.ClarifyGeneric;
                var rootKeyField   = childMap.NewRoot.RootKeyField;
                var parentKeyField = childMap.NewRoot.ParentKeyField;

                var childRecord = findRelatedSubRecord(parentRecord, parentKeyField, subRootGeneric, rootKeyField);
                if (childRecord == null)
                {
                    continue;
                }

                populateDTOForGenericRecord(childMap, childRecord, dto);
            }
        }
Example #22
0
        public void UnloadModelData(String modelName)
        {
            try
            {
                ModelData model = dModelDataDict[modelName];
                UnloadSimpleModel(model.Model);

                foreach (string s in model.Textures)
                {
                    UnloadTexture(s);
                }

                dModelDataDict.Remove(modelName);
            }
            catch (KeyNotFoundException e)
            {
                CConsole.Instance.Print("Tried to unload model data " + modelName + ", but data it contained was missing");
            }
        }
    public void DrawWireframeCube_(Game game, float posx, float posy, float posz, float scalex, float scaley, float scalez)
    {
        game.platform.GLLineWidth(2);

        game.platform.BindTexture2d(0);

        if (wireframeCube == null)
        {
            ModelData data = WireframeCube.Get();
            wireframeCube = game.platform.CreateModel(data);
        }
        game.GLPushMatrix();
        game.GLTranslate(posx, posy, posz);
        float half = one / 2;

        game.GLScale(scalex * half, scaley * half, scalez * half);
        game.DrawModel(wireframeCube);
        game.GLPopMatrix();
    }
Example #24
0
        /// <summary>
        /// Loads model data from DFMesh.
        /// </summary>
        /// <param name="id">Key of source mesh.</param>
        /// <param name="model">ModelData out.</param>
        /// <returns>True if successful.</returns>
        private bool LoadModelData(uint id, out ModelData model)
        {
            // Return from cache if present
            if (cacheModelData && modelDataDict.ContainsKey(id))
            {
                model = modelDataDict[id];
                return(true);
            }

            // New model object
            model = new ModelData();

            // Find mesh index
            int index = arch3dFile.GetRecordIndex(id);

            if (index == -1)
            {
                return(false);
            }

            // Get DFMesh
            DFMesh dfMesh = arch3dFile.GetMesh(index);

            if (dfMesh.TotalVertices == 0)
            {
                return(false);
            }

            // Load mesh data
            model.DFMesh = dfMesh;
            LoadVertices(ref model);
            LoadIndices(ref model);
            AddModelTangents(ref model);
            CreateModelBuffers(ref model);

            // Add to cache
            if (cacheModelData)
            {
                modelDataDict.Add(id, model);
            }

            return(true);
        }
Example #25
0
        /**
         * Core function of the algorithm
         * **/
        private void ProgressiveMesh(ModelData data, out int[] map, out int[] permutation)
        {
            PrepareMeshData(data);

            ComputeAllEdgeCollapseCosts();

            //int[] mapArray = new int[m_wedges.Count]; // allocate space
            //int[] permutationArray = new int[m_wedges.Count]; // allocate space
            map         = new int[m_wedges.Count];
            permutation = new int[m_wedges.Count];

            // reduce the object down to nothing
            while (m_wedges.Count > 0)
            {
                // get the next vertex to collapse
                Wedge mn = MinimumCostEdge();

                //if (mn.m_collapse != null)
                //    Debug.Log("collapsing wedge " + mn.ID + " on wedge " + mn.m_collapse.ID + " with cost " + mn.m_cost);

                // keep track of this vertex, i.e. the collapse ordering
                permutation[mn.ID] = m_wedges.Count - 1;
                // keep track of vertex to which we collapse to
                map[m_wedges.Count - 1] = (mn.m_collapse != null) ? mn.m_collapse.ID : -1;
                // Collapse this edge
                Collapse(mn, mn.m_collapse);
                //copy mapped, displaced and deleted vertices to the wedge that will remain alive
                Wedge persistentWedge = WedgeForID(m_initialWedges, mn.ID);
                persistentWedge.m_collapsedVertices = mn.m_collapsedVertices;
                persistentWedge.m_displacedVertices = mn.m_displacedVertices;
                persistentWedge.m_deletedVertices   = mn.m_deletedVertices;
            }

            // reorder the map list based on the collapse ordering
            for (int i = 0; i < map.Length; i++)
            {
                //map[i] = (map[i] == -1) ? 0 : permutation[map[i]];
                if (map[i] >= 0)
                {
                    map[i] = permutation[map[i]];
                }
            }
        }
Example #26
0
    public void InputData()
    {
        Ukulele = false;
        if (nama.field.text == "")
        {
            warning(nama.pesanKosong);
            return;
        }
        else if (!validEmail(email.field.text))
        {
            warning(email.pesanKosong);
            return;
        }
        else if (instansi.field.text == "")
        {
            warning(instansi.pesanKosong);
            return;
        }
        else if (noHp.field.text == "")
        {
            warning(noHp.pesanKosong);
            return;
        }
        else
        {
            ModelData _model = new ModelData();
            _model.id       = KomputerCode + paraUser.Count;
            _model.nama     = nama.field.text;
            _model.email    = email.field.text;
            _model.instansi = instansi.field.text;
            _model.noHp     = noHp.field.text;

            var f = code.tamabhanKaliamat;
            code.field.text = f += _model.id;

            panelMenu.SetActive(false);
            panelCode.SetActive(true);

            paraUser.Add(_model);
            localSave(paraUser);
            paraUser = loadSaveLocal();
        }
    }
Example #27
0
        static void Main(string[] args)
        {
            var folder = "D:/Projects/Logistic";

            var modelData = new ModelData(
                Path.Combine(folder, "AutoDataLayerGenerator/Scripts/Models.sql"),
                Path.Combine(folder, "Logistic.DAL/Models"))
            {
                BaseClass        = "BaseEntity",
                IgnorableColumns = "('Id'),('DateCreated'),('DateModified'),('IsDeleted'),('CreatedBy'),('ModifiedBy')",
                Namespace        = "Logistic.DAL.Models",
                Using            = "using System;"
            };

            var daoData = new DaoData(
                Path.Combine(folder, "AutoDataLayerGenerator/Scripts/DataAccessObjects.sql"),
                Path.Combine(folder, "Logistic.DAL/Dao"))
            {
                BaseClass       = "BaseDao",
                Namespace       = "Logistic.DAL.Dao",
                Using           = "using System.Data;",
                ModelsNamespace = modelData.Namespace
            };

            var generator = new Generator("Data Source=localhost;Initial Catalog=LogisticDatabase;Integrated Security=True;");
            var watch     = new Stopwatch();

            Console.WriteLine(modelData);
            watch.Start();
            generator.GenerateStructure(modelData);
            watch.Stop();
            Console.WriteLine($"Finished with the time: {watch.ElapsedMilliseconds}ms");

            watch.Reset();

            Console.WriteLine(daoData);
            watch.Start();
            generator.GenerateStructure(daoData);
            watch.Stop();
            Console.WriteLine($"Finished with the time: {watch.ElapsedMilliseconds}ms");

            Console.ReadKey();
        }
Example #28
0
        /// <summary>
        /// Execute.
        /// </summary>
        /// <param name="modelData">Model data.</param>
        public void Execute(ModelData modelData)
        {
            // TODO: Change code here

            if (this.selectedModelElement != null)
            {
                ExampleElementViewModel vm = new ExampleElementViewModel(this.vmStore, this.selectedModelElement);

                ExampleWindow wnd = new ExampleWindow();
                wnd.DataContext = vm;
                wnd.ShowDialog();

                vm.Dispose();
            }
            else
            {
                MessageBox.Show("No element selected!");
            }
        }
Example #29
0
    /// <summary>
    /// Adds the data of the given model to the byte array. The internal binary
    /// structure of each model is
    ///  - vertices (3 floats per vertex; vertexCount vertices)
    ///  - indices (triangleIndexCount UInt32)
    ///  - normals (3 floats per normal; normalCount normals)
    /// </summary>
    /// <param name="data">
    /// ModelData of the model, which should be added to the byte array.
    /// </param>
    /// <param name="binaryData">
    /// Target byte array, in which the model will be serialized.
    /// </param>
    /// <param name="binaryDataOffset">
    /// Current index, where data can be written in the array without
    /// overriding previously added data.
    /// </param>
    private void SerializeModel(
        ModelData data, ref byte[] binaryData, ref int binaryDataOffset)
    {
        Mesh mesh = data.mesh;

        /* Binary Structure
         * - vertexCount * 3 float: vertices
         * - triangleIndexCount UInt32: indices
         * - normalCount * float: normals
         */

        // Vertices
        foreach (Vector3 vertex in mesh.vertices)
        {
            // The flip of the x-axis is necessary for streaming the model data
            // into the vlSDK.
            float[] vector = { -vertex.x, vertex.y, -vertex.z };

            Buffer.BlockCopy(
                vector, 0, binaryData, binaryDataOffset, 3 * sizeof(float));
            binaryDataOffset += 3 * sizeof(float);
        }

        // Triangles
        Buffer.BlockCopy(
            mesh.triangles,
            0,
            binaryData,
            binaryDataOffset,
            mesh.triangles.Length * sizeof(UInt32));
        binaryDataOffset += mesh.triangles.Length * sizeof(UInt32);

        // Normals
        foreach (Vector3 normal in mesh.normals)
        {
            float[] vector = { normal.x, normal.y, normal.z };

            Buffer.BlockCopy(
                vector, 0, binaryData, binaryDataOffset, 3 * sizeof(float));
            binaryDataOffset += 3 * sizeof(float);
        }
    }
        public static void WriteModelData(Stream stream, ModelData modelData, Matrix transform)
        {
            EngineBinaryWriter engineBinaryWriter = new EngineBinaryWriter(stream);

            engineBinaryWriter.Write(modelData.Bones.Count);
            foreach (ModelBoneData bone in modelData.Bones)
            {
                engineBinaryWriter.Write(bone.ParentBoneIndex);
                engineBinaryWriter.Write(bone.Name);
                engineBinaryWriter.Write((bone.ParentBoneIndex < 0) ? (bone.Transform * transform) : bone.Transform);
            }
            engineBinaryWriter.Write(modelData.Meshes.Count);
            foreach (ModelMeshData mesh in modelData.Meshes)
            {
                engineBinaryWriter.Write(mesh.ParentBoneIndex);
                engineBinaryWriter.Write(mesh.Name);
                engineBinaryWriter.Write(mesh.MeshParts.Count);
                engineBinaryWriter.Write(mesh.BoundingBox);
                foreach (ModelMeshPartData meshPart in mesh.MeshParts)
                {
                    engineBinaryWriter.Write(meshPart.BuffersDataIndex);
                    engineBinaryWriter.Write(meshPart.StartIndex);
                    engineBinaryWriter.Write(meshPart.IndicesCount);
                    engineBinaryWriter.Write(meshPart.BoundingBox);
                }
            }
            engineBinaryWriter.Write(modelData.Buffers.Count);
            foreach (ModelBuffersData buffer in modelData.Buffers)
            {
                engineBinaryWriter.Write(buffer.VertexDeclaration.VertexElements.Count);
                foreach (VertexElement vertexElement in buffer.VertexDeclaration.VertexElements)
                {
                    engineBinaryWriter.Write(vertexElement.Offset);
                    engineBinaryWriter.Write((int)vertexElement.Format);
                    engineBinaryWriter.Write(vertexElement.Semantic);
                }
                engineBinaryWriter.Write(buffer.Vertices.Length);
                engineBinaryWriter.Write(buffer.Vertices);
                engineBinaryWriter.Write(buffer.Indices.Length);
                engineBinaryWriter.Write(buffer.Indices);
            }
        }
Example #31
0
        public static string Interpolate(ModelData mdl)
        {
            bool showWindow = Config.GetInt("cmdDebugMode") > 0;
            bool stayOpen   = Config.GetInt("cmdDebugMode") == 2;

            Process py = OSUtils.NewProcess(!showWindow);

            string opt = "/C";

            if (stayOpen)
            {
                opt = "/K";
            }

            string alphaStr = (mdl.interp / 100f).ToString("0.00").Replace(",", ".");
            string outPath  = mdl.model1Path.GetParentDir();
            string filename = $"{mdl.model1Name}-{mdl.model2Name}-interp{alphaStr}.pth";

            outPath = Path.Combine(outPath, filename);

            string cmd = $"{opt} cd /D {Paths.esrganPath.Wrap()} & ";

            cmd += $"{EmbeddedPython.GetPyCmd()} interp.py {mdl.model1Path.Wrap()} {mdl.model2Path.Wrap()} {alphaStr} {outPath.Wrap()}";

            py.StartInfo.Arguments = cmd;
            Logger.Log("[ESRGAN Interp] CMD: " + py.StartInfo.Arguments);
            py.Start();
            py.WaitForExit();
            string output = py.StandardOutput.ReadToEnd();
            string err    = py.StandardError.ReadToEnd();

            if (!string.IsNullOrWhiteSpace(err))
            {
                output += "\n" + err;
            }
            Logger.Log("[ESRGAN Interp] Output: " + output);
            if (output.ToLower().Contains("error"))
            {
                throw new Exception("Interpolation Error - Output:\n" + output);
            }
            return(outPath);
        }
Example #32
0
        // GET: Movies/Details/5
        public async Task <IActionResult> Details(int?id, string Name, string Review)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var movie = await _context.Movie
                        .FirstOrDefaultAsync(m => m.Id == id);

            var reviews = _context.User.Where(p => p.Movie == movie).ToList();

            if (Name != null && Review != null)
            {
                _context.Add(new User
                {
                    UserName   = Name,
                    UserReview = Review,
                    ReviewDate = new DateTime(),
                    Movie      = movie
                });


                await _context.SaveChangesAsync();
            }

            if (movie == null)
            {
                return(NotFound());
            }
            if (reviews == null)
            {
                return(NotFound());
            }

            ModelData dtransfer = new ModelData();

            dtransfer.movie   = movie;
            dtransfer.reviews = (ICollection <User>)reviews;

            return(View(dtransfer));
        }
        private string formatMessage(string message, ModelData data)
        {
            var log = new StringBuilder();

            var from   = data.Get <string>("sender");
            var to     = data.Get <string>("recipient");
            var cclist = "";

            if (data.Has("ccList"))
            {
                cclist = data.Get <string>("ccList");
                if (cclist != null)
                {
                    cclist = cclist.Trim();
                }
            }

            var subject = data.Get <string>("subject") ?? "";
            var isoDate = data.Get <DateTime>("timestamp").ToString("s", CultureInfo.InvariantCulture);

            log.Append(HistoryParsers.BEGIN_EMAIL_LOG_HEADER);

            log.AppendLine("{0}: {1}{2}".ToFormat(HistoryBuilderTokens.LOG_EMAIL_DATE, HistoryParsers.BEGIN_ISODATE_HEADER, isoDate));
            const string headerFormat = "{0}: {1}";

            log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_FROM, from));
            log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_TO, to));
            if (cclist.IsNotEmpty())
            {
                log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_CC, cclist));
            }
            if (subject.IsNotEmpty())
            {
                log.AppendLine(headerFormat.ToFormat(HistoryBuilderTokens.LOG_EMAIL_SUBJECT, subject));
            }

            log.Append(HistoryParsers.END_EMAIL_LOG_HEADER);

            log.AppendLine(message);

            return(log.ToString());
        }
Example #34
0
        static void Main()
        {
            CacheManager.LoadAll();

            var targets = new[] { "config.BulkData.bloodlineNames",
                                  "config.BulkData.locationscenes",
                                  "config.BulkData.overviewDefaults",
                                  "config.BulkData.schematicspinmap",
                                  "config.BulkData.overviewDefaultGroups",
                                  "config.BulkData.schematics",
                                  "config.BulkData.schematicstypemap",
                                  "config.BulkData.sounds",
                                  "config.BulkData.invtypematerials",
                                  "config.BulkData.ownericons" };

            foreach (var target in targets)
            {
                var cache = CacheManager.Get(target);
                if (cache == null)
                {
                    Console.WriteLine("Couldn't find cache file for target \"" + target + "\", skipping");
                    continue;
                }

                using (var sw = File.CreateText(cache.FileName + "-" + ShortenName(target) + ".sql"))
                {
                    sw.WriteLine("# Generated by CacheToSQL on " + DateTime.UtcNow + " (UTC)");
                    sw.WriteLine("# Source: " + cache.Name);
                    sw.WriteLine("# File: " + cache.FileName);
                    sw.WriteLine();

                    var modelData = ModelData.Create(cache);
                    sw.WriteLine(modelData.CreationQuery);
                    CreateData(modelData, sw);
                    sw.Flush();
                }
                Console.WriteLine("Processed " + target);
            }

            Console.WriteLine("All done");
            Console.ReadLine();
        }
        public IActionResult Put(Guid id, [FromBody] ModelData value)
        {
            if (!_memCache.Has(id))
            {
                return(NotFound("No such"));
            }

            var validationResult = value.Validate();

            if (!validationResult.IsValid)
            {
                return(BadRequest(validationResult.Errors));
            }

            var previousValue = _memCache[id];

            _memCache[id] = value;

            return(Ok($"{previousValue.ToString()} has been updated to {value.ToString()}"));
        }
Example #36
0
        /// <summary>
        /// Add a standalone model when not combining.
        /// </summary>
        private static GameObject AddStandaloneModel(
            DaggerfallUnity dfUnity,
            ref ModelData modelData,
            Matrix4x4 matrix,
            Transform parent,
            bool overrideStatic = false,
            bool ignoreCollider = false)
        {
            // Determine static flag
            bool isStatic = (dfUnity.Option_SetStaticFlags && !overrideStatic) ? true : false;

            // Add GameObject
            uint       modelID = (uint)modelData.DFMesh.ObjectId;
            GameObject go      = GameObjectHelper.CreateDaggerfallMeshGameObject(modelID, parent, isStatic, null, ignoreCollider);

            go.transform.position = matrix.GetColumn(3);
            go.transform.rotation = GameObjectHelper.QuaternionFromMatrix(matrix);

            return(go);
        }
Example #37
0
 public void GenerateAnimation()
 {
     if (points != null && points.Count > 0)
     {
         currentFrame = 0;
         List <Vector3> line = points;
         if (smoothCurve && points.Count >= 4)
         {
             line = GetCatmullRomCurve(line);
         }
         ModelData modelData = AnimationData.CreateModelData(model, line, rotationPoints,
                                                             detailLoaPoints, framesOfAnimation, mutatorStrength);
         swellanimations.Animation animation = BackendAdapter.GenerateFromBackend(modelData);
         frames = animation.frames.ToArray();
         serializedAnimation = BackendAdapter.serializeNodeArray(frames);
         //Debug.Log("Animation generated");
         ClearMaps();
         FillModelMap(model);
     }
 }
 public static swellanimations.Animation GenerateFromBackend(ModelData modelData)
 {
     ModeldataSerializer serializer = new ModeldataSerializer ();
             MemoryStream memStream = new MemoryStream ();
             serializer.Serialize (memStream, modelData);
             byte[] arr = memStream.ToArray ();
             //Debug.Log (Convert.ToBase64String (arr));
             int size = arr.Length;
             uint outputSize = 0;
             IntPtr retData = generateAnimation (arr, size, ref outputSize);
             var bytes = new byte[(int)outputSize];
             Marshal.Copy (retData, bytes, 0, (int)outputSize);
             //Debug.Log (Convert.ToBase64String (bytes));
             MemoryStream stream = new MemoryStream (bytes, false);
             swellanimations.Animation animation = null;
             animation = (swellanimations.Animation)serializer.Deserialize (stream, null, typeof(swellanimations.Animation));
             memStream.Close ();
             stream.Close ();
             return animation;
 }
        public IActionResult Post([FromBody] ModelData value)
        {
            var validationResult = value.Validate();

            if (!validationResult.IsValid)
            {
                return(BadRequest(validationResult.Errors));
            }

            _memCache.Add(value);

            Log.Information("Adding information about serials");
            Log.Warning("Some warning");
            Log.Error("Here comes an error");


            Log.Information($"This information about serials have been added: {value}");

            return(Ok($"{value.ToString()} has been added"));
        }
Example #40
0
    public static void UnpackModelData()
    {
        currUserData.models = new Dictionary <string, ModelData>();

        //Read text data from user file
        string[] Lines = System.IO.File.ReadAllLines(currUserData.userName + ".txt");
        for (int i = 1; i < Lines.Length; i++)
        {
            //Create ModelData
            string[]  raw_data = Lines[i].Split(';');
            ModelData data     = new ModelData(StringToVector3(raw_data[1]), StringToVector3(raw_data[2]), StringToVector3(raw_data[3]));
            currUserData.models.Add(raw_data[0], data);

            //Spawn Primitive models from prefab button, update with stored data
            GameObject button = GameObject.Find(raw_data[0]);
            button.GetComponentInParent <Button>().onClick.Invoke();
            buttonRef.SelectedPrimitive.transform.SetPositionAndRotation(data.position, Quaternion.Euler(data.rotation));
            buttonRef.SelectedPrimitive.transform.localScale = data.scale;
        }
    }
Example #41
0
    public static void AddVertex(ModelData model, float x, float y, float z, float u, float v, int color)
    {
        if (model.verticesCount >= model.verticesMax)
        {
            int     xyzCount = model.GetXyzCount();
            float[] xyz      = new float[xyzCount * 2];
            for (int i = 0; i < xyzCount; i++)
            {
                xyz[i] = model.xyz[i];
            }

            int     uvCount = model.GetUvCount();
            float[] uv      = new float[uvCount * 2];
            for (int i = 0; i < uvCount; i++)
            {
                uv[i] = model.uv[i];
            }

            int    rgbaCount = model.GetRgbaCount();
            byte[] rgba      = new byte[rgbaCount * 2];
            for (int i = 0; i < rgbaCount; i++)
            {
                rgba[i] = model.rgba[i];
            }

            model.xyz         = xyz;
            model.uv          = uv;
            model.rgba        = rgba;
            model.verticesMax = model.verticesMax * 2;
        }
        model.xyz[model.GetXyzCount() + 0]   = x;
        model.xyz[model.GetXyzCount() + 1]   = y;
        model.xyz[model.GetXyzCount() + 2]   = z;
        model.uv[model.GetUvCount() + 0]     = u;
        model.uv[model.GetUvCount() + 1]     = v;
        model.rgba[model.GetRgbaCount() + 0] = Game.IntToByte(Game.ColorR(color));
        model.rgba[model.GetRgbaCount() + 1] = Game.IntToByte(Game.ColorG(color));
        model.rgba[model.GetRgbaCount() + 2] = Game.IntToByte(Game.ColorB(color));
        model.rgba[model.GetRgbaCount() + 3] = Game.IntToByte(Game.ColorA(color));
        model.verticesCount++;
    }
Example #42
0
        //public static void Main(string[] args)
        //{
        //    BuildWebHost(args).Run();
        //}
        public static void Main(string[] args)
        {
            var webHost = BuildWebHost(args);

            using (var scope = webHost.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    var context = services.GetRequiredService <ApplicationDbContext>();
                    ModelData.Initialize(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "Error while initializing model data");
                }
            }

            webHost.Run();
        }
Example #43
0
        /// <summary>Creates Icon for given 3d Object (or loads from cache)</summary>
        public void CreateIcon(GameObject objPrefab, string id, RawImage targetImage, bool doNotLoadFromCache = false)
        {
            //try get cache
            if (TryLoadFromCache && !doNotLoadFromCache)
            {
                var file = GetIconFileName(id);
                if (File.Exists(file))
                {
                    var texture = LoadTexture(file);
                    targetImage.texture = texture;
                    return;
                }
            }

            //send to render queue
            var data = new ModelData {
                Object = objPrefab, Id = id, TargetImage = targetImage
            };

            queue.Enqueue(data);
        }
Example #44
0
    public static ModelData GetQuadModelData()
    {
        ModelData m = new ModelData();

        float[] xyz = new float[3 * 4];
        for (int i = 0; i < 3 * 4; i++)
        {
            xyz[i] = cubeVertices[i];
        }
        m.setXyz(xyz);
        float[] uv = new float[2 * 4];
        for (int i = 0; i < 2 * 4; i++)
        {
            uv[i] = quadTextureCoords[i];
        }
        m.setUv(uv);
        m.SetVerticesCount(4);
        m.setIndices(quadVertexIndices);
        m.SetIndicesCount(3 * 2);
        return(m);
    }
Example #45
0
        protected ViewModelStore(ModelData modelData, bool bHookUpEvents, ViewModelStore ownedByStore)
        {
            this.customDataBag = new Dictionary <Guid, object>();

            this.viewModelEventManager = new ViewModelEventManager();
            this.externStores          = new List <ViewModelStore>();
            this.ownedByStore          = ownedByStore;
            this.modelData             = modelData;

            if (bHookUpEvents && this == this.TopMostStore)
            {
                this.modelData.StoreCreated   += new EventHandler(StoreCreated);
                this.modelData.StoreDisposing += new EventHandler(StoreDisposing);
                if (modelData.IsStoreInitialized)
                {
                    HookUpEvents();
                }
            }

            this.SpecificViewModelStore = new SpecificViewModelStore();
        }
Example #46
0
    public string StreamJointLocations(Stack <string> JointNames, Stack <Vector3> JointLocations)
    {
        CreateNewModel();
        ModelData CurrentModelData = new ModelData();

        CurrentModelData.JointLocations = new List <JointData>();
        CurrentModelData.frame          = model.ModelDataList.Count;
        while (JointLocations.Count > 0)
        {
            JointData CurrentJointData = new JointData();
            CurrentJointData.JointName = JointNames.Pop();
            CurrentJointData.location  = JointLocations.Pop();
            CurrentModelData.JointLocations.Add(CurrentJointData);
        }

        model.ModelDataList.Add(CurrentModelData);

        string objectToJSON = JsonUtility.ToJson(model, true);

        return(objectToJSON);
    }
        public void ЕслиЗаполняюВсеПоляВФормеРегистрацииПравильно()
        {
            RegisterPersonViewModel model = ModelData.RegPersonSuccess();

            TextToElement("FName", model.UserInfo.FirstName);
            TextToElement("SName", model.UserInfo.SecondName);
            TextToElement("TName", model.UserInfo.MiddleName);
            Click("id", "PassportTODselect");
            Click("xpath", "//option[text()='Паспорт']");
            TextToElement("PassportSeries", model.PassportInfo.Series);
            TextToElement("PassportDate", model.PassportInfo.DateofExtradition);
            TextToElement("PassportValidaty", model.PassportInfo.Validaty);
            TextToElement("PassportNumber", model.PassportInfo.Number);
            TextToElement("PassportIssedBy", model.PassportInfo.IssuedBy);
            TextToElement("Inn", model.UserInfo.Inn);
            Click("id", "Male");
            TextToElement("BirthDay", model.UserInfo.BirthDay);
            TextToElement("MobilePhone", model.ContactInfo.MobilePhone);
            TextToElement("ContactEmail", model.UserInfo.Email);
            Click("id", "SendClick");
        }
Example #48
0
            /// <summary>
            /// Spawn model
            /// </summary>
            /// <param name="sender">MenuItem</param>
            public static unsafe void Spawn(MenuItem sender)
            {
                ModelData md    = sender.Data as ModelData;
                int       model = Function.Call <int>(Hash.GET_HASH_KEY, md.ModelName);

                if (Function.Call <bool>(Hash.IS_MODEL_IN_CDIMAGE, model) && Function.Call <bool>(Hash.IS_MODEL_VALID, model))
                {
                    Function.Call(Hash.REQUEST_MODEL, model, false);
                    while (!Function.Call <bool>(Hash.HAS_MODEL_LOADED, model))
                    {
                        Script.Wait(0);
                    }
                    Vector3 coords        = Function.Call <Vector3>(Hash.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS, Game.Player.Character.Handle, 0f, 3f, -0.3f);
                    float   playerHeading = Function.Call <float>(Hash.GET_ENTITY_HEADING, Game.Player.Character.Handle);
                    int     ped           = Function.Call <int>(Hash.CREATE_PED, model, coords.X, coords.Y, coords.Z, playerHeading + 180, 0, 0, 0, 0);
                    Function.Call((Hash)GlobalConst.CustomHash.SET_PED_VISIBLE, ped, true);
                    Function.Call(Hash.SET_PED_AS_NO_LONGER_NEEDED, &ped);
                    Function.Call(Hash.SET_MODEL_AS_NO_LONGER_NEEDED, model);
                    Utils.ShowNotification(Utils.FormatML(GlobalConst.Message.MODEL_SPAWNED, md.Name));
                }
            }
        protected ViewModelStore(ModelData modelData, bool bHookUpEvents, ViewModelStore ownedByStore)
        {
            this.customDataBag = new Dictionary<Guid, object>();

            this.viewModelEventManager = new ViewModelEventManager();
            this.externStores = new List<ViewModelStore>();
            this.ownedByStore = ownedByStore;
            this.modelData = modelData;

            if (bHookUpEvents && this == this.TopMostStore)
            {

                this.modelData.StoreCreated += new EventHandler(StoreCreated);
                this.modelData.StoreDisposing += new EventHandler(StoreDisposing);
                if (modelData.IsStoreInitialized)
                {   
                HookUpEvents();
            }
            }

            this.SpecificViewModelStore = new SpecificViewModelStore();
        }
		void OnEnable () {
			_originFOV = modelCamera.fieldOfView;

			GameObject modelGo = (GameObject) GameObject.Find(modelName);
			if (modelGo == null) {
				Debug.LogError("Cannot find GameObject named after '" + modelName + "'");
			}
			else {
				_modelTrans = modelGo.transform;
			}

			if (_modelTrans.renderer != null) {
				float width = _modelTrans.renderer.bounds.size.x;
				float height = _modelTrans.renderer.bounds.size.y;

				Debug.Log(width);
				while (width > viewSizeMax || height > viewSizeMax) {
					Vector3 scale = _modelTrans.localScale;
					scale *= 0.5f;
					_modelTrans.localScale = scale;
					width *= 0.5f;
					height *= 0.5f;
				}

				while (width < viewSizeMin || height < viewSizeMin) {
					Vector3 scale = _modelTrans.localScale;
					scale *= 2;
					_modelTrans.localScale = scale;
					width *= 2f;
					height *= 2f;
				}
			}

			if (!_preserveModelData) {
				_modelData = new ModelData();
				_helper = GetComponent<ViewModelInputsHelper>();
				_helper.UpdateInputsData(_modelData);
			}
		}
 public void Draw(Game game, float fov)
 {
     int size = 1000;
     if (game.fancySkysphere)
     {
         //Fancy skysphere with higher resolution
         skymodel = GetSphereModelData2(skymodel, game.platform, size, size, 64, 64, skyPixels, glowPixels, game.sunPositionX, game.sunPositionY, game.sunPositionZ);
     }
     else
     {
         //Normal resolution. Far more FPS
         skymodel = GetSphereModelData2(skymodel, game.platform, size, size, 20, 20, skyPixels, glowPixels, game.sunPositionX, game.sunPositionY, game.sunPositionZ);
     }
     game.Set3dProjection(size * 2, fov);
     game.GLMatrixModeModelView();
     game.GLPushMatrix();
     game.GLTranslate(game.player.position.x,
         game.player.position.y,
         game.player.position.z);
     game.platform.BindTexture2d(0);
     game.DrawModelData(skymodel);
     game.GLPopMatrix();
     game.Set3dProjection(game.zfar(), fov);
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="data">Model data.</param>
 public DocumentEventArgs(ModelData data)
 {
     this.ModelData = data;
 }
Example #53
0
        public ViewModel()
        {
            _data = new ModelData();
            InitData(_data);
            _plotModel = new PlotModel();
            _pointsDummyMass = new PointsDummy();
            _pointsDummySpeed = new PointsDummy();

        }
Example #54
0
        private void InitData(ModelData data)
        {
            data.Height = 10000;
            data.Cy = 3.5;
            data.Ps = 1.167;
            data.MaxNumber = 0.6;
            data.Square = 200;
            data.Mass = 100000;
            data.Ba = 7;
            data.NMax = 1.5;
            data.Time = 100;
            data.L = 300;

            data.KDash = 0.87;
            data.BOne = 1.04;
            data.BTwo = 3.38;
            data.TimeOne = 0.085;
            data.TimeTwo = 0.00005;
        }
Example #55
0
 public static Hashtable serializeToTable(ModelData pModelData)
 {
     var lData = new Hashtable();
     lData["localPosition"] = pModelData.localPosition;
     lData["localRotation"] = pModelData.localRotation;
     lData["localScale"] = pModelData.localScale;
     lData["mesh"] = serializeToTable(pModelData.mesh);
     return lData;
 }
Example #56
0
    public static PaintingModelData createData(GameObject pModelObject, Vector2 pPictureSize)
    {
        var lPaintingMesh = new PaintingModelData();
        var lMeshFilter = pModelObject.transform.Find("Render").GetComponent<MeshFilter>();
        lPaintingMesh.renderMesh.mesh = lMeshFilter.mesh;
        lPaintingMesh.renderMesh.setTransform(lMeshFilter.transform);
        var lMeshCollider = pModelObject.GetComponentsInChildren<MeshCollider>();
        //var lColliderMeshes = new Mesh[lMeshCollider.Length];
        var lColliderMeshes = new ModelData[lMeshCollider.Length];
        for (int i = 0; i < lMeshCollider.Length; ++i)
        {
            lColliderMeshes[i].mesh = lMeshCollider[i].sharedMesh;
            lColliderMeshes[i].setTransform(lMeshCollider[i].transform);
        }
        lPaintingMesh.colliderMeshes = lColliderMeshes;

        lPaintingMesh.pictureSize = pPictureSize;

        return lPaintingMesh;
    }
Example #57
0
        /// <summary>
        /// Add a standalone model when not combining.
        /// </summary>
        private static GameObject AddStandaloneModel(
            DaggerfallUnity dfUnity,
            ref ModelData modelData,
            Matrix4x4 matrix,
            Transform parent,
            bool overrideStatic = false,
            bool ignoreCollider = false)
        {
            // Determine static flag
            bool isStatic = (dfUnity.Option_SetStaticFlags && !overrideStatic) ? true : false;

            // Add GameObject
            uint modelID = (uint)modelData.DFMesh.ObjectId;
            GameObject go = GameObjectHelper.CreateDaggerfallMeshGameObject(modelID, parent, isStatic, null, ignoreCollider);
            go.transform.position = matrix.GetColumn(3);
            go.transform.rotation = GameObjectHelper.QuaternionFromMatrix(matrix);

            return go;
        }
        /// <summary>
        /// Gets static door array from door information stored in model data.
        /// </summary>
        /// <param name="modelData">Model data for doors.</param>
        /// <param name="blockIndex">Block index for RMB doors.</param>
        /// <param name="recordIndex">Record index of interior.</param>
        /// <param name="buildingMatrix">Individual building matrix.</param>
        /// <returns>Array of doors in this model data.</returns>
        public static StaticDoor[] GetStaticDoors(ref ModelData modelData, int blockIndex, int recordIndex, Matrix4x4 buildingMatrix)
        {
            // Exit if no doors
            if (modelData.Doors == null)
                return null;

            // Add door triggers
            StaticDoor[] staticDoors = new StaticDoor[modelData.Doors.Length];
            for (int i = 0; i < modelData.Doors.Length; i++)
            {
                // Get door and diagonal verts
                ModelDoor door = modelData.Doors[i];
                Vector3 v0 = door.Vert0;
                Vector3 v2 = door.Vert2;

                // Get door size
                const float thickness = 0.05f;
                Vector3 size = new Vector3(v2.x - v0.x, v2.y - v0.y, v2.z - v0.z) + door.Normal * thickness;

                // Add door to array
                StaticDoor newDoor = new StaticDoor()
                {
                    buildingMatrix = buildingMatrix,
                    doorType = door.Type,
                    blockIndex = blockIndex,
                    recordIndex = recordIndex,
                    doorIndex = door.Index,
                    centre = (v0 + v2) / 2f,
                    normal = door.Normal,
                    size = size,
                };
                staticDoors[i] = newDoor;
            }

            return staticDoors;
        }
Example #59
0
 internal static void AddIndex(ModelData model, int index)
 {
     if (model.indicesCount >= model.indicesMax)
     {
         int indicesCount = model.indicesCount;
         int[] indices = new int[indicesCount * 2];
         for (int i = 0; i < indicesCount; i++)
         {
             indices[i] = model.indices[i];
         }
         model.indices = indices;
         model.indicesMax = model.indicesMax * 2;
     }
     model.indices[model.indicesCount++] = index;
 }
Example #60
0
    public static void AddVertex(ModelData model, float x, float y, float z, float u, float v, int color)
    {
        if (model.verticesCount >= model.verticesMax)
        {
            int xyzCount = model.GetXyzCount();
            float[] xyz = new float[xyzCount * 2];
            for (int i = 0; i < xyzCount; i++)
            {
                xyz[i] = model.xyz[i];
            }

            int uvCount = model.GetUvCount();
            float[] uv = new float[uvCount * 2];
            for (int i = 0; i < uvCount; i++)
            {
                uv[i] = model.uv[i];
            }

            int rgbaCount = model.GetRgbaCount();
            byte[] rgba = new byte[rgbaCount * 2];
            for (int i = 0; i < rgbaCount; i++)
            {
                rgba[i] = model.rgba[i];
            }

            model.xyz = xyz;
            model.uv = uv;
            model.rgba = rgba;
            model.verticesMax = model.verticesMax * 2;
        }
        model.xyz[model.GetXyzCount() + 0] = x;
        model.xyz[model.GetXyzCount() + 1] = y;
        model.xyz[model.GetXyzCount() + 2] = z;
        model.uv[model.GetUvCount() + 0] = u;
        model.uv[model.GetUvCount() + 1] = v;
        model.rgba[model.GetRgbaCount() + 0] = Game.IntToByte(Game.ColorR(color));
        model.rgba[model.GetRgbaCount() + 1] = Game.IntToByte(Game.ColorG(color));
        model.rgba[model.GetRgbaCount() + 2] = Game.IntToByte(Game.ColorB(color));
        model.rgba[model.GetRgbaCount() + 3] = Game.IntToByte(Game.ColorA(color));
        model.verticesCount++;
    }