Exemplo n.º 1
0
        public void TeqHashInts()
        {
            PrimitiveType p1 = PrimitiveType.Word32;
            PrimitiveType p2 = PrimitiveType.Word32;

            Assert.AreEqual(p1.GetHashCode(), p2.GetHashCode());
        }
Exemplo n.º 2
0
    public void OnDropShapeClick()
    {
        Vector3 shapePosition = Camera.main.transform.position +
                                Camera.main.transform.forward * 0.3f;
        Quaternion shapeRotation = Camera.main.transform.rotation;

        System.Random rnd  = new System.Random();
        PrimitiveType type = (PrimitiveType)rnd.Next(0, 3);

        ShapeInfo shapeInfo = new ShapeInfo();

        shapeInfo.px        = shapePosition.x;
        shapeInfo.py        = shapePosition.y;
        shapeInfo.pz        = shapePosition.z;
        shapeInfo.qx        = shapeRotation.x;
        shapeInfo.qy        = shapeRotation.y;
        shapeInfo.qz        = shapeRotation.z;
        shapeInfo.qw        = shapeRotation.w;
        shapeInfo.shapeType = type.GetHashCode();
        shapeInfoList.Add(shapeInfo);

        GameObject shape = ShapeFromInfo(shapeInfo);

        shapeObjList.Add(shape);
    }
Exemplo n.º 3
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = ArrayDepth;
         hashCode = (hashCode * 397) ^ (ClassName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (PrimitiveType?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Exemplo n.º 4
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (Shader == null ? 0 : Shader.GetHashCode());
         hash = hash * 23 + PrimitiveType.GetHashCode();
         hash = hash * 23 + (Rasterizer == null ? 0 : Rasterizer.GetHashCode());
         hash = hash * 23 + (DepthStencil == null ? 0 : DepthStencil.GetHashCode());
         hash = hash * 23 + (Blend == null ? 0 : Blend.GetHashCode());
         return(hash);
     }
 }
Exemplo n.º 5
0
        public DefaultRenderRequest(
            IRenderContext renderContext,
            RasterizerState rasterizerState,
            BlendState blendState,
            DepthStencilState depthStencilState,
            IEffect effect,
            string techniqueName,
            IEffectParameterSet effectParameterSet,
            VertexBuffer meshVertexBuffer,
            IndexBuffer meshIndexBuffer,
            PrimitiveType primitiveType,
            Matrix[] instances,
            Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers,
            LocalisedBoundingRegion boundingRegion)
        {
#if DEBUG
            GraphicsMetricsProfilerVisualiser.RenderRequestsCreated++;
#endif

            RasterizerState         = rasterizerState;
            BlendState              = blendState;
            DepthStencilState       = depthStencilState;
            Effect                  = effect;
            TechniqueName           = techniqueName;
            EffectParameterSet      = effectParameterSet;
            MeshVertexBuffer        = meshVertexBuffer;
            MeshIndexBuffer         = meshIndexBuffer;
            PrimitiveType           = primitiveType;
            Instances               = instances;
            BoundingRegion          = boundingRegion;
            _computeCombinedBuffers = computeCombinedBuffers;

            // Now that the parameter set has been used in a request, prevent it
            // from being changed.
            EffectParameterSet.Lock(renderContext);

            StateHash =
                RasterizerState.GetHashCode() ^ 397 +
                BlendState.GetHashCode() ^ 397 +
                DepthStencilState.GetHashCode() ^ 397 +
                Effect.GetHashCode() ^ 397 +
                TechniqueName.GetHashCode() ^ 397 +
                EffectParameterSet.GetStateHash() ^ 397 +
                MeshVertexBuffer.GetHashCode() ^ 397 +
                MeshIndexBuffer.GetHashCode() ^ 397 +
                PrimitiveType.GetHashCode() ^ 397;
        }
        public DefaultRenderRequest(
            IRenderContext renderContext,
            RasterizerState rasterizerState,
            BlendState blendState,
            DepthStencilState depthStencilState,
            IEffect effect,
            string techniqueName, 
            IEffectParameterSet effectParameterSet,
            VertexBuffer meshVertexBuffer,
            IndexBuffer meshIndexBuffer,
            PrimitiveType primitiveType,
            Matrix[] instances, 
            Action<List<Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers)
        {
#if DEBUG
            GraphicsMetricsProfilerVisualiser.RenderRequestsCreated++;
#endif

            RasterizerState = rasterizerState;
            BlendState = blendState;
            DepthStencilState = depthStencilState;
            Effect = effect;
            TechniqueName = techniqueName;
            EffectParameterSet = effectParameterSet;
            MeshVertexBuffer = meshVertexBuffer;
            MeshIndexBuffer = meshIndexBuffer;
            PrimitiveType = primitiveType;
            Instances = instances;
            _computeCombinedBuffers = computeCombinedBuffers;

            // Now that the parameter set has been used in a request, prevent it
            // from being changed.
            EffectParameterSet.Lock(renderContext);

            StateHash =
                RasterizerState.GetHashCode() ^ 397 +
                BlendState.GetHashCode() ^ 397 +
                DepthStencilState.GetHashCode() ^ 397 +
                Effect.GetHashCode() ^ 397 +
                TechniqueName.GetHashCode() ^ 397 +
                EffectParameterSet.GetStateHash() ^ 397 +
                MeshVertexBuffer.GetHashCode() ^ 397 +
                MeshIndexBuffer.GetHashCode() ^ 397 +
                PrimitiveType.GetHashCode() ^ 397;
        }
Exemplo n.º 7
0
    //-------------------------------------------------
    // All shape management functions (add shapes, save shapes to metadata etc.
    //-------------------------------------------------

    public void AddShape(Vector3 shapePosition, Quaternion shapeRotation)
    {
        System.Random rnd  = new System.Random();
        PrimitiveType type = (PrimitiveType)rnd.Next(0, 3);

        ShapeInfo shapeInfo = new ShapeInfo();

        shapeInfo.px        = shapePosition.x;
        shapeInfo.py        = shapePosition.y;
        shapeInfo.pz        = shapePosition.z;
        shapeInfo.qx        = shapeRotation.x;
        shapeInfo.qy        = shapeRotation.y;
        shapeInfo.qz        = shapeRotation.z;
        shapeInfo.qw        = shapeRotation.w;
        shapeInfo.shapeType = type.GetHashCode();
        shapeInfoList.Add(shapeInfo);

        GameObject shape = ShapeFromInfo(shapeInfo);

        shapeObjList.Add(shape);
    }
Exemplo n.º 8
0
 public override int GetHashCode() => Type.GetHashCode();
Exemplo n.º 9
0
 public override int GetHashCode()
 {
     return(AdditionalTransform.GetHashCode() + BlendState.GetHashCode() + PrimitiveType.GetHashCode());
 }
Exemplo n.º 10
0
 public override int GetHashCode()
 {
     return(60090847 * PrimitiveType.GetHashCode());
 }
Exemplo n.º 11
0
 public override int GetHashCode()
 {
     return(380380477 * PrimitiveType.GetHashCode());
 }
Exemplo n.º 12
0
 public override int GetHashCode()
 {
     return(primitiveType.GetHashCode());
 }
Exemplo n.º 13
0
 public override int GetHashCode()
 {
     return(ColumnName.GetHashCode()
            ^ PrimitiveType.GetHashCode()
            ^ (DocString != null ? DocString.GetHashCode() : 0));
 }