public Particle(ModelUtility model, float lifeTime)
        {
            mLifeTime = lifeTime; //SETS THE LIFETIME
            mAlive    = true;

            mTimeElasped.Start();
        }
Пример #2
0
        public void SphereMethod(int[] mVAO_IDs, int[] mVBO_IDs, ModelUtility mSphereModelUtility, int vPositionLocation, int vNormalLocation, int vTexCoordsLocation)
        {
            GL.BindVertexArray(mVAO_IDs[3]);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mVBO_IDs[5]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(mSphereModelUtility.Vertices.Length * sizeof(float)), mSphereModelUtility.Vertices, BufferUsageHint.StaticDraw);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVBO_IDs[6]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(mSphereModelUtility.Indices.Length * sizeof(float)), mSphereModelUtility.Indices, BufferUsageHint.StaticDraw);

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mSphereModelUtility.Vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mSphereModelUtility.Indices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            GL.EnableVertexAttribArray(vPositionLocation);
            GL.VertexAttribPointer(vPositionLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0);
            GL.EnableVertexAttribArray(vNormalLocation);
            GL.VertexAttribPointer(vNormalLocation, 3, VertexAttribPointerType.Float, true, 6 * sizeof(float), 3 * sizeof(float));
            GL.EnableVertexAttribArray(vTexCoordsLocation);
            GL.VertexAttribPointer(vTexCoordsLocation, 2, VertexAttribPointerType.Float, false, 6 * sizeof(float), 2 * sizeof(float));

            GL.BindVertexArray(0);
        }
        public void ReadConfig(out ModelDialectRevision dialectRevision)
        {
            // No need to run the case if SMB2_CREATE_APP_INSTANCE_ID is not supported.
            testConfig.CheckCreateContext(CreateContextTypeValue.SMB2_CREATE_APP_INSTANCE_ID);

            dialectRevision = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported);
        }
        //3D
        public Floating_CubeSystem(ModelUtility model, Vector3 EmissionStartPoint, float ZFar, float XRight, float YUp, float lifeTime, float spawnRate, int maxParticle, Material Material)
            : base(model, EmissionStartPoint, ZFar, XRight, YUp, spawnRate, lifeTime, maxParticle)
        {
            mMat = Material;

            timer.Start();
        }
