OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 PassRefPtr<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRen
deringContext* ctx, VaoType type) | 34 PassRefPtr<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRen
deringContext* ctx, VaoType type) |
35 { | 35 { |
36 return adoptRef(new WebGLVertexArrayObjectOES(ctx, type)); | 36 return adoptRef(new WebGLVertexArrayObjectOES(ctx, type)); |
37 } | 37 } |
38 | 38 |
39 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContext* ctx,
VaoType type) | 39 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContext* ctx,
VaoType type) |
40 : WebGLContextObject(ctx) | 40 : WebGLContextObject(ctx) |
41 , m_type(type) | 41 , m_type(type) |
42 , m_hasEverBeenBound(false) | 42 , m_hasEverBeenBound(false) |
43 , m_boundElementArrayBuffer(0) | 43 , m_boundElementArrayBuffer(nullptr) |
44 { | 44 { |
45 ScriptWrappable::init(this); | 45 ScriptWrappable::init(this); |
46 m_vertexAttribState.resize(ctx->maxVertexAttribs()); | 46 m_vertexAttribState.resize(ctx->maxVertexAttribs()); |
47 | 47 |
48 switch (m_type) { | 48 switch (m_type) { |
49 case VaoTypeDefault: | 49 case VaoTypeDefault: |
50 break; | 50 break; |
51 default: | 51 default: |
52 setObject(context()->webGraphicsContext3D()->createVertexArrayOES()); | 52 setObject(context()->webGraphicsContext3D()->createVertexArrayOES()); |
53 break; | 53 break; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 state.normalized = normalized; | 108 state.normalized = normalized; |
109 state.stride = validatedStride; | 109 state.stride = validatedStride; |
110 state.originalStride = stride; | 110 state.originalStride = stride; |
111 state.offset = offset; | 111 state.offset = offset; |
112 } | 112 } |
113 | 113 |
114 void WebGLVertexArrayObjectOES::unbindBuffer(PassRefPtr<WebGLBuffer> buffer) | 114 void WebGLVertexArrayObjectOES::unbindBuffer(PassRefPtr<WebGLBuffer> buffer) |
115 { | 115 { |
116 if (m_boundElementArrayBuffer == buffer) { | 116 if (m_boundElementArrayBuffer == buffer) { |
117 m_boundElementArrayBuffer->onDetached(context()->webGraphicsContext3D())
; | 117 m_boundElementArrayBuffer->onDetached(context()->webGraphicsContext3D())
; |
118 m_boundElementArrayBuffer = 0; | 118 m_boundElementArrayBuffer = nullptr; |
119 } | 119 } |
120 | 120 |
121 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { | 121 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { |
122 VertexAttribState& state = m_vertexAttribState[i]; | 122 VertexAttribState& state = m_vertexAttribState[i]; |
123 if (state.bufferBinding == buffer) { | 123 if (state.bufferBinding == buffer) { |
124 buffer->onDetached(context()->webGraphicsContext3D()); | 124 buffer->onDetached(context()->webGraphicsContext3D()); |
125 state.bufferBinding = 0; | 125 state.bufferBinding = nullptr; |
126 } | 126 } |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 void WebGLVertexArrayObjectOES::setVertexAttribDivisor(GLuint index, GLuint divi
sor) | 130 void WebGLVertexArrayObjectOES::setVertexAttribDivisor(GLuint index, GLuint divi
sor) |
131 { | 131 { |
132 VertexAttribState& state = m_vertexAttribState[index]; | 132 VertexAttribState& state = m_vertexAttribState[index]; |
133 state.divisor = divisor; | 133 state.divisor = divisor; |
134 } | 134 } |
135 | 135 |
136 } | 136 } |
OLD | NEW |