| 223 | } |
| 224 | |
| 225 | bool MotionStreak::setProgramState(backend::ProgramState* programState, bool ownPS /*= false*/) |
| 226 | { |
| 227 | if (Node::setProgramState(programState, ownPS)) |
| 228 | { |
| 229 | AXASSERT(programState, "argument should not be nullptr"); |
| 230 | auto& pipelineDescriptor = _customCommand.getPipelineDescriptor(); |
| 231 | pipelineDescriptor.programState = _programState; |
| 232 | |
| 233 | _mvpMatrixLocaiton = _programState->getUniformLocation("u_MVPMatrix"); |
| 234 | _textureLocation = _programState->getUniformLocation("u_tex0"); |
| 235 | |
| 236 | // setup custom vertex layout for V2F_T2F_C4B |
| 237 | const auto& attributeInfo = _programState->getProgram()->getActiveAttributes(); |
| 238 | auto iter = attributeInfo.find("a_position"); |
| 239 | auto layout = _programState->getMutableVertexLayout(); |
| 240 | if (iter != attributeInfo.end()) |
| 241 | { |
| 242 | layout->setAttrib("a_position", iter->second.location, backend::VertexFormat::FLOAT2, 0, false); |
| 243 | } |
| 244 | iter = attributeInfo.find("a_texCoord"); |
| 245 | if (iter != attributeInfo.end()) |
| 246 | { |
| 247 | layout->setAttrib("a_texCoord", iter->second.location, backend::VertexFormat::FLOAT2, |
| 248 | 2 * sizeof(float), false); |
| 249 | } |
| 250 | iter = attributeInfo.find("a_color"); |
| 251 | if (iter != attributeInfo.end()) |
| 252 | { |
| 253 | layout->setAttrib("a_color", iter->second.location, backend::VertexFormat::UBYTE4, |
| 254 | 4 * sizeof(float), true); |
| 255 | } |
| 256 | layout->setStride(4 * sizeof(float) + 4 * sizeof(uint8_t)); |
| 257 | |
| 258 | updateProgramStateTexture(_texture); |
| 259 | return true; |
| 260 | } |
| 261 | return false; |
| 262 | } |
| 263 | |
| 264 | void MotionStreak::setBlendFunc(const BlendFunc& blendFunc) |
| 265 | { |
nothing calls this directly
no test coverage detected