Пример #5
0
        protected override void OnLoad(EventArgs e)
        {
            // Set some GL state
            GL.ClearColor(Color4.SkyBlue);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);

            mShader = new ShaderUtility(@"ACW/Shaders/vPassThrough.vert", @"ACW/Shaders/fLighting.frag");
            GL.UseProgram(mShader.ShaderProgramID);
            int vPositionLocation  = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vNormalLocation    = GL.GetAttribLocation(mShader.ShaderProgramID, "vNormal");
            int vTexCoordsLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vTexCoords");

            GL.GenVertexArrays(mVAO_IDs.Length, mVAO_IDs);
            GL.GenBuffers(mVBO_IDs.Length, mVBO_IDs);

            //ground
            Textures.LoadTexture(mTexture_ID, 0, mShader);
            Ground.GroundMethod(mVAO_IDs, mVBO_IDs, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            //armadillo

            Textures.LoadTexture(mTexture_ID, 1, mShader);
            mArmadilloModelUtility = ModelUtility.LoadModel(@"Utility/Models/model.bin");
            Armadillo.ArmadilloMethod(mVAO_IDs, mVBO_IDs, mArmadilloModelUtility, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            //Cylinder Model

            Textures.LoadTexture(mTexture_ID, 2, mShader);
            mCylinderModelUtility = ModelUtility.LoadModel(@"Utility/Models/cylinder.bin");
            Cylinder.CyclinderMethod(mVAO_IDs, mVBO_IDs, mCylinderModelUtility, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            //Sphere Model

            Textures.LoadTexture(mTexture_ID, 3, mShader);
            mSphereModelUtility = ModelUtility.LoadModel(@"Utility/Models/sphere.bin");
            Sphere.SphereMethod(mVAO_IDs, mVBO_IDs, mSphereModelUtility, vPositionLocation, vNormalLocation, vTexCoordsLocation);

            // End

            mView = Matrix4.CreateTranslation(0.0f, -1.5f, 0.0f);
            int uView = GL.GetUniformLocation(mShader.ShaderProgramID, "uView");

            GL.UniformMatrix4(uView, true, ref mView);

            mGroundModel = Matrix4.CreateTranslation(0.0f, 0.0f, -5.0f);

            mArmadilloModel = Matrix4.CreateTranslation(0.0f, 3.0f, -5.0f); //sets armadillo position
            Vector3 t                  = mArmadilloModel.ExtractTranslation();
            Matrix4 translation        = Matrix4.CreateTranslation(t);
            Matrix4 inverseTranslation = Matrix4.CreateTranslation(-t);

            mArmadilloModel = mArmadilloModel * inverseTranslation * Matrix4.CreateRotationY(-1.7f) * translation; // rotates armadillo

            mCylinderModel = Matrix4.CreateTranslation(0.0f, 1.0f, -5.0f);                                         //sets cylidner position

            mSphereModel = Matrix4.CreateTranslation(5.0f, currentPosition, -3.0f);                                //sets Sphere position

            base.OnLoad(e);
        }
Пример #6
0
        /// <summary>
        /// GET Hours/TimeSheet
        /// </summary>
        /// <returns>Model</returns>
        public ViewResult TimeSheet()
        {
            ModelUtility modelUtility = new ModelUtility();
            PresenterService presenterService = new PresenterService();
            DefaultTimeSheet defaultTimeSheet = presenterService.GetDefaultTimeSheet(DateTime.Now);
            ViewBag.StartHourList = modelUtility.GetSelectList(defaultTimeSheet.Hour.ToString(), defaultTimeSheet.HourList);
            ViewBag.StartMinuteList = modelUtility.GetSelectList("", defaultTimeSheet.MinuteList);
            ViewBag.StartAmPmList = modelUtility.GetSelectList("", defaultTimeSheet.AmPmList);
            ViewBag.EndHourList = modelUtility.GetSelectList("", defaultTimeSheet.HourList);
            ViewBag.EndMinuteList = modelUtility.GetSelectList("", defaultTimeSheet.MinuteList);
            ViewBag.EndAmPmList = modelUtility.GetSelectList("", defaultTimeSheet.AmPmList);

            TimeSheetModel model = new TimeSheetModel
                                       {
                                           StartHour = defaultTimeSheet.Hour,
                                           StartMinute = 1,
                                           StartAmPm = "AM",
                                           EndHour = defaultTimeSheet.Hour,
                                           EndMinute = 1,
                                           EndAmPm = "AM",
                                           StartDate = DateTime.Today,
                                           EndDate = DateTime.Today,
                                       };

            return View(model);
        }
Пример #7
0
        public void NegotiateRequest(ModelDialectRevision maxSmbVersionClientSupported, SigningFlagType signingFlagType, SigningEnabledType signingEnabledType, SigningRequiredType signingRequiredType)
        {
            testClient = new Smb2FunctionalClient(testConfig.Timeout, testConfig, this.Site);
            testClient.ConnectToServer(testConfig.UnderlyingTransport, testConfig.SutComputerName, testConfig.SutIPAddress);

            DialectRevision[]          dialects    = Smb2Utility.GetDialects(ModelUtility.GetDialectRevision(maxSmbVersionClientSupported));
            Packet_Header_Flags_Values headerFlags = (signingFlagType == SigningFlagType.SignedFlagSet) ? Packet_Header_Flags_Values.FLAGS_SIGNED : Packet_Header_Flags_Values.NONE;

            SigningEnabledType  resSigningEnabledType  = SigningEnabledType.SigningEnabledNotSet;
            SigningRequiredType resSigningRequiredType = SigningRequiredType.SigningRequiredNotSet;
            uint status = testClient.Negotiate(
                headerFlags,
                dialects,
                GetNegotiateSecurityMode(signingEnabledType, signingRequiredType),
                checker: (header, response) =>
            {
                resSigningEnabledType =
                    response.SecurityMode.HasFlag(NEGOTIATE_Response_SecurityMode_Values.NEGOTIATE_SIGNING_ENABLED) ?
                    SigningEnabledType.SigningEnabledSet : SigningEnabledType.SigningEnabledNotSet;
                resSigningRequiredType =
                    response.SecurityMode.HasFlag(NEGOTIATE_Response_SecurityMode_Values.NEGOTIATE_SIGNING_REQUIRED) ?
                    SigningRequiredType.SigningRequiredSet : SigningRequiredType.SigningRequiredNotSet;
            });

            NegotiateResponse((ModelSmb2Status)status, resSigningEnabledType, resSigningRequiredType, signingConfig);
        }
Пример #8
0
        /// <summary>
        /// Method to create the database collection associated with the specified model type using
        /// the current configuration settings.
        /// </summary>
        /// <returns></returns>
        public static async Task <bool> CreateCollectionAsync <T>(IDocumentDBConfiguration configuration)
        {
            string collectionName = ModelUtility.GetPluralizedModelName <T>();

            using (var client = NewDocumentClient(configuration))
            {
                string             collectionsFeed = GetCollectionsFeed(configuration);
                DocumentCollection collection      = client.CreateDocumentCollectionQuery(collectionsFeed)
                                                     .Where(c => c.Id == collectionName)
                                                     .AsEnumerable()
                                                     .FirstOrDefault();
                if (collection == null)
                {
                    collection = await client.CreateDocumentCollectionAsync(
                        collectionsFeed,
                        new DocumentCollection { Id = collectionName });

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Пример #9
0
    void BetweenSelect(float touchpadY)
    {
        textComponent.text = "Between Select " + gameObject.name;
        selected           = true;

        // -.7 to .7 ... scale to 0 - 127
        float velocity = ModelUtility.Remap(touchpadY, -.7f, .7f, 0f, 127f);

        // Data example - 1 62 0 120. 127 127
        List <float> stepperData = new List <float>();

        stepperData.Add(columnStep);
        stepperData.Add(rowPitch);
        stepperData.Add(velocity); // velocity
        stepperData.Add(120f);     // duration
        stepperData.Add(127f);     // extra 1
        stepperData.Add(127f);     // extra 2
        ModelStepperManager.Instance.SendMessage("UpdateColumnModel", stepperData);
        OSCHandler.Instance.SendMessageToClient("myClient", "/stepperData", stepperData);

        // 0 - 127 ... scale to 0 - 1
        float greenValue = ModelUtility.Remap(velocity, 0f, 127f, 0.5f, 1f);

        Color green = Color.green;

        green.a = greenValue;
        gameObject.GetComponent <Renderer>().material.color = green;
    }
Пример #10
0
        /// <summary>
        /// モデルの読み込み
        /// </summary>
        private void InputFileNameButton_Click(object sender, RoutedEventArgs e)
        {
            UpdatePhase(ExecutePhase.DataReading);

            OpenFileDialog ofd = new OpenFileDialog
            {
                InitialDirectory = "Resources",
                FileName         = "",
                DefaultExt       = "*.*",
                Filter           = "CSVファイル|*.csv",
            };

            var ret = ofd.ShowDialog();

            if (ret.HasValue && ret.Value)
            {
                var filePath = ofd.FileName;
                InputFileNameLabel.Content = ofd.SafeFileName;

                var datas = CsvUtility.ReadCsv(filePath, true);

                _cityList.Clear();
                _cityList = ModelUtility.GetAllCitiesModel(datas).ToList();
            }

            DrawCities();

            UpdatePhase(ExecutePhase.Setting);
        }
        public TemporaryParticleSystem(ModelUtility model, Vector3 EmissionStartPoint, float ZFar, float XRight, float YUp, float SpawnRate, float LifeTime, int maxParticles, float S_LifeTime) :
            base(model, EmissionStartPoint, SpawnRate, LifeTime, maxParticles)
        {
            S_LifeTime = mSystemLifeTime;

            Init_Timer();
        }
Пример #12
0
        public ActionResult SignupCC(CreditCardBillingModel model)
        {
            if (ModelState.IsValid)
            {
                //Attempt to register the user
                OrderData orderData = this.AddOrder(model);
                if (this._orderCreated)
                {
                    //FormsService.SignIn(model.UserName, false /* createPersistentCookie */);
                    //return RedirectToRoute(new { action = "Finish", orderId = orderData.OrderId });
                    //Response.Redirect("~/legacy/nmi.asp?OrderId=" + orderData.OrderId.ToString());
                    Response.Redirect("~/legacy/linkback.asp?OrderNumber=" + orderData.OrderId.ToString() + "&ResponseCode=A");
                    //string actionName = "JumpToCartContainer";
                    //return RedirectToRoute(new { action = actionName, memberId = orderData.MemberId, orderId = orderData.OrderId });
                }
                else
                {
                    ModelState.AddModelError("", "Could not create order");
                }
            }

            CreditCardBillingModel billingModel = GetCreditCardBillingModel(model.MemberId);
            ModelUtility           modelUtility = new ModelUtility();

            ViewData["StateList"]   = modelUtility.GetStateSelectList(billingModel.StateCode);
            ViewData["CountryList"] = modelUtility.GetCountrySelectList(billingModel.CountryCode);
            return(View(billingModel));
        }
        public static void SetupConnection(ModelDialectRevision maxSmbVersionClientSupported, ClientSupportsEncryptionType clientSupportsEncryptionType)
        {
            Condition.IsTrue(state == ModelState.Initialized);
            Condition.IsNull(request);

            negotiateDialect = ModelHelper.DetermineNegotiateDialect(maxSmbVersionClientSupported, config.MaxSmbVersionSupported);

            Connection_ClientCapabilities_SMB2_GLOBAL_CAP_ENCRYPTION = (clientSupportsEncryptionType == ClientSupportsEncryptionType.ClientSupportsEncryption) ? true : false;

            if (ModelUtility.IsSmb3xFamily(negotiateDialect) && clientSupportsEncryptionType == ClientSupportsEncryptionType.ClientSupportsEncryption)
            {
                ModelHelper.Log(LogType.Requirement,
                                "3.3.5.4: The Capabilities field MUST be set to a combination of zero or more of the following bit values, as specified in section 2.2.4:");
                ModelHelper.Log(LogType.Requirement,
                                "\tSMB2_GLOBAL_CAP_ENCRYPTION if Connection.Dialect belongs to the SMB 3.x dialect family, the server supports encryption, " +
                                "and SMB2_GLOBAL_CAP_ENCRYPTION is set in the Capabilities field of the request.");

                // Encrpytion Model only applies to server that supports encryption.
                ModelHelper.Log(LogType.TestInfo,
                                "Connection.Dialect is {0}, the server supports encryption and SMB2_GLOBAL_CAP_ENCRYPTION is set. " +
                                "So SMB2_GLOBAL_CAP_ENCRYPTION bit is set in Capabilities field.", negotiateDialect);
                Connection_ServerCapabilities_SMB2_GLOBAL_CAP_ENCRYPTION = true;
            }

            state = ModelState.Connected;
        }
Пример #14
0
 private void RunBtn_Click(object sender, RoutedEventArgs e)
 {
     // Get BaseModel
     var(success, baseModel) = FileUtility.GetBaseModel(fileName);
     if (success)
     {
         //hide window
         this.Hide();
         Thread.Sleep(500);
         // num of iterations
         numIterations = Convert.ToInt32(NumIterationTxt.Text);
         // get fill type
         fillType = GetFillType(RunningTypeCB.SelectedIndex);
         // Extract PreProcess, Run, Process, PostProcessing Models
         var(PreProcess, Run, Process, PostProcessing, processName) = ModelUtility.ConvertBaseModelToActionModels(baseModel);
         RunReport runReport = new RunReport(new GenericRunner(PreProcess, Run, Process, PostProcessing, processName), fillType);
         runReport.Run(ClickEngine.Engine.SeedWork.FileUtility.GetUniqueTxtFileName(nameof(GenericRunner)), numIterations);
         this.Show();
         MessageBox.Show("The process is successfully finished.");
     }
     else
     {
         this.Show();
         MessageBox.Show($"Cannot read the model {fileName}");
     }
     SystemInteractions.ShowHideWindow(SystemInteractions.WindowHideShow.SHOW);
 }
Пример #15
0
    public void SliderChanged(float sliderValue)
    {
        // 0 to 1 ... scale to 0 - 127
        float sliderData = ModelUtility.Remap(sliderValue, 0f, 1f, 0f, 127f);

        OSCHandler.Instance.SendMessageToClient("myClient", "/sliderData", sliderData);
    }
Пример #16
0
    public Error Insert(AccountModel.Account _account)
    {
        string query = string.Format("INSERT INTO Account (UUID, Profile, CreatedAt, UpdatedAt) VALUES ('{0}', '{1}', '{2}', '{3}')",
                                     _account.accountID, _account.profile, ModelUtility.NewUtcNow(), ModelUtility.NewUtcNow());

        return(SQLiteUtility.Execute(connection, query));
    }
        private void InitializeAlternativeChannel(
            Guid clientGuid,
            uint treeId,
            bool isClientSupportPersistent = true)
        {
            Site.Assume.IsNull(smb2ClientAlternativeChannel, "Expect smb2ClientAlternativeChannel is NULL.");

            testConfig.CheckCapabilities(NEGOTIATE_Response_Capabilities_Values.GLOBAL_CAP_MULTI_CHANNEL);

            smb2ClientAlternativeChannel = new Smb2FunctionalClient(testConfig.Timeout, testConfig, Site);
            smb2ClientAlternativeChannel.Smb2Client.LeaseBreakNotificationReceived  += new Action <Packet_Header, LEASE_BREAK_Notification_Packet>(OnLeaseBreakNotificationReceived);
            smb2ClientAlternativeChannel.Smb2Client.OplockBreakNotificationReceived += new Action <Packet_Header, OPLOCK_BREAK_Notification_Packet>(OnOplockBreakNotificationReceived);
            smb2ClientAlternativeChannel.ConnectToServer(testConfig.UnderlyingTransport, serverNameMainChannel, serverIpMainChannel);
            uint status;

            #region Negotiate

            Capabilities_Values capability = isClientSupportPersistent ?
                                             Capabilities_Values.GLOBAL_CAP_DFS | Capabilities_Values.GLOBAL_CAP_DIRECTORY_LEASING | Capabilities_Values.GLOBAL_CAP_LARGE_MTU |
                                             Capabilities_Values.GLOBAL_CAP_LEASING | Capabilities_Values.GLOBAL_CAP_MULTI_CHANNEL | Capabilities_Values.GLOBAL_CAP_PERSISTENT_HANDLES |
                                             Capabilities_Values.GLOBAL_CAP_ENCRYPTION :
                                             Capabilities_Values.GLOBAL_CAP_DFS | Capabilities_Values.GLOBAL_CAP_DIRECTORY_LEASING | Capabilities_Values.GLOBAL_CAP_LARGE_MTU |
                                             Capabilities_Values.GLOBAL_CAP_LEASING | Capabilities_Values.GLOBAL_CAP_MULTI_CHANNEL | Capabilities_Values.GLOBAL_CAP_ENCRYPTION;
            NEGOTIATE_Response?negotiateResponse = null;
            status = smb2ClientAlternativeChannel.Negotiate(
                new DialectRevision[] { dialectMainChannel },
                testConfig.IsSMB1NegotiateEnabled,
                capabilityValue: ModelUtility.IsSmb3xFamily(dialectMainChannel) ? capability : Capabilities_Values.NONE,
                clientGuid: dialectMainChannel == DialectRevision.Smb2002 ? Guid.Empty : clientGuid,
                checker: (header, response) =>
            {
                Site.Assert.AreEqual(
                    Smb2Status.STATUS_SUCCESS,
                    header.Status,
                    "{0} should succeed", header.Command);

                negotiateResponse = response;
            });
            Site.Assert.AreEqual(
                dialectMainChannel,
                negotiateResponse.Value.DialectRevision,
                "DialectRevision {0} is expected", dialectMainChannel);

            #endregion

            #region SESSION_SETUP
            status = smb2ClientAlternativeChannel.AlternativeChannelSessionSetup(
                smb2ClientMainChannel,
                testConfig.DefaultSecurityPackage,
                principleNameMainChannel,
                testConfig.AccountCredential,
                testConfig.UseServerGssToken);

            Site.Log.Add(
                LogEntryKind.Debug,
                "Global encryption disabled");

            #endregion
        }
        //POINT

        public ParticleSystem(ModelUtility model, Vector3 EmissionStartPoint, float SpawnRate, float LifeTime, int maxParticles)
        {
            mEmitterPosition   = EmissionStartPoint;
            mSpawnTime         = SpawnRate;
            mMaxParticles      = maxParticles;
            mModel             = model;
            mParticle_LifeTime = LifeTime;
        }
 public SplashParticle(ModelUtility model, float lifeTime, Material Mat, Vector3 velocity, Vector3 scale, Vector3 position) : base(model, lifeTime)
 {
     mModel    = model;
     mMaterial = Mat;
     mScale    = scale;
     mPosition = position;
     mVelocity = velocity;
 }
 public Splash_System(ModelUtility model, Vector3 EmissionStartPoint, float zFar, float xRight, float SpawnRate, float LifeTime, int maxParticles, float S_LifeTime, Vector3 velocity, Vector3 normal, float Angle, Material mat)
     : base(model, EmissionStartPoint, zFar, xRight, SpawnRate, LifeTime, maxParticles, S_LifeTime)
 {
     mVelocity    = velocity;
     mCutOffAngle = Angle;
     mMaterial    = mat;
     mNormal      = normal;
 }
Пример #21
0
        protected override void OnLoad(EventArgs e)
        {
            // Set some GL state
            GL.ClearColor(Color4.DodgerBlue);
            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);


            mModel  = ModelUtility.LoadModel(@"Utility/Models/lab22model.sjg");
            mShader = new ShaderUtility(@"Lab2/Shaders/vLab22.vert", @"Lab2/Shaders/fSimple.frag");
            GL.UseProgram(mShader.ShaderProgramID);

            mView = Matrix4.CreateTranslation(0, 0, -2);
            int uView = GL.GetUniformLocation(mShader.ShaderProgramID, "uView");

            GL.UniformMatrix4(uView, true, ref mView);

            int     uProjectionLocation = GL.GetUniformLocation(mShader.ShaderProgramID, "uProjection");
            Matrix4 projection          = Matrix4.CreateOrthographic(10, 10, -1, 1);

            GL.UniformMatrix4(uProjectionLocation, true, ref projection);

            int vPositionLocation = GL.GetAttribLocation(mShader.ShaderProgramID, "vPosition");
            int vColourLocation   = GL.GetAttribLocation(mShader.ShaderProgramID, "vColour");

            mVAO_ID = GL.GenVertexArray();
            GL.GenBuffers(mVBO_IDs.Length, mVBO_IDs);

            GL.BindVertexArray(mVAO_ID);
            GL.BindBuffer(BufferTarget.ArrayBuffer, mVBO_IDs[0]);
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(mModel.Vertices.Length * sizeof(float)), mModel.Vertices, BufferUsageHint.StaticDraw);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, mVBO_IDs[1]);
            GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(mModel.Indices.Length * sizeof(float)), mModel.Indices, BufferUsageHint.StaticDraw);

            int size;

            GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mModel.Vertices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Vertex data not loaded onto graphics card correctly");
            }

            GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);
            if (mModel.Indices.Length * sizeof(float) != size)
            {
                throw new ApplicationException("Index data not loaded onto graphics card correctly");
            }

            GL.EnableVertexAttribArray(vPositionLocation);
            GL.VertexAttribPointer(vPositionLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0);
            GL.EnableVertexAttribArray(vColourLocation);
            GL.VertexAttribPointer(vColourLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 3 * sizeof(float));

            GL.BindVertexArray(0);

            base.OnLoad(e);
        }
