Пример #1
0
    ConvexHullShape& ConvexHullShape::getDefault()
    {
        static WeakReference<ConvexHullShape> defShape;

        if (defShape.expired())
        {
            defShape = static_ref_cast<ConvexHullShape>(ResourceManager::getEmpty<ConvexHullShape>("jop_default_staticmeshshape").getReference());
            defShape->m_shape = std::make_unique<btCapsuleShape>(0.5f, 2.f);

            defShape->setPersistence(0);
        }

        return *defShape;
    }
Пример #2
0
            DebugDraw()
                : m_buffer(VertexBuffer::Type::ArrayBuffer, Buffer::Usage::DynamicDraw)
            {
                if (shdr.expired())
                {
                    shdr = static_ref_cast<ShaderProgram>(ResourceManager::getEmpty<ShaderProgram>("jop_physics_debug_shader").getReference());

                    if (!shdr->isValid())
                    {
                        Shader vertex("");
                        vertex.load(std::string(reinterpret_cast<const char*>(jopr::physicsDebugShaderVert), sizeof(jopr::physicsDebugShaderVert)), Shader::Type::Vertex, true);
                        Shader frag("");
                        frag.load(std::string(reinterpret_cast<const char*>(jopr::physicsDebugShaderFrag), sizeof(jopr::physicsDebugShaderFrag)), Shader::Type::Fragment, true);

                        JOP_ASSERT_EVAL(shdr->load("", vertex, frag), "Failed to compile physics debug shader!");
                    }
                }
            }