예제 #1
0
        public IActionResult Index(cModel _model)
        {
            if (ModelState.IsValid)
            {
                var _message = _context.Messages.FirstOrDefault(m => m.Question == _model.Input.ToUpper());

                if (_message != null)
                {
                    _model.Textarea += "You :" + _model.Input + "\n Chat Bot: " + _message.Answer + "\n";
                }
            }
            return(View(_model));
        }
예제 #2
0
        /****************************************************************************************/
        /// <summary>
        /// Renders the bounding box for debugging purposes.
        /// </summary>
        /// <param name="box">The box to render.</param>
        /// <param name="graphicsDevice">The graphics device to use when rendering.</param>
        /// <param name="view">The current view matrix.</param>
        /// <param name="projection">The current projection matrix.</param>
        /// <param name="color">The color to use drawing the lines of the box.</param>
        public static void Draw(cModel Model, Color color)
        {
            if (DebugBoxes)
            {
                if (effect == null)
                {
                    effect = new BasicEffect(mGraphics.Peek.Device(), null);
                    effect.VertexColorEnabled = true;
                    effect.LightingEnabled = false;
                    vertDecl = new VertexDeclaration(mGraphics.Peek.Device(), VertexPositionColor.VertexElements);
                }

                corners = new Vector3[Model.BoundingBox.GetCorners().Length];
                corners = Model.BoundingBox.GetCorners();

                for (int i = 0; i < 8; i++)
                {
                    verts[i].Position = corners[i] + Model.Position;
                    verts[i].Color = color;
                }

                mGraphics.Peek.Device().VertexDeclaration = vertDecl;

                effect.View = mCamera.Peek.ReturnCamera().View;
                effect.Projection = mCamera.Peek.ReturnCamera().Projection;

                effect.Begin();
                for (int i = 0; i < effect.CurrentTechnique.Passes.Count; i++)
                {
                    effect.CurrentTechnique.Passes[i].Begin();
                    mGraphics.Peek.Device().DrawUserIndexedPrimitives(PrimitiveType.LineList, verts, 0, 8, indices, 0, indices.Length / 2);
                    effect.CurrentTechnique.Passes[i].End();
                }
                effect.End();
            }
        }
예제 #3
0
        public IActionResult Index()
        {
            cModel _model = new cModel();

            return(View(_model));
        }
예제 #4
0
 /****************************************************************************************/
 /// <summary>Sets some Defaults for the Model [TIP: This is generally shared among most models]</summary>
 private static void PrepareModel(ContentManager Content, cModel[] Container, BasicModel Model, string strAssetLocation, Vector3 v3StartingPosition)
 {
     Container[Model._ID].Model = Content.Load<Model>(strAssetLocation);
     Container[Model._ID].Transforms = new Matrix[Container[Model._ID].Model.Bones.Count];
     Container[Model._ID].Position.X = v3StartingPosition.X;
     Container[Model._ID].Position.Y = v3StartingPosition.Y;
     Container[Model._ID].Position.Z = v3StartingPosition.Z == 0.0f ? (0.0f) : (-v3StartingPosition.Z);
     Container[Model._ID].Initialized = true;
 }
예제 #5
0
 /****************************************************************************************/
 /// <summary>Helps setup the MasterEffect on the Model [INFO: This override the built in BasicEffect with our new effect, could of been done through the Content Pipeline]</summary>
 private static void HelpPrepareMasterEffect(cModel[] Container, BasicModel Model)
 {
     foreach (ModelMesh mesh in Container[Model._ID].Model.Meshes)
     {
         foreach (ModelMeshPart part in mesh.MeshParts)
         {
             part.Effect = mEffect.Peek.MasterEffect();
         }
     }
 }
예제 #6
0
        /****************************************************************************************/
        /// <summary>(void) Helper to generate Bounding Boxes.</summary>
        private static void HelpCreateBoundingBox(cModel[] Container, BasicModel Model, Model CopyFromModel)
        {
            /*Create our Bounding Box for this Model*/
            CopyFromModel.CopyAbsoluteBoneTransformsTo(Container[Model._ID].Transforms);

            foreach (ModelMesh mesh in CopyFromModel.Meshes)
            {
                VertexPositionNormalTexture[] vertices =
                new VertexPositionNormalTexture[mesh.VertexBuffer.SizeInBytes / VertexPositionNormalTexture.SizeInBytes];

                mesh.VertexBuffer.GetData<VertexPositionNormalTexture>(vertices);

                Vector3[] vertexs = new Vector3[vertices.Length];

                for (int index = 0; index < vertexs.Length; index++)
                {
                    vertexs[index] = vertices[index].Position;
                }
                Matrix M2 = Container[Model._ID].Transforms[mesh.ParentBone.Index];//<-- Dummy Matrix

                Vector3.Transform(vertexs, ref M2, vertexs);
                Container[Model._ID].BoundingBox = BoundingBox.CreateMerged(Container[Model._ID].BoundingBox, BoundingBox.CreateFromPoints(vertexs));
                Container[Model._ID].PureBoundingBox = Container[Model._ID].BoundingBox;
            }
        }
예제 #7
0
파일: mModel.cs 프로젝트: apolaskey/Inkwell
        /****************************************************************************************/
        /// <summary>Create a valid ID for our Array that we can use for our objects.</summary>
        public int CreateMessageIDAlpha()
        {
            int iTemp = 0; //To store our ID
            bool bListFull = true; //Used for further checking to ensure our list needs to grow
            for (int i = 0; i < AlphaContainer.Length; i++) //Search our list for a disposed message
            {
                if (AlphaContainer[i] == null || AlphaContainer[i].Disposed)
                {
                    iTemp = i;
                    bListFull = false;
                    cModel dummy = new cModel();
                    dummy.AlphaEnabled = true;
                    AlphaContainer[i] = dummy;
                    break; //We found a disposed member lets not waste anymore time here
                }
            }

            if (bListFull)//If we looked through our list and haven't found a disposed message lets increase our list
            {
                cModel dummy = new cModel();
                dummy.AlphaEnabled = true;
                return SyncAdd(dummy, true);

            }
            else
                return iTemp; //Hand out the re-used ID finally
        }
예제 #8
0
파일: mModel.cs 프로젝트: apolaskey/Inkwell
 /****************************************************************************************/
 /// <summary>Synchronize the Model into the AlphaContainer or OpaqueContainer inside of an array for better sort performance.</summary>
 private int SyncAdd(cModel Model, bool bAlphaContainer)
 {
     int temp = 0;
     if (bAlphaContainer)
     {
         cModel[] _safeContainer = new cModel[AlphaContainer.Length];
         AlphaContainer.CopyTo(_safeContainer, 0);
         AlphaContainer = new cModel[_safeContainer.Length + 1]; //<-- TODO: Power of 2 to take advantage of additional CPU ASM
         _safeContainer.CopyTo(AlphaContainer, 0);
         temp = _safeContainer.Length;
         AlphaContainer[temp] = Model;
     }
     else
     {
         cModel[] _safeContainer = new cModel[OpaqueContainer.Length];
         OpaqueContainer.CopyTo(_safeContainer, 0);
         OpaqueContainer = new cModel[_safeContainer.Length + 1]; //<-- TODO: Power of 2 to take advantage of additional CPU ASM
         _safeContainer.CopyTo(OpaqueContainer, 0);
         temp = _safeContainer.Length;
         OpaqueContainer[temp] = Model;
     }
     return temp;
 }