Пример #22
0
        public async Task <bool> DeleteAsync(string id)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                var resultCount = await connection.ExecuteAsync($"delete {ModelUtility.GetPluralizedModelName<T>()} where id = @Id", new { Id = id });

                return(resultCount == 1);
            }
        }
Пример #23
0
 /// <summary>
 /// Recipe description.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(String.Format(
                "{0} ({1} mins prep time, serves {2})",
                this.Name,
                this.PreparationMinutes,
                ModelUtility.GetNumericDisplay(this.Servings))
            .Trim());
 }
Пример #24
0
        public async Task <T> GetAsync(string id)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                var result = await connection.QueryAsync <T>($"select * from {ModelUtility.GetPluralizedModelName<T>()} where id = @Id", new { Id = id });

                return(result.FirstOrDefault());
            }
        }
Пример #25
0
        /// <summary>
        /// Loads the models into the scene
        /// </summary>
        /// <param name="uModel"></param>
        /// <param name="model"> Model being loaded </param>
        /// <param name="modelUtility"></param>
        /// <param name="VAO"></param>
        private void RenderModel(int uModel, Matrix4 model, ModelUtility modelUtility, int VAO)
        {
            Matrix4 m = model * mGroundModel;

            uModel = GL.GetUniformLocation(mShader.ShaderProgramID, "uModel");
            GL.UniformMatrix4(uModel, true, ref m);

            GL.BindVertexArray(VAO);
            GL.DrawElements(PrimitiveType.Triangles, modelUtility.Indices.Length, DrawElementsType.UnsignedInt, 0);
        }
