Exemplo n.º 1
0
        public void Execute(int i)
        {
            Vector4 *resultV = (Vector4 *)(((byte *)result) + (i * outputByteStride));
            byte *   off     = input + (i * inputByteStride);

            *resultV = *((Vector4 *)off);
        }
Exemplo n.º 2
0
        public unsafe static int CheckAndWriteTriangle(Vector4 *a, Vector4 *b, Vector4 *c, ref byte *p)
        {
            Vector3  A, B, C;
            Vector3  N;
            Vector3 *pVector3 = (Vector3 *)p;

            if (float.IsNaN(a->W) || float.IsNaN(b->W) || float.IsNaN(c->W))
            {
                return(0);
            }
            else
            {
                A   = *(Vector3 *)a;
                B   = *(Vector3 *)b;
                C   = *(Vector3 *)c;
                A.Y = -A.Y;
                B.Y = -B.Y;
                C.Y = -C.Y;
                N   = Vector3.Cross(B - A, C - A);
                N.Normalize();
                *pVector3++ = N;
                *pVector3++ = A * ExportScale;
                *pVector3++ = B * ExportScale;
                *pVector3++ = C * ExportScale;
                p += 50;
                return(1);
            }
        }
Exemplo n.º 3
0
 public Data(Buffer2D <Vector4> buffer)
 {
     this.pointer  = (Vector4 *)buffer.Pin();
     this.pinnable = Unsafe.As <Pinnable <Vector4> >(buffer.Array);
     this.array    = buffer.Array;
     this.width    = buffer.Width;
 }
Exemplo n.º 4
0
 public unsafe void WritePixel(Vector2Int *uvs, int pixelCount, Vector4 *colors)
 {
     for (int i = 0; i < pixelCount; i++)
     {
         _pixels[UVToIndex(uvs[i].X, uvs[i].Y)].Write(colors[i]);
     }
 }
Exemplo n.º 5
0
 public unsafe void SetLightData(Vector4 *positions, int count)
 {
     if (lightsPosition != -1)
     {
         shader.SetVector4Array(lightsPosition, positions, count);
     }
 }
Exemplo n.º 6
0
        public static unsafe float MaxComponent(this Vector <float> v)
        {
            int v4c = Vector <float> .Count / 4;

            if (v4c > 1 &&
                Vector <float> .Count == v4c * 4)
            {
                Vector4 *v4p = (Vector4 *)&v;
                float    max = v4p[0].MaxComponent();
                for (int i = 1; i < v4c; i++)
                {
                    max = Math.Max(max, v4p[i].MaxComponent());
                }
                return(max);
            }
            else
            {
                float max = v[0];
                for (int i = 0; i < Vector <float> .Count; i++)
                {
                    max = Math.Max(max, v[i]);
                }
                return(max);
            }
        }
Exemplo n.º 7
0
    void RenderParticles(IntPtr particles, IntPtr velocities, IntPtr phases)
    {
        //List<RMPrimitive> prims = _memoryManager.RM_Prims;
        List <RMObj> renderList = _rayMarcher.RenderList;
        Vector4      particle;
        Vector3      velocity;

        unsafe
        {
            Vector4 *particlesPtr  = (Vector4 *)particles;
            Vector3 *velocitiesPtr = (Vector3 *)velocities;

            for (int i = 0; i < 28; ++i)
            {
                particle = particlesPtr[i];
                velocity = velocitiesPtr[i];

                //velocity += new Vector3(0.0f, -9.81f, 0.0f) * Time.deltaTime;

                //prims[i].transform.localPosition += velocity;// * Time.deltaTime;
                renderList[i].transform.position  = new Vector3(particle.x, particle.y, particle.z);
                renderList[i].transform.position += velocity;
                Debug.Log("Position: " + particle.ToString());
                Debug.Log("Velocity: " + velocity.ToString());
            }
        }
    }
Exemplo n.º 8
0
 protected override void CapacityChanged()
 {
     unsafe
     {
         m_Ptr = (Vector4 *)m_AlignedPtr.ToPointer();
     }
 }
