Пример #1
0
StarsGeode::StarsGeode(const char* brightStarsFilePath)
:   osg::Geode()

,   m_program(new osg::Program)
,   m_vShader(new osg::Shader(osg::Shader::VERTEX))
,   m_gShader(new osg::Shader(osg::Shader::GEOMETRY))
,   m_fShader(new osg::Shader(osg::Shader::FRAGMENT))

,   u_R(NULL)
,   u_q(NULL)
,   u_noise1(NULL)

,   u_color(NULL)
,   u_glareIntensity(NULL)
,   u_glareScale(NULL)
,   u_apparentMagnitude(NULL)
,   u_scattering(NULL)
,   u_scintillations(NULL)
,   u_scale(NULL)
{
    setName("Stars");

    osg::StateSet* stateSet = getOrCreateStateSet();

    setupNode(stateSet, brightStarsFilePath);
    setupUniforms(stateSet);
    setupShader(stateSet);
    setupTextures(stateSet);
};
Пример #2
0
bool
CKLBUISimpleItem::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, const char* asset) 
{
    if(!setupNode()) { return false; }
	bool bResult = initCore(order,x,y,asset);
	bResult = registUI(pParent, bResult);
	if(pNode) {
		pParent->getNode()->removeNode(getNode());
		pNode->addNode(getNode());
	}
	return bResult;
}
Пример #3
0
int main() {
    ev::io http;
    ev::io node;
    
    setupHTTP(http);
    setupNode(node);
    
    Manager::init();
    CommStatic::init();
    ev::loop_ref loop               = EV_DEFAULT;
    loop.loop(EVBACKEND_EPOLL);
    
	return 0;
}
Пример #4
0
void DiagramWindow::paste()
{
    QString str = QApplication::clipboard()->text();
    QStringList parts = str.split(" ");

    if((parts.count() >= 5) && (parts.first() == "Node"))
    {
        Node *node = new Node;
        node->setText(QStringList(parts.mid(4)).join(" "));
        node->setTextColor(QColor(parts[1]));
        node->setOutlineColor(QColor(parts[2]));
        node->setBackgroundColor(QColor(parts[3]));
        setupNode(node);
    }
}
Пример #5
0
/**
 * Server function that listens for messages from clients
 */
void *server(void *token)
{
  me.self = setupNode();
  char message[BUFFER_LENGTH];
  int numNodes = 0;
  char *line = NULL;
  size_t len = 0;
  ssize_t read;

  do {
    //sleep(3);
    me.endpoints_fp = fopen(ENDPOINTS, "a+");
  } while (me.endpoints_fp == NULL);

  while ((read = getline(&line, &len, me.endpoints_fp)) != -1) {
    line[read - 1] = '\0';
    read--;
    numNodes++;
    debug("Read %s from endpoints file", line);
  }
  me.id = numNodes;
  debug("Done reading endpoints file, we have id: %d", me.id);

  if (args.num_nodes - 1 == numNodes) {
    debug("We are the last process");
    me.last_process = TRUE;
  }
  fprintf(me.endpoints_fp, "%s\n", getNodeInfo(me.self));
  debug("Node info written to endpoints file");
  fclose(me.endpoints_fp);

  if (!me.last_process) {
    // wait for OK message
    debug("Waiting for \"OK\" message");
    if (recvfrom(me.self->socket, message, BUFFER_LENGTH, 0, NULL, NULL) == -1) {
      log_err("Failed to receive message");
    }
    debug("Received message %s", message);
    if (strcmp(message, "OK") == 0) {
      debug("Got the \"OK\"");
    }
  }

  pthread_barrier_wait(&me.barrier);
  free(line);
  server_listen(message);
}
Пример #6
0
bool CKLBUIMultiImgItem::init(CKLBUITask* pParent, CKLBNode* pNode, u32 order, float x, float y, u32 idx, const char** pArrayAsset, u32* pArrayIndexes, u32 assetCount) {
	if(!setupNode()) return false;

	//
	// Create array and load resources.
	//
	u32 max = 0;
	for(u32 i = 0; i < assetCount; i++) {
		u32 idxImg = pArrayIndexes[i];
        if(max < idxImg) { max = idxImg; }
	}
	
	max++;

	IMGITEM* items = KLBNEWA(IMGITEM, max);
	if(!items) { return false; }

	// Reset all handle to NULL
	for(u32 i=0; i < max; i++) {
		items[i].handle	= 0;
		items[i].sprite = NULL;
	}

	CKLBRenderingManager& rdr = CKLBRenderingManager::getInstance();
	for(u32 i = 0; i < assetCount; i++) {
		const char* name = pArrayAsset[i];
		u32 idxImg = pArrayIndexes[i];
		u32 handle;
		CKLBAsset * pAsset = CKLBUtility::loadAsset(name, &handle, NULL);
		if(pAsset->getAssetType() == ASSET_IMAGE) {
			CKLBSprite*	pRender	= rdr.allocateCommandSprite((CKLBImageAsset*)pAsset,order);

			items[idxImg].handle = handle;
			items[idxImg].sprite = pRender;
		}
	}

	bool bResult = initCore(order,x,y,idx,items,max);
	bResult = registUI(pParent, bResult);
	if(pNode) {
		pParent->getNode()->removeNode(getNode());
		pNode->addNode(getNode());
	}
	return bResult;
}
Пример #7
0
bool
CKLBUIScore::init(CKLBUITask * pParent, CKLBNode * pNode,
                  u32 order, s32 order_offset, float x, float y, 
                  const char ** tex_table, float stepX, float stepY, int column, 
                  bool fillzero, bool anim_flag, u32 align, bool countclip)
{
    if(!setupNode()) { return false; }

	// ユーザ定義初期化を呼び、初期化に失敗したら終了。
	bool bResult = initCore(order, order_offset, x, y, tex_table, stepX, stepY, column, fillzero, anim_flag, align, countclip);

	// 初期化処理終了後の登録。失敗時の処理も適切に行う。
	bResult = registUI(pParent, bResult);
	if(pNode) {
		pParent->getNode()->removeNode(getNode());
		pNode->addNode(getNode());
	}

	return bResult;
}
Пример #8
0
AbstractHimmel::AbstractHimmel()
:   osg::MatrixTransform()
,   m_timef(NULL)
,   m_autoUpdateTime(false)

,   m_initialized(false)
,   m_dirty(false)

,   m_cameraHint(NULL)
,   m_widthHint(0u)
,   m_heightHint(0u)

,   m_lastElapsed(0.0)

,   m_referenceBoundingRadius(1.f)
{
    setupNode(getOrCreateStateSet());

    setUpdateCallback(new HimmelNodeCallback);

    setReferenceFrame(osg::Transform::ABSOLUTE_RF);
};
Пример #9
0
void DiagramWindow::addNode()
{
    Node *node = new Node;
    node->setText(tr("Node %1").arg(seqNumber + 1));
    setupNode(node);
}