Пример #26
0
        public ActionResult ModelPath(ModelFile model)
        {
            var path = ModelUtility.GetModelPath(model);

            if (String.IsNullOrEmpty(path))
            {
                path = "模型不存在或正在转换中...";
            }
            return(Json(path, "text/plain", JsonRequestBehavior.AllowGet));
        }
Пример #27
0
    void TouchpadUpdate(SteamVR_Controller.Device Controller)
    {
        Vector2 touch   = Controller.GetAxis();
        float   degrees = FindDegree(touch.x, -touch.y);

        circleImage.fillAmount = degrees / 360f;
        // 0 to 1 ... scale to 0 - 127
        float radialData = ModelUtility.Remap(degrees / 360f, 0f, 1f, 127f, 0f);

        OSCHandler.Instance.SendMessageToClient("myClient", "/radialData", radialData);
    }
        public void ReadConfig(out OplockConfig c)
        {
            c = new OplockConfig
            {
                Platform = testConfig.Platform,
                MaxSmbVersionSupported = ModelUtility.GetModelDialectRevision(testConfig.MaxSmbVersionSupported)
            };

            oplockConfig = c;
            Site.Log.Add(LogEntryKind.Debug, oplockConfig.ToString());
        }
Пример #29
0
        private bool HasModel(ModelFile model)
        {
            var res  = false;
            var path = ModelUtility.GetModelPath(model);

            if (!String.IsNullOrEmpty(path))
            {
                res = true;
            }
            return(res);
        }
