struct gmi_set* gmi_base_adjacent(struct gmi_model* m, struct gmi_ent* e, int dim) { int from_dim; struct agm_ent a; a = agm_from_gmi(e); from_dim = agm_dim_from_type(a.type); if (dim == from_dim - 1) return get_down(to_base(m)->topo, a); else if (dim == from_dim + 1) return get_up(to_base(m)->topo, a); gmi_fail("only one-level adjacencies supported"); return 0; }
struct gmi_iter* gmi_base_begin(struct gmi_model* m, int dim) { struct agm_ent* i; i = malloc(sizeof(*i)); *i = agm_first_ent(to_base(m)->topo, agm_type_from_dim(dim)); return (struct gmi_iter*)i; }
void SceneRenderState::renderMask(U32 mask) { constexpr bool validateRenderMask = false; if (validateRenderMask) { auto validateMask = [mask]() -> U32 { U32 validMask = 0; for (U32 stateIt = 1; stateIt <= to_base(RenderOptions::COUNT); ++stateIt) { U32 bitState = toBit(stateIt); if (BitCompare(mask, bitState)) { DIVIDE_ASSERT(static_cast<RenderOptions>(bitState) != RenderOptions::PLAY_ANIMATIONS, "SceneRenderState::renderMask error: can't update animation state directly!"); SetBit(validMask, bitState); } } return validMask; }; U32 parsedMask = validateMask(); DIVIDE_ASSERT(parsedMask != 0 && parsedMask == mask, "SceneRenderState::renderMask error: Invalid state specified!"); _stateMask = parsedMask; } else { _stateMask = mask; } }
struct gmi_ent* gmi_base_find(struct gmi_model* m, int dim, int tag) { struct agm_ent ae = gmi_look_up( to_base(m)->lookup, agm_type_from_dim(dim), tag); return gmi_from_agm(ae); }
void StorageReserveWidget::connects(){ QObject::connect(ui->plus_button, SIGNAL(clicked()), SLOT(add_position())); QObject::connect(ui->minus_button, SIGNAL(clicked()), SLOT(remove_position())); QObject::connect(ui->clear_button, SIGNAL(clicked()), SLOT(clear())); QObject::connect(ui->close_button, SIGNAL(clicked()), SIGNAL(switch_pipes())); QObject::connect(ui->tobase_button, SIGNAL(clicked()), SLOT(to_base())); }
void gmi_base_freeze(struct gmi_model* m) { struct gmi_base* b; int i; b = to_base(m); for (i = 0; i <= 3; ++i) gmi_freeze_lookup(b->lookup, i); }
void gmi_base_destroy(struct gmi_model* m) { struct gmi_base* b; b = to_base(m); gmi_free_lookup(b->lookup); agm_free(b->topo); free(b); }
bool compatible(const GenericDrawCommand& lhs, const GenericDrawCommand& rhs) { return (lhs._renderOptions & ~(to_base(CmdRenderOptions::CONVERT_TO_INDIRECT))) == (rhs._renderOptions & ~(to_base(CmdRenderOptions::CONVERT_TO_INDIRECT))) && lhs._bufferIndex == rhs._bufferIndex && lhs._primitiveType == rhs._primitiveType && lhs._patchVertexCount == rhs._patchVertexCount && IsSameBuffer(lhs._sourceBuffer, rhs._sourceBuffer); }
struct gmi_ent* gmi_base_next(struct gmi_model* m, struct gmi_iter* it) { struct agm_ent* i; struct agm_ent e; i = (struct agm_ent*)it; e = *i; *i = agm_next_ent(to_base(m)->topo, e); return gmi_from_agm(e); }
GFXShaderData::GPUData::GPUData() noexcept { _ProjectionMatrix.identity(); _InvProjectionMatrix.identity(); _ViewMatrix.identity(); _ViewProjectionMatrix.identity(); _cameraPosition.set(0.0f); _ViewPort.set(1.0f); _renderProperties.set(0.01f, 100.0f, 1.0f, 0.0f); for (U8 i = 0; i < to_base(Frustum::FrustPlane::COUNT); ++i) { _clipPlanes[i].set(0.0f); } }
CachedResource_ptr ImplResourceLoader<Material>::operator()() { Material_ptr ptr(MemoryManager_NEW Material(_context.gfx(), _cache, _loadingDescriptorHash, _descriptor.resourceName()), DeleteResource(_cache)); assert(ptr != nullptr); if (!load(ptr, _descriptor.onLoadCallback())) { ptr.reset(); } else { ptr->setHardwareSkinning(_descriptor.getEnumValue() == to_base(Object3D::ObjectFlag::OBJECT_FLAG_SKINNED)); } return ptr; }
PressReleaseActions::PressReleaseActions(U16 onPressAction, U16 onReleaseAction, U16 onLCtrlPressAction, U16 onLCtrlReleaseAction, U16 onRCtrlPressAction, U16 onRCtrlReleaseAction, U16 onLAltPressAction, U16 onLAltReleaseAction, U16 onRAltPressAction, U16 onRAltReleaseAction) { _actions[to_base(Action::PRESS)] = onPressAction; _actions[to_base(Action::RELEASE)] = onReleaseAction; _actions[to_base(Action::LEFT_CTRL_PRESS)] = onLCtrlPressAction; _actions[to_base(Action::LEFT_CTRL_RELEASE)] = onLCtrlReleaseAction; _actions[to_base(Action::RIGHT_CTRL_PRESS)] = onRCtrlPressAction; _actions[to_base(Action::RIGHT_CTRL_RELEASE)] = onRCtrlReleaseAction; _actions[to_base(Action::LEFT_ALT_PRESS)] = onLAltPressAction; _actions[to_base(Action::LEFT_ALT_RELEASE)] = onLAltReleaseAction; _actions[to_base(Action::RIGHT_ALT_PRESS)] = onRAltPressAction; _actions[to_base(Action::RIGHT_ALT_RELEASE)] = onRAltReleaseAction; }
/// After we loaded our mesh, we need to add submeshes as children nodes void Mesh::postLoad(SceneGraphNode& sgn) { static const U32 normalMask = to_base(ComponentType::NAVIGATION) | to_base(ComponentType::TRANSFORM) | to_base(ComponentType::BOUNDS) | to_base(ComponentType::RENDERING) | to_base(ComponentType::NAVIGATION); static const U32 skinnedMask = normalMask | to_base(ComponentType::ANIMATION) | to_base(ComponentType::INVERSE_KINEMATICS) | to_base(ComponentType::RAGDOLL); SceneGraphNodeDescriptor subMeshDescriptor; subMeshDescriptor._usageContext = sgn.usageContext(); subMeshDescriptor._instanceCount = sgn.instanceCount(); for (const SubMesh_ptr& submesh : _subMeshList) { subMeshDescriptor._node = submesh; subMeshDescriptor._componentMask = submesh->getObjectFlag(ObjectFlag::OBJECT_FLAG_SKINNED) ? skinnedMask : normalMask; if (sgn.get<RigidBodyComponent>() != nullptr) { subMeshDescriptor._componentMask |= to_base(ComponentType::RIGID_BODY); } subMeshDescriptor._name = Util::StringFormat("%s_%d", sgn.name().c_str(), submesh->getID()); SceneGraphNode* subSGN = sgn.addNode(subMeshDescriptor); if (BitCompare(subMeshDescriptor._componentMask, ComponentType::RIGID_BODY)) { subSGN->get<RigidBodyComponent>()->physicsGroup(sgn.get<RigidBodyComponent>()->physicsGroup()); } RenderingComponent* rComp = sgn.get<RenderingComponent>(); if (rComp != nullptr) { RenderingComponent* subRComp = subSGN->get<RenderingComponent>(); for (auto it : rComp->getShaderBuffers()) { subRComp->addShaderBuffer(it); } } } sgn.get<BoundsComponent>()->ignoreTransform(true); Object3D::postLoad(sgn); }
SceneRenderState::SceneRenderState(Scene& parentScene) : SceneComponent(parentScene), _stateMask(to_base(RenderOptions::PLAY_ANIMATIONS)), _renderPass(0), _grassVisibility(1.0f), _treeVisibility(1.0f), _generalVisibility(1.0f) { enableOption(RenderOptions::RENDER_GEOMETRY); _lod.set(25, 45, 85, 165); _fog.set(vec3<F32>(0.2f, 0.2f, 0.2f), 0.01f); _gizmoState = GizmoState::NO_GIZMO; }
char *ft_itoa_base(intmax_t value, int base) { char *str; str = NULL; if (value == 0) str = ft_strdup("0"); else if (base < 2 || base > 16) str = NULL; else if (base == 10) str = ft_imaxtoa(value); else str = to_base((uintmax_t)value, base); return (str); }
void SceneRenderState::toggleAxisLines() { static U32 selection = 0; Console::d_printfn(Locale::get(_ID("TOGGLE_SCENE_AXIS_GIZMO"))); selection = (selection + 1) % to_base(GizmoState::COUNT); switch (selection) { case 0: gizmoState(GizmoState::SELECTED_GIZMO); break; case 1: gizmoState(GizmoState::ALL_GIZMO); break; case 2: gizmoState(GizmoState::SCENE_GIZMO); break; case 3: gizmoState(GizmoState::NO_GIZMO); break; } }
static void display_char_hexa(char *str, int size) { int i; char *nbr_tmp; char current_char[2]; i = 0; current_char[1] = '\0'; while (i < 16 && i < size) { zero_to_complete((int) str[i], 2); nbr_tmp = to_base((int) str[i], "0123456789abcdef", 16); my_putstr(nbr_tmp); my_showstr(current_char); i = i + 1; if (!(i % 2)) my_putchar(' '); free(nbr_tmp); } }
int main(){ int k, n; while (scanf("%d%d%s", &k, &n, str) != EOF){ // Init. memset(vis, 0, sizeof(vis)); memset(state, 0, sizeof(state)); memset(solve, 0, sizeof(solve)); ok = 0; // Handle. to_base(k); for (int i = 0; i < n; i++) solve[i] = str[i] - '0'; dfs(n, 0); if(ok) puts("REACHABLE"); else puts("GARDEN OF EDEN"); } return 0; }
void gmi_base_unfreeze(struct gmi_model* m) { struct gmi_base* b; b = to_base(m); gmi_unfreeze_lookups(b->lookup); }
static void display_address(int *current_address) { zero_to_complete(*current_address, 8); my_putstr(to_base(*current_address, "0123456789abcdef", 16)); *current_address = *current_address + 16; }
// Order: luminance calc -> bloom -> tonemap void BloomPreRenderOperator::execute(const Camera& camera, GFX::CommandBuffer& bufferInOut) { PipelineDescriptor pipelineDescriptor; pipelineDescriptor._stateHash = _context.get2DStateBlock(); GenericDrawCommand triangleCmd; triangleCmd._primitiveType = PrimitiveType::TRIANGLES; triangleCmd._drawCount = 1; RenderTargetHandle screen = _parent.inputRT(); TextureData data = screen._rt->getAttachment(RTAttachmentType::Colour, 0).texture()->getData(); //screen GFX::BindDescriptorSetsCommand descriptorSetCmd; descriptorSetCmd._set._textureData.setTexture(data, to_U8(ShaderProgram::TextureUsage::UNIT0)); GFX::EnqueueCommand(bufferInOut, descriptorSetCmd); pipelineDescriptor._shaderProgramHandle = _bloomCalc->getID(); GFX::BindPipelineCommand pipelineCmd; pipelineCmd._pipeline = _context.newPipeline(pipelineDescriptor); GFX::EnqueueCommand(bufferInOut, pipelineCmd); // Step 1: generate bloom // render all of the "bright spots" GFX::BeginRenderPassCommand beginRenderPassCmd; beginRenderPassCmd._target = _bloomOutput._targetID; beginRenderPassCmd._name = "DO_BLOOM_PASS"; GFX::EnqueueCommand(bufferInOut, beginRenderPassCmd); GFX::DrawCommand drawCmd; drawCmd._drawCommands.push_back(triangleCmd); GFX::EnqueueCommand(bufferInOut, drawCmd); GFX::EndRenderPassCommand endRenderPassCmd; GFX::EnqueueCommand(bufferInOut, endRenderPassCmd); // Step 2: blur bloom _context.blurTarget(_bloomOutput, _bloomBlurBuffer[0], _bloomBlurBuffer[1], RTAttachmentType::Colour, 0, 10, bufferInOut); // Step 3: apply bloom GFX::BlitRenderTargetCommand blitRTCommand; blitRTCommand._source = screen._targetID; blitRTCommand._destination = _bloomBlurBuffer[0]._targetID; blitRTCommand._blitColours.emplace_back(); GFX::EnqueueCommand(bufferInOut, blitRTCommand); TextureData data0 = _bloomBlurBuffer[0]._rt->getAttachment(RTAttachmentType::Colour, 0).texture()->getData(); //Screen TextureData data1 = _bloomBlurBuffer[1]._rt->getAttachment(RTAttachmentType::Colour, 0).texture()->getData(); //Bloom descriptorSetCmd._set._textureData.setTexture(data0, to_U8(ShaderProgram::TextureUsage::UNIT0)); descriptorSetCmd._set._textureData.setTexture(data1, to_U8(ShaderProgram::TextureUsage::UNIT1)); GFX::EnqueueCommand(bufferInOut, descriptorSetCmd); pipelineDescriptor._shaderProgramHandle = _bloomApply->getID(); pipelineDescriptor._shaderFunctions[to_base(ShaderType::FRAGMENT)].clear(); pipelineCmd._pipeline = _context.newPipeline(pipelineDescriptor); GFX::EnqueueCommand(bufferInOut, pipelineCmd); _bloomApplyConstants.set("bloomFactor", GFX::PushConstantType::FLOAT, _bloomFactor); GFX::SendPushConstantsCommand pushConstantsCommand; pushConstantsCommand._constants = _bloomApplyConstants; GFX::EnqueueCommand(bufferInOut, pushConstantsCommand); beginRenderPassCmd._target = screen._targetID; beginRenderPassCmd._descriptor = _screenOnlyDraw; GFX::EnqueueCommand(bufferInOut, beginRenderPassCmd); GFX::EnqueueCommand(bufferInOut, drawCmd); GFX::EnqueueCommand(bufferInOut, endRenderPassCmd); }
int gmi_base_tag(struct gmi_model* m, struct gmi_ent* e) { return gmi_get_lookup(to_base(m)->lookup, agm_from_gmi(e)); }
void gmi_base_set_tag(struct gmi_model* m, struct gmi_ent* e, int tag) { struct gmi_base* b; b = to_base(m); gmi_set_lookup(b->lookup, agm_from_gmi(e), tag); }
struct agm* gmi_base_topo(struct gmi_model* m) { return to_base(m)->topo; }