Exemplo n.º 9
0
        public unsafe void AliasTest()
        {
            Vector4  expected = new Vector4(1, 2, 3, 4);
            Vector4 *ptr      = &expected;

            using (IGorgonPointer buffer = new GorgonPointerAliasTyped <Vector4>(ptr))
            {
                Assert.AreEqual(16, buffer.Size);

                float value1 = buffer.Read <float>();
                float value2 = buffer.Read <float>(8);

                Assert.IsTrue(1.0f.EqualsEpsilon(value1));
                Assert.IsTrue(3.0f.EqualsEpsilon(value2));
            }

            fixed(Vector2 *vec2 = &_vectors[0])
            {
                using (IGorgonPointer buffer = new GorgonPointerAlias(vec2, Vector2.SizeInBytes * _vectors.Length))
                {
                    buffer.Write(Vector2.SizeInBytes * 16, 3.0f);
                    buffer.Write((Vector2.SizeInBytes * 16) + sizeof(float), 4.0f);

                    Vector2 actual = buffer.Read <Vector2>(16 * Vector2.SizeInBytes);

                    Assert.IsTrue(_vectors[16].X.EqualsEpsilon(actual.X));
                    Assert.IsTrue(_vectors[16].Y.EqualsEpsilon(actual.Y));
                }
            }
        }
Exemplo n.º 10
0
 public unsafe void SetSpotlightData(Vector4 *param, int count)
 {
     if (spotlightParamsPosition != -1)
     {
         shader.SetVector4Array(spotlightParamsPosition, param, count);
     }
 }
        unsafe public void PrepareGPUShadowDatas(CullingResults cullResults, HDCamera camera)
        {
            int shadowIndex = 0;

            m_ShadowDatas.Clear();

            // Create all HDShadowDatas and update them with shadow request datas
            for (int i = 0; i < m_ShadowRequestCount; i++)
            {
                HDShadowAtlas atlas = m_Atlas;
                if (m_ShadowRequests[i].shadowMapType == ShadowMapType.CascadedDirectional)
                {
                    atlas = m_CascadeAtlas;
                }
                else if (m_ShadowRequests[i].shadowMapType == ShadowMapType.AreaLightAtlas)
                {
                    atlas = m_AreaLightShadowAtlas;
                }

                HDShadowData shadowData;
                if (m_ShadowRequests[i].shouldUseCachedShadow)
                {
                    shadowData = m_ShadowRequests[i].cachedShadowData;
                }
                else
                {
                    shadowData = CreateShadowData(m_ShadowRequests[i], atlas);
                    m_ShadowRequests[i].cachedShadowData = shadowData;
                }

                m_ShadowDatas.Add(shadowData);
                m_ShadowRequests[i].shadowIndex = shadowIndex++;
            }

            int first = k_DirectionalShadowCascadeCount, second = k_DirectionalShadowCascadeCount;

            fixed(float *sphereBuffer = m_DirectionalShadowData.sphereCascades)
            {
                Vector4 *sphere = (Vector4 *)sphereBuffer;

                for (int i = 0; i < k_DirectionalShadowCascadeCount; i++)
                {
                    first  = (first == k_DirectionalShadowCascadeCount && sphere[i].w > 0.0f) ? i : first;
                    second = ((second == k_DirectionalShadowCascadeCount || second == first) && sphere[i].w > 0.0f) ? i : second;
                }
            }

            // Update directional datas:
            if (second != k_DirectionalShadowCascadeCount)
            {
                m_DirectionalShadowData.cascadeDirection = (GetCascadeSphereAtIndex(second) - GetCascadeSphereAtIndex(first)).normalized;
            }
            else
            {
                m_DirectionalShadowData.cascadeDirection = Vector4.zero;
            }

            m_DirectionalShadowData.cascadeDirection.w = VolumeManager.instance.stack.GetComponent <HDShadowSettings>().cascadeShadowSplitCount.value;
        }
