| 8 | } |
| 9 | |
| 10 | iLight* iLightCreate(iLight* light, U32 type) |
| 11 | { |
| 12 | RwFrame* frame; |
| 13 | |
| 14 | switch (type) |
| 15 | { |
| 16 | case ILIGHT_TYPE_POINT: |
| 17 | light->hw = RpLightCreate(rpLIGHTPOINT); |
| 18 | break; |
| 19 | case ILIGHT_TYPE_SPOT: |
| 20 | light->hw = RpLightCreate(rpLIGHTSPOT); |
| 21 | break; |
| 22 | case ILIGHT_TYPE_SPOTSOFT: |
| 23 | light->hw = RpLightCreate(rpLIGHTSPOTSOFT); |
| 24 | break; |
| 25 | default: |
| 26 | return NULL; |
| 27 | } |
| 28 | |
| 29 | if (!light->hw) |
| 30 | { |
| 31 | return NULL; |
| 32 | } |
| 33 | |
| 34 | frame = RwFrameCreate(); |
| 35 | |
| 36 | if (!frame) |
| 37 | { |
| 38 | RpLightDestroy(light->hw); |
| 39 | return NULL; |
| 40 | } |
| 41 | |
| 42 | RpLightSetFlags(light->hw, rpLIGHTLIGHTATOMICS); |
| 43 | RpLightSetFrame(light->hw, frame); |
| 44 | |
| 45 | RwFrameUpdateObjects(frame); |
| 46 | |
| 47 | light->type = type; |
| 48 | light->sph.center.x = 0.0f; |
| 49 | light->sph.center.y = 0.0f; |
| 50 | light->sph.center.z = 0.0f; |
| 51 | light->sph.r = 0.0f; |
| 52 | light->color.r = 1.0f; |
| 53 | light->color.g = 1.0f; |
| 54 | light->color.b = 1.0f; |
| 55 | light->color.a = 1.0f; |
| 56 | light->dir.x = 0.0f; |
| 57 | light->dir.y = 0.0f; |
| 58 | light->dir.z = 1.0f; |
| 59 | light->coneangle = 0.0f; |
| 60 | |
| 61 | return light; |
| 62 | } |
| 63 | |
| 64 | void iLightModify(iLight* light, U32 flags) |
| 65 | { |