41static JSBool
VisualEffectSetProperty(JSContext *context, JSObject *
this, jsid propID, JSBool strict, jsval *value);
67 JSCLASS_NO_OPTIONAL_MEMBERS
158 if (outEntity == NULL)
return NO;
161 result = OOJSEntityGetEntity(context, visualEffectObj, &entity);
162 if (!result)
return NO;
173@implementation OOVisualEffectEntity (OOJavaScriptExtensions)
175- (void)getJSClass:(JSClass **)outClass andPrototype:(JSObject **)outPrototype
184 return @"VisualEffect";
194 return [[
self visualEffectSubEntityEnumerator] allObjects];
202 if (!JSID_IS_INT(propID))
return YES;
210 if (entity ==
nil) { *value = JSVAL_VOID;
return YES; }
212 switch (JSID_TO_INT(propID))
241 return JS_NewNumberValue(context, [entity scaleX], value);
244 return JS_NewNumberValue(context, [entity scaleY], value);
247 return JS_NewNumberValue(context, [entity scaleZ], value);
258 return JS_NewNumberValue(context, [entity hullHeatLevel], value);
261 return JS_NewNumberValue(context, [entity shaderFloat1], value);
264 return JS_NewNumberValue(context, [entity shaderFloat2], value);
267 *value = INT_TO_JSVAL([entity shaderInt1]);
271 *value = INT_TO_JSVAL([entity shaderInt2]);
291 if (result ==
nil) result = [NSDictionary dictionary];
308 if (!JSID_IS_INT(propID))
return YES;
318 NSString *sValue =
nil;
322 if (entity ==
nil)
return YES;
324 switch (JSID_TO_INT(propID))
328 if (sValue ==
nil || [sValue length] == 0)
330 if ([entity isBeacon])
332 [UNIVERSE clearBeacon:entity];
333 if ([
PLAYER nextBeacon] == entity)
335 [PLAYER setCompassMode:COMPASS_MODE_PLANET];
341 if ([entity isBeacon])
348 [UNIVERSE setNextBeacon:entity];
364 if (JS_ValueToBoolean(context, *value, &bValue))
373 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
382 if (colorForScript !=
nil || JSVAL_IS_NULL(*value))
390 if (JS_ValueToNumber(context, *value, &fValue))
401 if (JS_ValueToNumber(context, *value, &fValue))
412 if (JS_ValueToNumber(context, *value, &fValue))
423 if (JS_ValueToNumber(context, *value, &fValue))
431 if (JS_ValueToNumber(context, *value, &fValue))
439 if (JS_ValueToNumber(context, *value, &fValue))
447 if (JS_ValueToInt32(context, *value, &iValue))
455 if (JS_ValueToInt32(context, *value, &iValue))
492#define GET_THIS_EFFECT(THISENT) do { \
493 if (EXPECT_NOT(!JSVisualEffectGetVisualEffectEntity(context, OOJS_THIS, &THISENT))) return NO; \
494 if (OOIsStaleEntity(THISENT)) OOJS_RETURN_VOID; \
505 if ([thisEnt isSubEntity])
526 NSObject *result =
nil;
532 if (result ==
nil) result = [NSDictionary dictionary];
543 NSObject *result =
nil;
549 if (result ==
nil) result = [NSDictionary dictionary];
615 JSObject *params = NULL;
616 NSDictionary *materials;
617 NSDictionary *shaders;
618 BOOL withShaders = NO;
668 smooth:[effectDict oo_boolForKey:@"smooth" defaultValue:NO]
699 gotScale = JS_ValueToNumber(context,
OOJS_ARGV[0], &scale);
723 NSUInteger numSubEntitiesRestored = 0U;
#define OOJS_PROFILE_EXIT
#define OOJS_END_FULL_NATIVE
#define OOJS_BEGIN_FULL_NATIVE(context)
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_PROFILE_ENTER
OOINLINE JSClass * JSEntityClass(void)
OOINLINE JSObject * JSEntityPrototype(void)
BOOL JSValueToVector(JSContext *context, jsval value, Vector *outVector) NONNULL_FUNC
BOOL VectorToJSValue(JSContext *context, Vector vector, jsval *outValue) NONNULL_FUNC
static JSBool VisualEffectRemove(JSContext *context, uintN argc, jsval *vp)
static JSFunctionSpec sVisualEffectMethods[]
static JSBool VisualEffectRestoreSubEntities(JSContext *context, uintN argc, jsval *vp)
static JSBool VisualEffectSetMaterials(JSContext *context, uintN argc, jsval *vp)
#define GET_THIS_EFFECT(THISENT)
static JSObject * sVisualEffectPrototype
@ kVisualEffect_isBreakPattern
@ kVisualEffect_shaderFloat1
@ kVisualEffect_beaconCode
@ kVisualEffect_hullHeatLevel
@ kVisualEffect_scannerDisplayColor2
@ kVisualEffect_scannerDisplayColor1
@ kVisualEffect_beaconLabel
@ kVisualEffect_vectorRight
@ kVisualEffect_subEntities
@ kVisualEffect_shaderFloat2
@ kVisualEffect_scriptInfo
@ kVisualEffect_shaderInt1
@ kVisualEffect_shaderVector1
@ kVisualEffect_vectorForward
@ kVisualEffect_shaderInt2
@ kVisualEffect_shaderVector2
static JSBool VisualEffectScale(JSContext *context, uintN argc, jsval *vp)
static JSBool VisualEffectGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool VisualEffectGetMaterials(JSContext *context, uintN argc, jsval *vp)
static JSClass sVisualEffectClass
static JSPropertySpec sVisualEffectProperties[]
void InitOOJSVisualEffect(JSContext *context, JSObject *global)
static JSBool VisualEffectSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSBool VisualEffectSetShaders(JSContext *context, uintN argc, jsval *vp)
static JSBool VisualEffectGetShaders(JSContext *context, uintN argc, jsval *vp)
static JSBool VisualEffectSetMaterialsInternal(JSContext *context, uintN argc, jsval *vp, OOVisualEffectEntity *thisEnt, BOOL fromShaders)
static BOOL JSVisualEffectGetVisualEffectEntity(JSContext *context, JSObject *stationObj, OOVisualEffectEntity **outEntity)
void OOJSReportWarning(JSContext *context, NSString *format,...)
#define OOJS_PROP_READWRITE_CB
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
id OOJSNativeObjectFromJSObject(JSContext *context, JSObject *object)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)
#define OOJS_RETURN_OBJECT(o)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
#define OOJS_RETURN_BOOL(v)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
void OOJSRegisterSubclass(JSClass *subclass, JSClass *superclass)
OOINLINE jsval OOJSValueFromBOOL(int b) INLINE_CONST_FUNC
NSString * OOStringFromJSValueEvenIfNull(JSContext *context, jsval value)
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
#define OOJS_PROP_READONLY_CB
NSString * oo_jsClassName()
NSArray * subEntitiesForScript()
BOOL isVisibleToScripts()
OOColor * colorWithDescription:(id description)
NSArray * normalizedArray()
OOMaterial * materials[kOOMeshMaxMaterials]
instancetype meshWithName:cacheKey:materialDictionary:shadersDictionary:smooth:shaderMacros:shaderBindingTarget:(NSString *name,[cacheKey] NSString *cacheKey,[materialDictionary] NSDictionary *materialDict,[shadersDictionary] NSDictionary *shadersDict,[smooth] BOOL smooth,[shaderMacros] NSDictionary *macros,[shaderBindingTarget] id< OOWeakReferenceSupport > object)
void setMesh:(OOMesh *mesh)
OOColor * scannerDisplayColor2()
void setShaderVector2:(Vector value)
void setScaleZ:(GLfloat factor)
void setShaderVector1:(Vector value)
void removeSubEntity:(Entity< OOSubEntity > *sub)
void setScannerDisplayColor1:(OOColor *color)
OOColor * scannerDisplayColor1()
void setShaderFloat2:(GLfloat value)
NSArray * subEntitiesForScript()
void setScannerDisplayColor2:(OOColor *color)
void setScaleY:(GLfloat factor)
void setScaleX:(GLfloat factor)
NSDictionary * effectInfoDictionary()
void setBeaconLabel:(NSString *blabel)
void setIsBreakPattern:(BOOL bp)
void setShaderFloat1:(GLfloat value)
NSDictionary * scriptInfo
void setShaderInt1:(int value)
void setHullHeatLevel:(GLfloat value)
void setShaderInt2:(int value)
void setBeaconCode:(NSString *bcode)
NSDictionary * materialDefaults()