Exemplo n.º 12
0
 public void SetVertexOffset(int offset)
 {
     _vertexPtrOffset = offset;
     if (InOutBufferPtr != null)
     {
         VertexPtr = (Vector4 *)(InOutBufferPtr + _vertexPtrOffset);
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// <paramref name="result"/> must differ from <paramref name="vector"/>, otherwise invoke <see cref="Mul(Matrix4x4*, Vector4*)"/> instead
 /// </summary>
 public static Vector4 *Mul(Matrix4x4 *transform, Vector4 *vector, Vector4 *result)
 {
     result->X = vector->X * transform->M11 + vector->Y * transform->M21 + vector->Z * transform->M31 + vector->W * transform->M41;
     result->Y = vector->X * transform->M12 + vector->Y * transform->M22 + vector->Z * transform->M32 + vector->W * transform->M42;
     result->Z = vector->X * transform->M13 + vector->Y * transform->M23 + vector->Z * transform->M33 + vector->W * transform->M43;
     result->W = vector->X * transform->M14 + vector->Y * transform->M24 + vector->Z * transform->M34 + vector->W * transform->M44;
     return(result);
 }
Exemplo n.º 14
0
 public Vector4  GetAttributeUnsafe(int attribId)
 {
     unsafe
     {
         Vector4 *attribPtr = (Vector4 *)m_AttributesBuffer.ToPointer() + attribId;
         return(*attribPtr);
     }
 }
Exemplo n.º 15
0
        public void Execute(int i)
        {
            Vector4 *resultV = result + i;
            byte *   off     = input + i * byteStride;

            *resultV = *(Vector4 *)off;
            (*resultV).x *= -1;
            (*resultV).z *= -1;
        }
Exemplo n.º 16
0
 public void SetAttributeUnsafe(int attribId, Vector4 value)
 {
     m_WasModified = true;
     unsafe
     {
         Vector4 *attribPtr = (Vector4 *)m_AttributesBuffer.ToPointer() + attribId;
         attribPtr[0] = value;
     }
 }
Exemplo n.º 17
0
        public unsafe static Vector4[] GetVector4sInterleaved(
            ref byte[] bytes,
            int start,
            int count,
            int byteStride
            )
        {
            Profiler.BeginSample("GetVector4sInterleaved");
            var res = new Vector4[count];

#if BUFFER_MEMORY_COPY
            fixed(Vector4 *
                  dest = &(res[0])
                  )
            {
                Vector4 *destV = dest;

                fixed(byte *src = &(bytes[start]))
                {
                    byte *off = src;

                    for (int i = 0; i < count; i++)
                    {
                        System.Buffer.MemoryCopy(
                            off,
                            destV,
                            16,
                            16
                            );
                        off   += byteStride;
                        destV += 1;
                    }
                }
            }
#else
            int elementSize = Marshal.SizeOf(typeof(Vector4));

            var gcRes = GCHandle.Alloc(res, GCHandleType.Pinned);

            int off  = start;
            var dest = gcRes.AddrOfPinnedObject();

            for (int i = 0; i < count; i++)
            {
                Marshal.Copy(bytes, off, dest, elementSize);
                off  += byteStride;
                dest += elementSize;
            }

            gcRes.Free();
#endif
            Profiler.EndSample();
            return(res);
        }
Exemplo n.º 18
0
        private unsafe void FillSampleOffsets_Bloom(int texSize, Vector4 *ptSampleWeights, float *afTexCoordOffset, float deviation, float multiplier)
        {
            int   i  = 0;
            float tu = 1.0f / (float)texSize;

            // Fill the center texel
            float weight = multiplier * Numerics.GaussianDistribution(0, 0, deviation);

            ptSampleWeights[0] = new Vector4(weight, weight, weight, 1.0f);

            afTexCoordOffset[0] = 0.0f;

            // Fill the first half
            for (i = 1; i < 8; i++)
            {
                // Get the Gaussian intensity for this offset
                weight = multiplier * Numerics.GaussianDistribution((float)i, 0, deviation);
                afTexCoordOffset[i] = i * tu;

                ptSampleWeights[i] = new Vector4(weight, weight, weight, 1.0f);
            }

            // Mirror to the second half
            for (i = 8; i < 15; i++)
            {
                ptSampleWeights[i]  = ptSampleWeights[i - 7];
                afTexCoordOffset[i] = -afTexCoordOffset[i - 7];
            }

            //int i = 0;
            //float tu = 1.0f / (float)texSize;

            //// Fill the center texel
            //float weight = 1.0f * Numerics.GaussianDistribution(0, mean, deviation);
            //ptsampleWeights[0] = new Vector4(weight, weight, weight, 1.0f);

            //ptafTexCoordOffset[0] = 0.0f;

            //    // Fill the right side
            //    for (i = 1; i < 8; i++)
            //    {
            //        weight = multiplier * Numerics.GaussianDistribution((float)i, mean, deviation);
            //        ptafTexCoordOffset[i] = i * tu;

            //        ptsampleWeights[i] = new Vector4(weight, weight, weight, 1.0f);
            //    }

            //    // Copy to the left side
            //    for (i = 8; i < 15; i++)
            //    {
            //        ptsampleWeights[i] = ptsampleWeights[i - 7];
            //        ptafTexCoordOffset[i] = -ptafTexCoordOffset[i - 7];
            //    }
        }
Exemplo n.º 19
0
    void LateUpdate()
    {
        for (int j = 0; j < m_Meshes.Length; ++j)
        {
            Mesh      m = m_Meshes[j];
            Matrix4x4 t = m_MeshesImportTransform[j];
            if (m_PerInstanceBuffer != IntPtr.Zero && m_InstancesCount > 0)
            {
#if false
                MaterialPropertyBlock materialProp = new MaterialPropertyBlock();
                Matrix4x4[]           transforms   = new Matrix4x4[1023];
                Vector4[]             colors       = new Vector4[1023];

                for (int i = 0; i < m_InstancesCount; i += 1023)
                {
                    for (int h = 0; h + i < m_InstancesCount && h < 1023; ++h)
                    {
                        unsafe
                        {
                            Matrix4x4 *instanceTransform = (Matrix4x4 *)m_PerInstanceBuffer.ToPointer();
                            Vector4 *  instanceColor     = (Vector4 *)(instanceTransform + m_InstancesCount);

                            transforms[h] = instanceTransform[i + h] * t;
                            colors[h]     = instanceColor[i + h];
                        }
                    }
                    int DataLeft = Math.Min(m_InstancesCount - i, 1023);
                    materialProp.SetVectorArray(ColorPropertyName, colors);
                    Graphics.DrawMeshInstanced(m, 0, m_Material, transforms, DataLeft, materialProp);
                }
#else
                for (int i = 0; i < m_InstancesCount; i++)
                {
                    Matrix4x4 transform;
                    Vector4   color;

                    unsafe
                    {
                        Matrix4x4 *instanceTransform = (Matrix4x4 *)m_PerInstanceBuffer.ToPointer();
                        Vector4 *  instanceColor     = (Vector4 *)(instanceTransform + m_InstancesCount);

                        transform = instanceTransform[i] * t;
                        color     = instanceColor[i];
                    }

                    MaterialPropertyBlock colorProperty = new MaterialPropertyBlock();

                    colorProperty.SetColor(ColorPropertyName, color);
                    Graphics.DrawMesh(m, transform, m_Material, 0, null, 0, colorProperty, m_CastShadow);
                }
#endif
            }
        }
    }
Exemplo n.º 20
0
        void DisplayButtons(string name, List <ToolbuttonData> DisplayToolButtons)
        {
            if (ImGui.Begin(name, _flags))
            {
                uint     unclickedcolor;
                uint     clickedcolour;
                ImGuiCol buttonidx = ImGuiCol.Button;
                unsafe
                {
                    Vector4 *unclickedcolorv = ImGui.GetStyleColorVec4(ImGuiCol.Button);
                    Vector4 *clickedcolorv   = ImGui.GetStyleColorVec4(ImGuiCol.ButtonActive);
                    unclickedcolor = ImGui.ColorConvertFloat4ToU32(*unclickedcolorv);
                    clickedcolour  = ImGui.ColorConvertFloat4ToU32(*clickedcolorv);
                }
                //Store the colors for pressed and unpressed buttons

                uint iterations = 0;
                //displays the default toolbar menu icons
                foreach (var button in DisplayToolButtons)//For each button
                {
                    string id = iterations.ToString();
                    ImGui.PushID(id);

                    if (button.GetActive != null)                           //If the windows state can be checked
                    {
                        if (button.GetActive())                             //If the window is open
                        {
                            ImGui.PushStyleColor(buttonidx, clickedcolour); //Have the button be "pressed"
                        }
                        else//If closed
                        {
                            ImGui.PushStyleColor(buttonidx, unclickedcolor);//Have the button be colored normally
                        }
                    }

                    if (ImGui.ImageButton(button.Picture, BtnSizes))//Make the button
                    {
                        button.OnClick();
                    }

                    if (ImGui.IsItemHovered())
                    {
                        ImGui.SetTooltip(button.TooltipText);
                    }


                    ImGui.PopID();
                    iterations++;
                }
                ImGui.PushStyleColor(buttonidx, unclickedcolor);

                ImGui.End();
            }
        }
Exemplo n.º 21
0
        public void Setup()
        {
            this.width    = 2048;
            this.buffer   = new Buffer2D <Vector4>(2048, 2048);
            this.pointer  = (Vector4 *)this.buffer.Pin();
            this.array    = this.buffer.Array;
            this.pinnable = Unsafe.As <Pinnable <Vector4> >(this.array);

            this.startIndex = 2048 / 2 - (this.Count / 2);
            this.endIndex   = 2048 / 2 + (this.Count / 2);
        }
Exemplo n.º 22
0
 public static void Copy(NativeArray <Vector4> nativeArray, Vector4[] arrays, int srcIndex, int destIndex, int length)
 {
     unsafe
     {
         Vector4 *src = (Vector4 *)nativeArray.GetUnsafeReadOnlyPtr();
         src = src + srcIndex;
         fixed(Vector4 *dest = &arrays[destIndex])
         {
             UnsafeUtility.MemCpy(dest, src, sizeof(Vector4) * length);
         }
     }
 }
Exemplo n.º 23
0
        protected unsafe JobHandle?GetTangentsJob(
            void *input,
            int count,
            GLTFComponentType inputType,
            int inputByteStride,
            Vector4 *output,
            int outputByteStride,
            bool normalized = false
            )
        {
            Profiler.BeginSample("GetTangentsJob");
            JobHandle?jobHandle;

            switch (inputType)
            {
            case GLTFComponentType.Float:
                var jobTangentI = new Jobs.GetTangentsInterleavedJob();
                jobTangentI.inputByteStride  = inputByteStride > 0 ? inputByteStride : 16;
                jobTangentI.input            = (byte *)input;
                jobTangentI.outputByteStride = outputByteStride;
                jobTangentI.result           = output;
                jobHandle = jobTangentI.Schedule(count, GLTFast.DefaultBatchCount);
                break;

            case GLTFComponentType.Short:
                var jobTangent = new Jobs.GetTangentsInt16NormalizedInterleavedJob();
                jobTangent.inputByteStride = inputByteStride > 0 ? inputByteStride : 8;;
                Assert.IsTrue(normalized);
                jobTangent.input            = (System.Int16 *)input;
                jobTangent.outputByteStride = outputByteStride;
                jobTangent.result           = output;
                jobHandle = jobTangent.Schedule(count, GLTFast.DefaultBatchCount);
                break;

            case GLTFComponentType.Byte:
                var jobTangentByte = new Jobs.GetVector4sInt8NormalizedInterleavedJob();
                jobTangentByte.inputByteStride = inputByteStride > 0 ? inputByteStride : 4;
                Assert.IsTrue(normalized);
                jobTangentByte.input            = (sbyte *)input;
                jobTangentByte.outputByteStride = outputByteStride;
                jobTangentByte.result           = output;
                jobHandle = jobTangentByte.Schedule(count, GLTFast.DefaultBatchCount);
                break;

            default:
                Debug.LogErrorFormat(GLTFast.ErrorUnsupportedType, "Tangent", inputType);
                jobHandle = null;
                break;
            }

            Profiler.EndSample();
            return(jobHandle);
        }
Exemplo n.º 24
0
        public void Execute()
        {
            Vector4 *resultV = result;
            byte *   off     = input;

            for (int i = 0; i < count; i++)
            {
                *resultV = *(Vector4 *)off;
                off     += byteStride;
                resultV += 1;
            }
        }
Exemplo n.º 25
0
        unsafe public void ProcessShadowRequests(CullResults cullResults, Camera camera, LightingDebugSettings lightingDebugSettings)
        {
            int shadowIndex = 0;

            if (lightingDebugSettings.shadowResolutionScaleFactor != 1.0f)
            {
                foreach (var shadowRequest in m_ShadowRequests)
                {
                    shadowRequest.viewportSize *= lightingDebugSettings.shadowResolutionScaleFactor;
                }
            }

            // Assign a position to all the shadows in the atlas, and scale shadows if needed
            if (!m_CascadeAtlas.Layout(false))
            {
                Debug.LogWarning("Cascade Shadow atlasing has failed, try reducing the shadow resolution of the directional light or increase the shadow atlas size");
            }
            m_Atlas.Layout();

            m_ShadowDatas.Clear();

            // Create all HDShadowDatas and update them with shadow request datas
            foreach (var shadowRequest in m_ShadowRequests)
            {
                m_ShadowDatas.Add(CreateShadowData(shadowRequest));
                shadowRequest.shadowIndex = shadowIndex++;
            }

            int first = k_DirectionalShadowCascadeCount, second = k_DirectionalShadowCascadeCount;

            fixed(float *sphereBuffer = m_DirectionalShadowData.sphereCascades)
            {
                Vector4 *sphere = (Vector4 *)sphereBuffer;

                for (int i = 0; i < k_DirectionalShadowCascadeCount; i++)
                {
                    first  = (first == k_DirectionalShadowCascadeCount && sphere[i].w > 0.0f) ? i : first;
                    second = ((second == k_DirectionalShadowCascadeCount || second == first) && sphere[i].w > 0.0f) ? i : second;
                }
            }

            // Update directional datas:
            if (second != k_DirectionalShadowCascadeCount)
            {
                m_DirectionalShadowData.cascadeDirection = (GetCascadeSphereAtIndex(second) - GetCascadeSphereAtIndex(first)).normalized;
            }
            else
            {
                m_DirectionalShadowData.cascadeDirection = Vector4.zero;
            }

            m_DirectionalShadowData.cascadeDirection.w = k_DirectionalShadowCascadeCount;
        }
Exemplo n.º 26
0
        public void Execute(int i)
        {
            Vector4 *resultV = (Vector4 *)(((byte *)result) + (i * outputByteStride));
            short *  off     = (short *)(((byte *)input) + (i * inputByteStride));

            Vector4 tmp;

            tmp.x = Mathf.Max(*off / (float)short.MaxValue, -1f);
            tmp.y = Mathf.Max(*(off + 1) / (float)short.MaxValue, -1f);
            tmp.z = Mathf.Max(*(off + 2) / (float)short.MaxValue, -1f);
            tmp.w = Mathf.Max(*(off + 3) / (float)short.MaxValue, -1f);
            *resultV = tmp;
        }
Exemplo n.º 27
0
        internal unsafe void ConvertIntoQuaternion(Source source)
        {
            source.Lock();

            Vector4 *pter = (Vector4 *)source.ArrayPointer;

            for (int i = 0; i < source.Accesor.Count; i++, pter++)
            {
                *pter = ConvertQuaternion(*pter);
            }

            source.Unlock();
        }
Exemplo n.º 28
0
        public Texture giveEntireTerrainInTexture()
        {
            try
            {
                int     width   = TerrainGlobals.getTerrain().getNumXVerts();
                int     height  = TerrainGlobals.getTerrain().getNumXVerts();
                Texture mainTex = new Texture(BRenderDevice.getDevice(), width, height, 1, Usage.None, Format.A32B32G32R32F, Pool.Managed);

                Vector3[] details = TerrainGlobals.getEditor().getDetailPoints();
                unsafe
                {
                    GraphicsStream streamPos = mainTex.LockRectangle(0, LockFlags.None);
                    Vector4 *      pos       = (Vector4 *)streamPos.InternalDataPointer;

                    for (int x = 0; x < width; x++)
                    {
                        for (int y = 0; y < height; y++)
                        {
                            int     srcIndex = x * width + y;
                            int     dstIndex = x * width + y;
                            Vector3 input    = details[srcIndex];
                            pos[dstIndex].X = input.X;
                            pos[dstIndex].Y = input.Y;
                            pos[dstIndex].Z = input.Z;
                            pos[dstIndex].W = 1;
                        }
                    }

                    mainTex.UnlockRectangle(0);
                }

                return(mainTex);
            }
            catch (OutOfVideoMemoryException eGPU)
            {
                if (!CoreGlobals.IsBatchExport)
                {
                    MessageBox.Show("giveEntireTerrainInTexture: You've run out of graphics card memory... Talk to the editor guys..");
                }
                return(null);
            }
            catch (OutOfMemoryException eCPU)
            {
                if (!CoreGlobals.IsBatchExport)
                {
                    MessageBox.Show("giveEntireTerrainInTexture: You've run out of memory... Talk to the editor guys..");
                }
                return(null);
            }
            return(null);
        }
Exemplo n.º 29
0
        public unsafe Vector4 IterateUsingPointers()
        {
            Vector4 sum = new Vector4();

            Vector4 *ptr = (Vector4 *)this.buffer.Pin();
            Vector4 *end = ptr + this.Length;

            for (; ptr < end; ptr++)
            {
                sum += *ptr;
            }

            return(sum);
        }
Exemplo n.º 30
0
        public void Execute(int i)
        {
            Vector4 *resultV = (Vector4 *)(((byte *)result) + (i * outputByteStride));
            sbyte *  off     = input + (i * inputByteStride);

            Vector4 tmp;

            tmp.x = Mathf.Max(*off / 127f, -1f);
            tmp.y = -Mathf.Max(*(off + 1) / 127f, -1f);
            tmp.z = -Mathf.Max(*(off + 2) / 127f, -1f);
            tmp.w = Mathf.Max(*(off + 3) / 127f, -1f);
            tmp.Normalize();
            *resultV = tmp;
        }