Пример #30
0
        public void BuildVisualScriptingAssemblyFromAllSourceFiles(string outputDirectory)
        {
            // check if output folder exists
            Directory.CreateDirectory(ModelUtility.GetCompileScriptsOutputDirectory());
            Directory.CreateDirectory(outputDirectory);

            var scriptSourcePath = ModelUtility.GetCompileScriptsOutputDirectory();
            var sourceFiles      = Directory.GetFiles(scriptSourcePath);

            if (sourceFiles.Length == 0)
            {
                OnBuildFinished(string.Empty, new CompilerMessage[] { });
                return;
            }

            // use build pipeline to generate assembly
            var assemblyOutputPath = Path.Combine(outputDirectory, "VisualScriptingAssembly-CSharp.dll");

            m_AssemblyBuilder = new AssemblyBuilder(assemblyOutputPath, sourceFiles);
            var defaultReferences = new HashSet <string>(m_AssemblyBuilder.defaultReferences);
            var assemblies        = (from domainAssembly in AppDomain.CurrentDomain.GetAssemblies()
                                     where !domainAssembly.IsDynamic &&
                                     domainAssembly.Location != "" &&
                                     ((domainAssembly.Location.Contains("UnityEngine") && !domainAssembly.Location.Contains("Module.dll")) ||
                                      domainAssembly.Location.Contains("Unity.GraphTools.Foundation.dll")) &&
                                     !domainAssembly.Location.Contains("Tests") &&
                                     !defaultReferences.Contains(domainAssembly.Location)
                                     select domainAssembly).ToArray();

            HashSet <string> additionalReferences = new HashSet <string>();

            foreach (var assembly in assemblies)
            {
                additionalReferences.Add(assembly.Location);
            }

            foreach (var defaultReference in k_DefaultReferencesPaths)
            {
                if (File.Exists(defaultReference))
                {
                    additionalReferences.Add(defaultReference);
                }
            }

            m_AssemblyBuilder.additionalReferences = additionalReferences.ToArray();

            m_AssemblyBuilder.buildFinished += OnBuildFinished;
            var result = m_AssemblyBuilder.Build();

            if (result == false)
            {
                Debug.LogError("CodeGenCompilation failed to build assembly.");
            }
        }
Пример #31
0
        private void PopulateLists(RegisterModel model)
        {
            ModelUtility modelUtility = new ModelUtility();

            ViewData["GenderList"]      = modelUtility.GetGenderSelectList(model.Gender.ToString());
            ViewData["SmokerList"]      = modelUtility.GetSmokerSelectList(model.IsSmoker.ToString());
            ViewData["StateList"]       = modelUtility.GetStateSelectList(model.StateCode);
            ViewData["CountryList"]     = modelUtility.GetCountrySelectList(model.CountryCode);
            ViewData["ContactByList"]   = modelUtility.GetContactBySelectList(model.ContactBy.ToString());
            ViewData["CitizenshipList"] = modelUtility.GetCitizenshipSelectList(model.Citizenship.ToString());
        }