void vertex_stream_draw(vertex_stream_t *vs){ #ifndef OKE_FAST RET_IF(!vs); #endif glBindVertexArray(vs->gl_vao); glDrawArrays(vs->gl_mode,vs->draw_offset,vs->draw_count); }
API void iotcon_resource_types_destroy(iotcon_resource_types_h types) { RET_IF(NULL == types); types->ref_count--; if (0 == types->ref_count) { g_list_free_full(types->type_list, free); free(types); } }
API void iotcon_resource_interfaces_destroy(iotcon_resource_interfaces_h ifaces) { RET_IF(NULL == ifaces); ifaces->ref_count--; if (0 == ifaces->ref_count) { g_list_free_full(ifaces->iface_list, free); free(ifaces); } }
// after determining a fsm transition is needed, // figure out the event and call this fcn with the event and the // handle supplied via the call to fsm_allocFsm // // this fcn does some ptr trickery to get generalized pointers to // various sized arrays of struct fsm_s. handle is passed as a ptr to // a _whole_ 2-dim'l array. unsigned int fsm(unsigned int handle, event_t event) { struct fsmContext_s *cp = &fsmContexts[handle]; struct fsm_s *t2p; state_t cs; unsigned int i; cs = cp->currentState; i = cs * cp->maxevent + event; t2p = ((struct fsm_s *)(struct fsm_s **)cp->fsmp + i); // sanitize handle and event // return early if anything is out of whack RET_IF(handle >= FSM_MAXCONTEXTS, FSM_NOCTX); RET_IF(event >= cp->maxevent, FSM_UNKEVENT); RET_IF(cs >= cp->maxstate, FSM_UNKSTATE); // if the indicated action for this event and state is not NULL, do it // else transition to newstate_true if (NULL != t2p->action) { cp->currentState = t2p->action() ? t2p->newstate_true : t2p->newstate_false; } else { cp->currentState = t2p->newstate_true; } if (cp->traceEnable) { cp->trace[cp->traceIndex % NUMBEROFELEMENTSIN(cp->trace)].event = event; cp->trace[cp->traceIndex % NUMBEROFELEMENTSIN(cp->trace)].state = cp->currentState; cp->traceIndex++; cp->traceIndex = cp->traceIndex % NUMBEROFELEMENTSIN(cp->trace); } return ERR_SUCCESS; }
void vertex_stream_set_mode(vertex_stream_t *vs,GLenum gl_mode){ RET_IF(!vs); vs->gl_mode=gl_mode; }
void vertex_stream_destroy(vertex_stream_t *vs){ RET_IF(!vs); vs->gl_vbo=0; vs->gl_vao=0; }
void vertex_format_destroy(vertex_format_t *vf){ RET_IF(!vf); array_destroy(&vf->attribs); }