public static void amEffectDraw(AppMain.AMS_AME_ECB ecb, AppMain.NNS_TEXLIST texlist, uint state) { ecb.drawState = state; if (AppMain._am_enable_draw == 0 || ecb.entry_num <= 0) { return; } if ((double)ecb.bounding.radius > 0.0) { AppMain.NNS_VECTOR4D pPos = new AppMain.NNS_VECTOR4D(); if (AppMain._amEffectFrustumCulling(pPos, AppMain._am_view_frustum, ecb.bounding) == 0) { return; } //AppMain.GlobalPool<AppMain.NNS_VECTOR4D>.Release(pPos); } for (AppMain.AMS_AME_ENTRY amsAmeEntry = ecb.entry_head; amsAmeEntry != null; amsAmeEntry = (AppMain.AMS_AME_ENTRY)amsAmeEntry.next) { AppMain.AMS_AME_RUNTIME runtime = amsAmeEntry.runtime; runtime.texlist = texlist; if (AppMain.AMD_AME_SUPER_CLASS_ID(runtime.node) == 512 && runtime.active_num != (short)0) { int num = AppMain._am_particle_func[(AppMain.AMD_AME_CLASS_ID(runtime.node) << 2) + 2]((object)runtime); } } }
private static AppMain.AMS_AME_ECB _amEffectCreate( AppMain.AMS_AME_HEADER header, int attribute, int priority) { AppMain.AMS_AME_ECB amsAmeEcb = AppMain._am_ecb_ref[AppMain._am_ecb_alloc]; ++AppMain._am_ecb_alloc; if (AppMain._am_ecb_alloc >= 128) { AppMain._am_ecb_alloc = 0; } amsAmeEcb.Clear(); amsAmeEcb.attribute = attribute; amsAmeEcb.priority = priority; amsAmeEcb.transparency = 256; amsAmeEcb.size_rate = 1f; AppMain.amVectorInit(ref amsAmeEcb.translate); AppMain.amQuatInit(ref amsAmeEcb.rotate); amsAmeEcb.bounding.Assign(header.bounding); AppMain.AMS_AME_ECB next = (AppMain.AMS_AME_ECB)AppMain._am_ecb_head.next; while (next != AppMain._am_ecb_tail && next.priority <= priority) { next = (AppMain.AMS_AME_ECB)next.next; } next.prev.next = (AppMain.AMS_AME_LIST)amsAmeEcb; amsAmeEcb.prev = next.prev; next.prev = (AppMain.AMS_AME_LIST)amsAmeEcb; amsAmeEcb.next = (AppMain.AMS_AME_LIST)next; AppMain.AMS_AME_CREATE_PARAM amsAmeCreateParam = new AppMain.AMS_AME_CREATE_PARAM(); AppMain.NNS_VECTOR4D amEffectCreateVec = AppMain._amEffectCreate_vec; AppMain.AMS_AME_NODE sibling = header.node[0]; AppMain.amVectorInit(ref amEffectCreateVec); for (; sibling != null; sibling = sibling.sibling) { amsAmeCreateParam.ecb = amsAmeEcb; amsAmeCreateParam.runtime = (AppMain.AMS_AME_RUNTIME)null; amsAmeCreateParam.node = sibling; amsAmeCreateParam.position = amEffectCreateVec; amsAmeCreateParam.velocity = amEffectCreateVec; amsAmeCreateParam.parent_position = amEffectCreateVec; amsAmeCreateParam.parent_velocity = amEffectCreateVec; switch (AppMain.AMD_AME_SUPER_CLASS_ID(sibling)) { case 256: AppMain._amCreateRuntimeEmitter(amsAmeCreateParam).state |= 8192; break; case 512: AppMain._amCreateRuntimeParticle(amsAmeCreateParam).state |= 8192; break; } } amsAmeEcb.skip_update = 1; return(amsAmeEcb); }
public static void _amEffectFinalize(AppMain.AMS_AME_ECB ecb) { for (AppMain.AMS_AME_ENTRY entry = ecb.entry_head; entry != null; entry = (AppMain.AMS_AME_ENTRY)entry.next) { AppMain.AMS_AME_RUNTIME runtime = entry.runtime; if (AppMain.AMD_AME_SUPER_CLASS_ID(runtime.node) == 256 && runtime.parent_runtime != null) { AppMain.amEffectDisconnectLink((AppMain.AMS_AME_LIST)runtime); --runtime.parent_runtime.work_num; } AppMain._amFreeRuntime(entry.runtime); AppMain._amDelEntry(ecb, entry); } ecb.prev.next = ecb.next; ecb.next.prev = ecb.prev; AppMain._am_ecb_ref[AppMain._am_ecb_free] = ecb; ++AppMain._am_ecb_free; if (AppMain._am_ecb_free < 128) { return; } AppMain._am_ecb_free = 0; }
public static bool AMD_AME_IS_FIELD(AppMain.AMS_AME_NODE node) { return(AppMain.AMD_AME_SUPER_CLASS_ID(node) == 768); }
public static bool AMD_AME_IS_PARTICLE(AppMain.AMS_AME_NODE node) { return(AppMain.AMD_AME_SUPER_CLASS_ID(node) == 512); }
public static bool AMD_AME_IS_EMITTER(AppMain.AMS_AME_NODE node) { return(AppMain.AMD_AME_SUPER_CLASS_ID(node) == 256); }
private static int _amUpdateOmni(object r) { AppMain.AMS_AME_RUNTIME amsAmeRuntime1 = (AppMain.AMS_AME_RUNTIME)r; AppMain.AMS_AME_NODE_OMNI node = (AppMain.AMS_AME_NODE_OMNI)amsAmeRuntime1.node; AppMain.AMS_AME_RUNTIME_WORK_OMNI work = (AppMain.AMS_AME_RUNTIME_WORK_OMNI)amsAmeRuntime1.work; work.time += AppMain._am_unit_frame; if ((double)work.time <= 0.0) { return(0); } if ((double)node.life != -1.0 && (double)work.time >= (double)node.life) { return(1); } AppMain.NNS_VECTOR4D amEffectVel = AppMain._amEffect_vel; AppMain.amVectorScale(ref amEffectVel, work.velocity, AppMain._am_unit_time); AppMain.amVectorAdd(ref work.position, amEffectVel); float sizeRate = amsAmeRuntime1.ecb.size_rate; work.offset = node.offset * sizeRate; work.offset_chaos = node.offset_chaos * sizeRate; AppMain.NNS_VECTOR4D amEffectPosition = AppMain._amEffect_position; AppMain.NNS_VECTOR4D amEffectVelocity = AppMain._amEffect_velocity; AppMain.NNS_VECTOR4D amEffectDirection = AppMain._amEffect_direction; AppMain.AMS_AME_LIST next = amsAmeRuntime1.child_head.next; for (AppMain.AMS_AME_LIST childTail = amsAmeRuntime1.child_tail; next != childTail; next = next.next) { AppMain.AMS_AME_RUNTIME amsAmeRuntime2 = (AppMain.AMS_AME_RUNTIME)next; amsAmeRuntime2.amount += node.frequency * AppMain._am_unit_frame; while ((double)amsAmeRuntime2.amount >= 1.0) { --amsAmeRuntime2.amount; ++amsAmeRuntime2.count; if ((double)node.max_count != -1.0 && (double)((int)amsAmeRuntime2.work_num + (int)amsAmeRuntime2.active_num) < (double)node.max_count) { AppMain.AMS_AME_CREATE_PARAM effectCreateParam = AppMain._amEffect_create_param; effectCreateParam.Clear(); AppMain.amVectorRandom(ref amEffectDirection); AppMain.amVectorScale(ref amEffectVelocity, amEffectDirection, work.offset + work.offset_chaos * AppMain.nnRandom()); amEffectPosition.Assign(amEffectVelocity); AppMain.amVectorScale(ref amEffectVelocity, amEffectDirection, node.speed + node.speed_chaos * AppMain.nnRandom()); effectCreateParam.ecb = amsAmeRuntime1.ecb; effectCreateParam.runtime = amsAmeRuntime2; effectCreateParam.node = amsAmeRuntime2.node; effectCreateParam.parent_position = work.position; effectCreateParam.parent_velocity = work.velocity; effectCreateParam.position = amEffectPosition; effectCreateParam.velocity = amEffectVelocity; switch (AppMain.AMD_AME_SUPER_CLASS_ID(amsAmeRuntime2.node)) { case 256: AppMain._amCreateEmitter(effectCreateParam); continue; case 512: AppMain._amCreateParticle(effectCreateParam); continue; default: continue; } } } } return(0); }
private static int _amUpdateDirectional(object r) { AppMain.AMS_AME_RUNTIME amsAmeRuntime1 = (AppMain.AMS_AME_RUNTIME)r; AppMain.AMS_AME_NODE_DIRECTIONAL node = (AppMain.AMS_AME_NODE_DIRECTIONAL)amsAmeRuntime1.node; AppMain.AMS_AME_RUNTIME_WORK_DIRECTIONAL runtimeWorkDirectional = new AppMain.AMS_AME_RUNTIME_WORK_DIRECTIONAL(amsAmeRuntime1.work); runtimeWorkDirectional.time += AppMain._am_unit_frame; if ((double)runtimeWorkDirectional.time <= 0.0) { return(0); } if ((double)node.life != -1.0 && (double)runtimeWorkDirectional.time >= (double)node.life) { return(1); } AppMain.NNS_VECTOR4D amEffectVel = AppMain._amEffect_vel; AppMain.amVectorScale(ref amEffectVel, runtimeWorkDirectional.velocity, AppMain._am_unit_time); AppMain.amVectorAdd(ref runtimeWorkDirectional.position, amEffectVel); runtimeWorkDirectional.spread += node.spread_variation * AppMain._am_unit_time; AppMain.NNS_MATRIX amEffectMtx = AppMain._amEffect_mtx; AppMain.nnMakeUnitMatrix(amEffectMtx); AppMain.amMatrixPush(amEffectMtx); AppMain.NNS_QUATERNION rotate = runtimeWorkDirectional.rotate; AppMain.amQuatToMatrix((AppMain.NNS_MATRIX)null, ref rotate, null); runtimeWorkDirectional.rotate = rotate; AppMain.AMS_AME_LIST next = amsAmeRuntime1.child_head.next; AppMain.AMS_AME_LIST childTail = amsAmeRuntime1.child_tail; AppMain.NNS_VECTOR4D amEffectPosition = AppMain._amEffect_position; AppMain.NNS_VECTOR4D amEffectVelocity = AppMain._amEffect_velocity; AppMain.NNS_VECTOR4D amEffectDirection = AppMain._amEffect_direction; for (; next != childTail; next = next.next) { AppMain.AMS_AME_RUNTIME amsAmeRuntime2 = (AppMain.AMS_AME_RUNTIME)next; amsAmeRuntime2.amount += node.frequency * AppMain._am_unit_frame; while ((double)amsAmeRuntime2.amount >= 1.0) { --amsAmeRuntime2.amount; ++amsAmeRuntime2.count; if ((double)node.max_count != -1.0 && (double)((int)amsAmeRuntime2.work_num + (int)amsAmeRuntime2.active_num) < (double)node.max_count) { AppMain.AMS_AME_CREATE_PARAM effectCreateParam = AppMain._amEffect_create_param; effectCreateParam.Clear(); AppMain.amEffectRandomConeVectorDeg(ref amEffectDirection, runtimeWorkDirectional.spread); AppMain.amMatrixCalcPoint(amEffectDirection, amEffectDirection); AppMain.amVectorScale(ref amEffectVelocity, ref amEffectDirection, node.offset + node.offset_chaos * AppMain.nnRandom()); amEffectPosition.Assign(amEffectVelocity); AppMain.amVectorScale(ref amEffectVelocity, ref amEffectDirection, node.speed + node.speed_chaos * AppMain.nnRandom()); effectCreateParam.ecb = amsAmeRuntime1.ecb; effectCreateParam.runtime = amsAmeRuntime2; effectCreateParam.node = amsAmeRuntime2.node; effectCreateParam.parent_position = runtimeWorkDirectional.position; effectCreateParam.parent_velocity = runtimeWorkDirectional.velocity; effectCreateParam.position = amEffectPosition; effectCreateParam.velocity = amEffectVelocity; switch (AppMain.AMD_AME_SUPER_CLASS_ID(amsAmeRuntime2.node)) { case 256: AppMain._amCreateEmitter(effectCreateParam); continue; case 512: AppMain._amCreateParticle(effectCreateParam); continue; default: continue; } } } } AppMain.amMatrixPop(); return(0); }