[name]

تخزن هذه الفئة بيانات لسمة (مثل مواضع الرأس ، ومؤشرات الوجه ، والمعايير ، والألوان ، والأشعة فوق البنفسجية ، وأي سمات مخصصة) المرتبطة مع [page:BufferGeometry] ، مما يسمح بتمرير البيانات بشكل أكثر كفاءة إلى وحدة معالجة الرسومات. انظر تلك الصفحة للحصول على التفاصيل ومثال على الاستخدام. عند العمل مع بيانات مثل المتجهات ، قد تكون طرق المساعد .fromBufferAttribute(attribute, index) على [page:Vector2.fromBufferAttribute Vector2]، [page:Vector3.fromBufferAttribute Vector3]، [page:Vector4.fromBufferAttribute Vector4]، و [page:Color.fromBufferAttribute Color] قد تكون مفيدة.

المنشئ (Constructor)

[name]([param:TypedArray array]، [param:Integer itemSize]، [param:Boolean normalized])

[page:TypedArray array] - يجب أن يكون [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/TypedArray TypedArray]. يستخدم لإنشاء المخزن المؤقت.
يجب أن يحتوي هذا المصفوفة على itemSize * numVertices عناصر ، حيث numVertices هو عدد الرؤوس في المرتبطة [page:BufferGemetry BufferGeometry].

[page:Integer itemSize] - عدد قيم المصفوفة التي يجب ترتبط برأس معين. على سبيل المثال ، إذا كانت هذه السمة هي تخزين متجه من 3 مكونات (مثل الموضع أو الطبيعي أو اللون) ، فإن itemSize يجب أن يكون 3.

[page:Boolean normalized] - (اختياري) ينطبق على البيانات الصحيحة فقط. يشير إلى كيفية تعيين البيانات الأساسية في المخزن المؤقت إلى القيم في كود GLSL. على سبيل المثال ، إذا كان [page:TypedArray array] هو نسخة من UInt16Array ، و [page:Boolean normalized] صحيحًا ، فإن القиم `0 - +65535` في بيانات المصفوفة ستُخرج إلى 0.0f - +1.0f في GLSL attribute. ستُخرج Int16Array (signed) من -32768 - +32767 إلى -1.0f - +1.0f. إذا كان [page:Boolean normalized] خطأً ، فستكون القيم تحول إلى floats دون تعديل ، أي 32767 يصبح 32767.0f.

الخصائص (Properties)

[property:TypedArray array]

ال[page:TypedArray array] التي تحمل البيانات المخزنة في المخزن المؤقت.

[property:Integer count]

يخزن طول [page:BufferAttribute.array array] مقسومًا على [page:BufferAttribute.itemSize itemSize]. Read-only property.

إذا كان المخزن يخزن متجهًا من 3 مكونات (مثل الموضع أو الطبيعي أو اللون) ، فسيحسب عدد هذه المتجهات المخزنة.

[property:Boolean isBufferAttribute]

علامة للقراءة فقط للتحقق مما إذا كان الكائن المعطى من نوع [name].

[property:Integer itemSize]

طول المتجهات التي يتم تخزينها في [page:BufferAttribute.array array].

[property:String name]

اسم اختياري لهذا الحدث من السمة. الافتراضي هو سلسلة فارغة.

[property:Boolean needsUpdate]

علامة للإشارة إلى أن هذه السمة قد تغيرت ويجب إعادة إرسالها إلى وحدة معالجة الرسومات. قم بتعيين هذا على true عند تعديل قيمة المصفوفة.

تعيين هذا على true يزيد أيضًا من [page:BufferAttribute.version version].

[property:Boolean normalized]

يشير إلى كيفية تعيين البيانات الأساسية في المخزن المؤقت إلى القيم في كود GLSL. راجع المُنشئ أعلاه للحصول على التفاصيل.

[property:Function onUploadCallback]

دالة رد اتصال يتم تنفيذها بعد أن قام Renderer بنقل بيانات مصفوفة السمة إلى وحدة معالجة الرسومات.

[property:Object updateRange]

كائن يحتوي على:
[page:Integer offset]: الافتراضية هي `0`. الموضع الذي يجب أن يبدأ فيه التحديث.
[page:Integer count]: الافتراضية هي `-1` ، وهذا يعني عدم استخدام التحديث المدى.

يمكن استخدام هذا لتحديث بعض مكونات المتجهات المخزنة فقط (على سبيل المثال ، فقط المكوِّن المرتبط باللون).

[property:Usage usage]

يحدد نمط الاستخدام المقصود لمخزن البيانات لأغراض التحسين . يتوافق مع معلمة `usage` من [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData WebGLRenderingContext.bufferData](). الافتراضي هو [page:BufferAttributeUsage StaticDrawUsage]. راجع الاستخدام [page:BufferAttributeUsage constants] لجميع القيم الممكنة.

