MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / iLightCreate

Function iLightCreate

src/SB/Core/gc/iLight.cpp:10–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10iLight* 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
64void iLightModify(iLight* light, U32 flags)
65{

Callers 1

zLightInitFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected