/* * setValue calls onValueChange which will determine how * the value is handled. If the value VALUE_MODIFY_IGNORE * is returned, the value is silently discarded without * changing the value of the JavaScript object. This is * useful in the case where the value has already been changed * by calling forceSetValue in the overridden onValueChange. */ VALUE_MODIFY TiObject::setValue(Handle<Value> value) { clearValue(); VALUE_MODIFY modify = onValueChange(value_, value); if (modify != VALUE_MODIFY_ALLOW) { if (modify == VALUE_MODIFY_IGNORE) { modify = VALUE_MODIFY_ALLOW; } return modify; } TiObject* parent = getParentObject(); if (parent != NULL) { modify = parent->onChildValueChange(this, value_, value); parent->release(); if (modify != VALUE_MODIFY_ALLOW) { if (modify == VALUE_MODIFY_IGNORE) { modify = VALUE_MODIFY_ALLOW; } return modify; } } value_ = Persistent<Value>::New(value); return modify; }
void MaterialParameter::setValue(int value) { clearValue(); _value.intValue = value; _type = MaterialParameter::INT; }
void MaterialParameter::setValue(float value) { clearValue(); _value.floatValue = value; _type = MaterialParameter::FLOAT; }
void MaterialParameter::setValue(const int* values, unsigned int count) { clearValue(); _value.intPtrValue = const_cast<int*> (values); _count = count; _type = MaterialParameter::INT_ARRAY; }
void MaterialParameter::setValue(const float* values, unsigned int count) { clearValue(); _value.floatPtrValue = const_cast<float*> (values); _count = count; _type = MaterialParameter::FLOAT_ARRAY; }
void MaterialParameter::setValue(const Matrix* values, unsigned int count) { clearValue(); _value.floatPtrValue = const_cast<Matrix&> (values[0]).m; _count = count; _type = MaterialParameter::MATRIX; }
void MaterialParameter::setValue(const Vector4* values, unsigned int count) { clearValue(); _value.floatPtrValue = const_cast<float*> (&values[0].x); _count = count; _type = MaterialParameter::VECTOR4; }
bool QgsSpinBox::shouldShowClearForValue( const int value ) const { if ( !mShowClearButton || !isEnabled() ) { return false; } return value != clearValue(); }
TiObject::~TiObject() { clearValue(); if (nativeObject_ != NULL) { nativeObject_->release(); nativeObject_ = NULL; } }
void MaterialParameter::setValue(const Texture::Sampler* sampler) { GP_ASSERT(sampler); clearValue(); const_cast<Texture::Sampler*>(sampler)->addRef(); _value.samplerValue = sampler; _type = MaterialParameter::SAMPLER; }
void MaterialParameter::setValue(const C3DTexture* texture) { clearValue(); if (texture) { _value.textureValue = texture; _type = MaterialParameter::TEXTURE; } }
NS_CC_BEGIN MaterialParameter::MaterialParameter(const char* name) :_type(MaterialParameter::NONE) ,_count(1) ,_dynamic(false) ,_name(name) ,_uniform(nullptr) { clearValue(); }
void MaterialParameter::setValue(const C3DSampler* sampler) { clearValue(); if (sampler) { const_cast<C3DSampler*>(sampler)->retain(); _value.samplerValue = sampler; _type = MaterialParameter::SAMPLER; } }
void QgsFilterLineEdit::mousePressEvent( QMouseEvent* e ) { if ( !mFocusInEvent ) QLineEdit::mousePressEvent( e ); else mFocusInEvent = false; if ( shouldShowClear() && clearRect().contains( e->pos() ) ) { clearValue(); } }
void MaterialParameter::setValue(const Vector4& value) { clearValue(); // Copy data by-value into a dynamic array. float* array = new float[4]; memcpy(array, &value.x, sizeof(float) * 4); _value.floatPtrValue = array; _dynamic = true; _count = 1; _type = MaterialParameter::VECTOR4; }
Texture::Sampler* MaterialParameter::setValue(const char* texturePath, bool generateMipmaps) { GP_ASSERT(texturePath); clearValue(); Texture::Sampler* sampler = Texture::Sampler::create(texturePath, generateMipmaps); if (sampler) { _value.samplerValue = sampler; _type = MaterialParameter::SAMPLER; } return sampler; }
void MaterialParameter::setValue(const Texture::Sampler** samplers, unsigned int count) { GP_ASSERT(samplers); clearValue(); for (unsigned int i = 0; i < count; ++i) { const_cast<Texture::Sampler*>(samplers[i])->addRef(); } _value.samplerArrayValue = samplers; _count = count; _type = MaterialParameter::SAMPLER_ARRAY; }
// reset the parser JSONStreamingParser &JSONStreamingParser::reset(void) { state = PARSER_IDLE; flags = 0; level = 0; levels = 0; // clear stored name and value clearName(); clearValue(); return *this; }
int QgsSpinBox::valueFromText( const QString &text ) const { if ( !mExpressionsEnabled ) { return QSpinBox::valueFromText( text ); } QString trimmedText = stripped( text ); if ( trimmedText.isEmpty() ) { return mShowClearButton ? clearValue() : value(); } return std::round( QgsExpression::evaluateToDouble( trimmedText, value() ) ); }
// execute callback and clear name/value void JSONStreamingParser::doCallback(const char *val) { if(callback) { const char *nam = name; if(!nam) nam = ""; if(!val) val = value; if(!val) val = ""; callback(0, level, nam, val, callbackObject); } clearName(); clearValue(); }
IRenderer::Impl::Impl(HWND hwnd, U32 windowWidth, U32 windowHeight, IRenderer* pRenderer) : m_viewport(static_cast<F32>(windowWidth), static_cast<F32>(windowHeight)) , m_scissorRect(windowWidth, windowHeight) , m_psoManager(&m_device, &m_resCache, &m_rootSignature) , m_pRenderer(pRenderer) { // TEMP: Select the second(integrated card) adapter due to some problem with nvidia I can't pinpoint. auto pAdapter = m_hwCaps.GetDisplayAdapter(1).Get(); m_device.Init(pAdapter.Get()); m_hwCaps.CheckMSAASupport(m_device.Get()); m_commandQueue.Init(m_device.Get()); m_swapChain.Init(m_device.Get(), m_commandQueue.Get(), hwnd); m_commandAllocator.Init(m_device.Get()); CreateRootSignature(); // Create Resources ResourceConfig descCB(ResourceType::BUFFER, sizeof(XMFLOAT4X4)); m_viewProjConstBuffer.CreateCommited(m_device.Get(), descCB, &m_pViewProjDataBegin); // Create Descriptor Heaps m_cbDescHeap.Init(m_device.Get(), DescHeapType::CB_SR_UA, MAX_RENDER_ITEMS, true); m_dsvDescHeap.Init(m_device.Get(), DescHeapType::DEPTH_STENCIL, 1); // Create Depth Buffer ClearValue clearValue(DXGI_FORMAT_D32_FLOAT, 1.0f); ResourceConfig dbConfig(ResourceType::TEXTURE2D, 800, 600, DXGI_FORMAT_R32_TYPELESS, TextureLayout::UNKNOWN, ResourceFlag::ALLOW_DEPTH_STENCIL); m_depthBuffer.CreateCommited(m_device.Get(), dbConfig, nullptr, nullptr, 0, D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_STATE_DEPTH_WRITE, &clearValue); DepthStencilView dsvDesc; m_device.Get()->CreateDepthStencilView(m_depthBuffer.Get(), &dsvDesc, m_dsvDescHeap.GetCPUHandle(0)); // Create a command list m_commandList.Init(m_device.Get(), m_commandAllocator.Get()); m_commandList.Close(); // Create synchronization objects m_fence.Init(m_device.Get(), 0); m_currentFence = 1; m_handleEvent = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS); // Synchronize WaitForGPU(); m_resCache.Init(m_device.Get()); }
C3DSampler* MaterialParameter::setValue(const char* texturePath, bool generateMipmaps) { if (texturePath) { clearValue(); C3DSampler* sampler = C3DSampler::create(texturePath, generateMipmaps); if (sampler) { _value.samplerValue = sampler; _type = MaterialParameter::SAMPLER; } return sampler; } return nullptr; }
void MaterialParameter::setValue(const Matrix& value) { // If this parameter is already storing a single dynamic matrix, no need to clear it. if (!(_dynamic && _count == 1 && _type == MaterialParameter::MATRIX && _value.floatPtrValue != NULL)) { clearValue(); // Allocate a new dynamic matrix. _value.floatPtrValue = new float[16]; } memcpy(_value.floatPtrValue, value.m, sizeof(float) * 16); _dynamic = true; _count = 1; _type = MaterialParameter::MATRIX; }
// // qname - name of Q // data - Data to send (array of unsigned chars) // len - Length of data // // Returns length 0f data sent or an error (<0) // int enQueue(int ser, char *qname, char *data, int len) { char cmdBuffer[255]; Value v; int status; sprintf(cmdBuffer,"LPUSH %s %s", qname,data); redisCommand(ser,(char *)cmdBuffer); v=redisReply(ser); // // Check type for error // if(v.type == ERROR) { fprintf(stderr,"ERROR: enQueue ><\n"); } clearValue(v); return(status); }
void MaterialParameter::setMatrixArray(const Matrix* values, unsigned int count, bool copy) { GP_ASSERT(values); clearValue(); if (copy) { _value.floatPtrValue = new float[16 * count]; memcpy(_value.floatPtrValue, const_cast<Matrix&> (values[0]).m, sizeof(float) * 16 * count); _dynamic = true; } else { _value.floatPtrValue = const_cast<Matrix&> (values[0]).m; } _count = count; _type = MaterialParameter::MATRIX; }
void MaterialParameter::setVector4Array(const Vector4* values, unsigned int count, bool copy) { GP_ASSERT(values); clearValue(); if (copy) { _value.floatPtrValue = new float[4 * count]; memcpy(_value.floatPtrValue, const_cast<float*> (&values[0].x), sizeof(float) * 4 * count); _dynamic = true; } else { _value.floatPtrValue = const_cast<float*> (&values[0].x); } _count = count; _type = MaterialParameter::VECTOR4; }
void MaterialParameter::setIntArray(const int* values, unsigned int count, bool copy) { GP_ASSERT(values); clearValue(); if (copy) { _value.intPtrValue = new int[count]; memcpy(_value.intPtrValue, values, sizeof(int) * count); _dynamic = true; } else { _value.intPtrValue = const_cast<int*> (values); } _count = count; _type = MaterialParameter::INT_ARRAY; }
void MaterialParameter::setFloatArray(const float* values, unsigned int count, bool copy) { GP_ASSERT(values); clearValue(); if (copy) { _value.floatPtrValue = new float[count]; memcpy(_value.floatPtrValue, values, sizeof(float) * count); _dynamic = true; } else { _value.floatPtrValue = const_cast<float*> (values); } _count = count; _type = MaterialParameter::FLOAT_ARRAY; }
// // TODO Need to add a timeout. Only wait for specified tome, then return a failure. // int redisPing(int ser) { char cmdBuffer[255]; Value v; int status=0; bzero(cmdBuffer,255); strcpy(cmdBuffer,(char *)"PING"); redisCommand(ser,(char *)cmdBuffer); v=redisReply(ser); if( v.type== STATUS) { if ( !strcmp(v.x.string,(char *)"PONG")) { status = 1; } else { status = 0; } } clearValue(v); return(status); }
void MaterialParameter::setSamplerArray(const Texture::Sampler** values, unsigned int count, bool copy) { GP_ASSERT(values); clearValue(); if (copy) { _value.samplerArrayValue = new const Texture::Sampler*[count]; memcpy(_value.samplerArrayValue, values, sizeof(Texture::Sampler*) * count); _dynamic = true; } else { _value.samplerArrayValue = values; } for (unsigned int i = 0; i < count; ++i) { const_cast<Texture::Sampler*>(_value.samplerArrayValue[i])->addRef(); } _count = count; _type = MaterialParameter::SAMPLER_ARRAY; }