ملاحظة: بعد الاستخدام الأولي للمخزن المؤقت ، لا يمكن تغيير استخدامه. بدلاً من ذلك ، قم بإنشاء نسخة جديدة وتعيين الاستخدام المطلوب قبل التالي جعل.

[property:Integer version]

رقم إصدار ، يزداد كل مرة [page:BufferAttribute.needsUpdate needsUpdate] يتم تعيين خاصية على true.

الوظائف (Methods)

[method:this applyMatrix3]([param:Matrix3 m])

تطبق المصفوفة [page:Matrix3 m] على كل عنصر Vector3 من هذا BufferAttribute.

[method:this applyMatrix4]([param:Matrix4 m])

تطبق المصفوفة [page:Matrix4 m] على كل عنصر Vector3 من هذا BufferAttribute.

[method:this applyNormalMatrix]([param:Matrix3 m])

تطبق المصفوفة الطبيعية [page:Matrix3 m] على كل عنصر Vector3 من هذا BufferAttribute.

[method:this transformDirection]([param:Matrix4 m])

تطبق المصفوفة [page:Matrix4 m] على كل عنصر Vector3 من هذا BufferAttribute ، مع تفسير العناصر كمتجهات اتجاه.

[method:BufferAttribute clone]()

إرجاع نسخة من هذه bufferAttribute.

[method:this copy]([param:BufferAttribute bufferAttribute])

ينسخ BufferAttribute آخر إلى هذه BufferAttribute.

[method:this copyArray](array)

انسخ المصفوفة المعطاة هنا (والتي يمكن أن تكون مصفوفة عادية أو TypedArray) إلى [page:BufferAttribute.array array].

انظر [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set] للحصول على ملاحظات حول المتطلبات إذا كان يتم نسخ TypedArray.

[method:this copyAt]([param:Integer index1]، [param:BufferAttribute bufferAttribute]، [param:Integer index2])

انسخ متجهًا من bufferAttribute[index2] إلى [page:BufferAttribute.array array][index1].

[method:Number getComponent]( [param:Integer index], [param:Integer component] )

Returns the given component of the vector at the given index.

[method:Number getX]([param:Integer index])

يعيد مكون x من المتجه في المؤشر المحدد.

[method:Number getY]([param:Integer index])

يعيد مكون y من المتجه في المؤشر المحدد.

[method:Number getZ]([param:Integer index])

يعيد مكون z من المتجه في المؤشر المحدد.

[method:Number getW]([param:Integer index])

يعيد مكون w من المتجه في المؤشر المحدد.

[method:this onUpload]([param:Function callback])

يضع قيمة خاصية onUploadCallback.

في [example:webgl_buffergeometry WebGL / Buffergeometry] يتم استخدام هذا لتحرير الذاكرة بعد نقل المخزن إلى وحدة معالجة الرسومات.

[method:this set]([param:Array value]، [param:Integer offset])

value - [page:Array] أو [page:TypedArray] لنسخ القيم منه.
offset - (اختياري) فهرس [page:BufferAttribute.array array] في الذي يجب البدء في النسخ.

المكالمات [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]([page:Array value]، [page:Integer offset]) على [page:BufferAttribute.array array].

على وجه الخصوص ، انظر تلك الصفحة للحصول على متطلبات [page:Array value] كونها [page:TypedArray].

[method:this setUsage]([param:Usage value])

قم بتعيين [page:BufferAttribute.usage usage] إلى value. راجع الاستخدام [page:BufferAttributeUsage constants] لجميع قيم الإدخال الممكنة.

ملاحظة: بعد الاستخدام الأولي للمخزن المؤقت ، لا يمكن تغيير استخدامه. بدلاً من ذلك ، قم بإنشاء نسخة جديدة وتعيين الاستخدام المطلوب قبل التالي جعل.

[method:Number setComponent]( [param:Integer index], [param:Integer component], [param:Float value] )

Sets the given component of the vector at the given index.

[method:this setX]([param:Integer index], [param:Float x])

تضبط مكون x من المتجه في المؤشر المحدد.

[method:this setY]([param:Integer index], [param:Float y])

تضبط مكون y من المتجه في المؤشر المحدد.

[method:this setZ]([param:Integer index], [param:Float z])

تضبط مكون z من المتجه في المؤشر المحدد.

[method:this setW]([param:Integer index], [param:Float w])

تضبط مكون w من المتجه في المؤشر المحдد.

[method:this setXY]([param:Integer index], [param:Float x], [param:Float y])

تضبط مكونات x و y من المتجه في

المصدر (Source)

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]