primitiveSetLights(void)
{
	// B3DAcceleratorPlugin>>#primitiveSetLights
    sqInt handle;
    sqInt i;
    void*light;
    sqInt lightArray;
    sqInt lightCount;
    sqInt lightOop;

	if (!((methodArgumentCount()) == 2)) {
		return primitiveFail();
	}
	lightArray = stackLightArrayValue(0);
	handle = stackIntegerValue(1);
	if (failed()) {
		return null;
	}
	if (!(b3dxDisableLights(handle))) {
		return primitiveFail();
	}
	if (lightArray == null) {
return null;
	}

	/* For each enabled light source */

lightCount = slotSizeOf(lightArray);
	for (i = 0; i <= (lightCount - 1); i += 1) {
		/* begin fetchLightSource:ofObject: */
lightOop = fetchPointerofObject(i, lightArray);
		light = firstIndexableField(lightOop);
		if (!(b3dxLoadLight(handle, i, light))) {
			return primitiveFail();
		}
	}
	return pop(2);
}
예제 #2
0
EXPORT(sqInt) primitiveSetLights(void) {
    sqInt i;
    sqInt lightCount;
    sqInt handle;
    sqInt lightArray;
    void* light;
    sqInt lightOop;

	if (!((interpreterProxy->methodArgumentCount()) == 2)) {
		return interpreterProxy->primitiveFail();
	}
	lightArray = stackLightArrayValue(0);
	handle = interpreterProxy->stackIntegerValue(1);
	if (interpreterProxy->failed()) {
		return null;
	}
	if (!(b3dxDisableLights(handle))) {
		return interpreterProxy->primitiveFail();
	}
	if (lightArray == null) {
		return null;
	}

	/* For each enabled light source */

	lightCount = interpreterProxy->slotSizeOf(lightArray);
	for (i = 0; i <= (lightCount - 1); i += 1) {
		/* begin fetchLightSource:ofObject: */
		lightOop = interpreterProxy->fetchPointerofObject(i, lightArray);
		light = interpreterProxy->firstIndexableField(lightOop);
		if (!(b3dxLoadLight(handle, i, light))) {
			return interpreterProxy->primitiveFail();
		}
	}
	return interpreterProxy->pop(2);
}