Ejemplo n.º 1
0
void
init(void)
{
    
    renderShaderID = loadShaders("shaders/vShader.c", "shaders/fShader.c");
    shadowShaderID = loadShaders("shaders/shadowVShader.c", "shaders/shadowFShader.c");
    
    //initShadowMap();
    
    gltbInit(GLUT_LEFT_BUTTON);
    
    /* read in the model */
    model = glmReadOBJ(model_file);
    scale = glmUnitize(model);
    glmFacetNormals(model);
    glmVertexNormals(model, smoothing_angle);
    
    if (model->nummaterials > 0)
        material_mode = 2;
    
    /* create new display lists */
    lists();
    
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
    
    //glEnable(GL_DEPTH_TEST);
    
    //glEnable(GL_CULL_FACE);
}
Ejemplo n.º 2
0
/**
 * Return true if aFrame's subtree has placeholders for out-of-flow content
 * whose 'position' style's bit in aPositionMask is set.
 */
static bool
FrameHasPositionedPlaceholderDescendants(nsIFrame* aFrame,
                                         uint32_t aPositionMask)
{
  const nsIFrame::ChildListIDs skip(nsIFrame::kAbsoluteList |
                                    nsIFrame::kFixedList);
  for (nsIFrame::ChildListIterator lists(aFrame); !lists.IsDone(); lists.Next()) {
    if (!skip.Contains(lists.CurrentID())) {
      for (nsIFrame* f : lists.CurrentList()) {
        if (f->GetType() == nsGkAtoms::placeholderFrame) {
          nsIFrame* outOfFlow =
            nsPlaceholderFrame::GetRealFrameForPlaceholder(f);
          // If SVG text frames could appear here, they could confuse us since
          // they ignore their position style ... but they can't.
          NS_ASSERTION(!outOfFlow->IsSVGText(),
                       "SVG text frames can't be out of flow");
          if (aPositionMask & (1 << outOfFlow->StyleDisplay()->mPosition)) {
            return true;
          }
        }
        if (FrameHasPositionedPlaceholderDescendants(f, aPositionMask)) {
          return true;
        }
      }
    }
  }
  return false;
}
Ejemplo n.º 3
0
// 主函数-用于测试
int main() {
    // 初始化链表
    linkList list = initLinkList();
    // 插入三个元素
    inserts(&list, 333);
    inserts(&list, 222);
    inserts(&list, 2222);

    // 遍历链表
    lists(&list);

    // 求列表中元素个数
    printf("size = %d\n", list.size);


    // 获取列表中的元素
    printf("value = %d\n", getElement(&list, 0));
    printf("value = %d\n", getElement(&list, 1));
    printf("value = %d\n", getElement(&list, 2));

    // 删除列表中的元素
    deletes(&list, 2);

    printf("value = %d\n", getElement(&list, 0));
    printf("value = %d\n", getElement(&list, 1));
    // 查看最终列表中元素个数
    printf("size = %d\n", list.size);
}
Ejemplo n.º 4
0
void
init(void)
{
  int i;

  tbInit(GLUT_MIDDLE_BUTTON);
  tbAnimate(GL_FALSE);

  /* create initial display lists */
  lists();

  /* lighting */
  glDisable(GL_LIGHTING);

  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);

  glEnable(GL_CULL_FACE);

  glutSetColor(NUMCOLORS+1, 0.0, 0.0, 0.0);
  glClearIndex(NUMCOLORS+1);

  glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);

}
Ejemplo n.º 5
0
void
init(void)
{
    gltbInit(GLUT_LEFT_BUTTON);
  
    /* read in the model */
    model = glmReadOBJ(model_file);
    scale = glmUnitize(model);
    glmFacetNormals(model);
    glmVertexNormals(model, smoothing_angle);

    if (model->nummaterials > 0)
	material_mode = 2;

    /* create new display lists */
    lists();

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);

    glEnable(GL_DEPTH_TEST);

    glEnable(GL_CULL_FACE);
}
Ejemplo n.º 6
0
void KoTextDocument::removeList(KoList *list)
{
    QList<KoList *> l = lists();
    if (l.contains(list)) {
        l.removeAll(list);
        setLists(l);
    }
}
Ejemplo n.º 7
0
void PublicHubsFrame::updateDropDown() {
	ctrlPubLists.ResetContent();
	StringList lists(FavoriteManager::getInstance()->getHubLists());
	for(StringList::iterator idx = lists.begin(); idx != lists.end(); ++idx) {
		ctrlPubLists.AddString(Text::toT(*idx).c_str());
	}
	ctrlPubLists.SetCurSel(FavoriteManager::getInstance()->getSelectedHubList());
}
Ejemplo n.º 8
0
void KoTextDocument::addList(KoList *list)
{
    Q_ASSERT(list);
    list->setParent(m_document);
    QList<KoList *> l = lists();
    if (l.contains(list))
        return;
    l.append(list);
    setLists(l);
}
Ejemplo n.º 9
0
void
nsPopupSetFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{
  ListGeneric(out, aIndent, aFlags);

  // Output the children
  bool outputOneList = false;
  ChildListIterator lists(this);
  for (; !lists.IsDone(); lists.Next()) {
    if (outputOneList) {
      IndentBy(out, aIndent);
    }
    outputOneList = true;
    fprintf(out, "%s<\n", mozilla::layout::ChildListName(lists.CurrentID()));
    nsFrameList::Enumerator childFrames(lists.CurrentList());
    for (; !childFrames.AtEnd(); childFrames.Next()) {
      nsIFrame* kid = childFrames.get();
      // Verify the child frame's parent frame pointer is correct
      NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer");

      // Have the child frame list
      kid->List(out, aIndent + 1, aFlags);
    }
    IndentBy(out, aIndent);
    fputs(">\n", out);
  }

  // XXXmats the above is copy-pasted from nsContainerFrame::List which is lame,
  // clean this up after bug 399111 is implemented.

  if (!mPopupList.IsEmpty()) {
    fputs("<\n", out);
    ++aIndent;
    IndentBy(out, aIndent);
    fputs(mozilla::layout::ChildListName(kPopupList), out);
    fputs(" for ", out);
    ListTag(out);
    fputs(" <\n", out);
    ++aIndent;
    for (nsFrameList::Enumerator e(mPopupList); !e.AtEnd(); e.Next()) {
      e.get()->List(out, aIndent, aFlags);
    }
    --aIndent;
    IndentBy(out, aIndent);
    fputs(">\n", out);
    --aIndent;
    IndentBy(out, aIndent);
    fputs(">\n", out);
    outputOneList = true;
  }

  if (!outputOneList) {
    fputs("<>\n", out);
  }
}
Ejemplo n.º 10
0
static void
AddSubtreeToOverflowTracker(nsIFrame* aFrame,
                            OverflowChangedTracker& aOverflowChangedTracker)
{
  if (aFrame->FrameMaintainsOverflow()) {
    aOverflowChangedTracker.AddFrame(aFrame,
                                     OverflowChangedTracker::CHILDREN_CHANGED);
  }
  nsIFrame::ChildListIterator lists(aFrame);
  for (; !lists.IsDone(); lists.Next()) {
    for (nsIFrame* child : lists.CurrentList()) {
      AddSubtreeToOverflowTracker(child, aOverflowChangedTracker);
    }
  }
}
Ejemplo n.º 11
0
/* static */ void
nsFontFaceUtils::MarkDirtyForFontChange(nsIFrame* aSubtreeRoot,
                                        const gfxUserFontEntry* aFont)
{
  AutoTArray<nsIFrame*, 4> subtrees;
  subtrees.AppendElement(aSubtreeRoot);

  nsIPresShell* ps = aSubtreeRoot->PresContext()->PresShell();

  // check descendants, iterating over subtrees that may include
  // additional subtrees associated with placeholders
  do {
    nsIFrame* subtreeRoot = subtrees.ElementAt(subtrees.Length() - 1);
    subtrees.RemoveElementAt(subtrees.Length() - 1);

    // Check all descendants to see if they use the font
    AutoTArray<nsIFrame*, 32> stack;
    stack.AppendElement(subtreeRoot);

    do {
      nsIFrame* f = stack.ElementAt(stack.Length() - 1);
      stack.RemoveElementAt(stack.Length() - 1);

      // if this frame uses the font, mark its descendants dirty
      // and skip checking its children
      if (FrameUsesFont(f, aFont)) {
        ScheduleReflow(ps, f);
      } else {
        if (f->GetType() == nsGkAtoms::placeholderFrame) {
          nsIFrame* oof = nsPlaceholderFrame::GetRealFrameForPlaceholder(f);
          if (!nsLayoutUtils::IsProperAncestorFrame(subtreeRoot, oof)) {
            // We have another distinct subtree we need to mark.
            subtrees.AppendElement(oof);
          }
        }

        nsIFrame::ChildListIterator lists(f);
        for (; !lists.IsDone(); lists.Next()) {
          nsFrameList::Enumerator childFrames(lists.CurrentList());
          for (; !childFrames.AtEnd(); childFrames.Next()) {
            nsIFrame* kid = childFrames.get();
            stack.AppendElement(kid);
          }
        }
      }
    } while (!stack.IsEmpty());
  } while (!subtrees.IsEmpty());
}
Ejemplo n.º 12
0
void
DjVuPortcaster::compute_closure(const DjVuPort * src, GPList<DjVuPort> &list, bool sorted)
{
   GCriticalSectionLock lock(&map_lock);
   GMap<const void*, void*> set;
   if (route_map.contains(src))
   {
      GList<void *> & list=*(GList<void *> *) route_map[src];
      for(GPosition pos=list;pos;++pos)
      {
	       DjVuPort * dst=(DjVuPort *) list[pos];
	       if (dst==src) add_to_closure(set, src, 0);
	       else add_to_closure(set, dst, 1);
      }
   }

   // Compute list
   GPosition pos;
   if (sorted)
     {
       // Sort in depth order
       int max_dist=0;
       for(pos=set;pos;++pos)
         if (max_dist < (int)(long)set[pos])
           max_dist = (int)(long)set[pos];
       GArray<GList<const void*> > lists(0,max_dist);
       for(pos=set;pos;++pos)
         lists[(int)(long)set[pos]].append(set.key(pos));
       for(int dist=0;dist<=max_dist;dist++)
         for(pos=lists[dist];pos;++pos)
           {
             GP<DjVuPort> p = is_port_alive((DjVuPort*) lists[dist][pos]);
             if (p) list.append(p);
           }
     }
   else
     {
       // Gather ports without order
       for(pos=set;pos;++pos)
         {
           GP<DjVuPort> p = is_port_alive((DjVuPort*) set.key(pos));
           if (p) list.append(p);
         }
     }
}
Ejemplo n.º 13
0
static void updateSymlinks()
{
    QDir lists( listDir );
    QStringList knownPackages = lists.entryList( "*.list" ); // No tr

    struct mntent *me;
    FILE *mntfp = setmntent( "/etc/mtab", "r" );

    if ( mntfp ) {
        while ( (me = getmntent( mntfp )) != 0 ) {
            QString root = me->mnt_dir;
            if ( root == "/" )
                continue;

            QString info = root + "/usr/lib/ipkg/info";
            QDir infoDir( info );
//      odebug << "looking at " << info.ascii() << "" << oendl;
            if ( infoDir.isReadable() ) {
                const QFileInfoList *packages = infoDir.entryInfoList( "*.list" ); // No tr
                QFileInfoListIterator it( *packages );
                QFileInfo *fi;
                while (( fi = *it )) {
                    ++it;
                    if ( knownPackages.contains( fi->fileName() ) ) {
//          odebug << "found " << fi->fileName() << " and we've seen it before" << oendl;
                        knownPackages.remove( fi->fileName() );
                    } else {
                        //it's a new one
                        createSymlinks( root, fi->baseName() );
                    }

                }

            }
        }
        endmntent( mntfp );
    }

    for ( QStringList::Iterator it = knownPackages.begin();
            it != knownPackages.end(); ++it ) {
        // strip ".info" off the end.
        removeSymlinks( (*it).left((*it).length()-5) );
    }
}
Ejemplo n.º 14
0
void
init(void)
{
  gltbInit(GLUT_LEFT_BUTTON);
    
  /* read in the model */
  model = glmReadOBJ(model_file);
  scale = glmUnitize(model);
  glmFacetNormals(model);
  glmVertexNormals(model, smoothing_angle);
    
  if (model->nummaterials > 0)
    material_mode = 2;
    
  /* create new display lists */
  lists();
  /*  GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
  
   glLightfv(GL_LIGHT0, GL_POSITION, light_position);

  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  //glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);     
  glEnable(GL_DEPTH_TEST);     
  glEnable(GL_CULL_FACE);
*/

  GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
  GLfloat mat_shininess[] = { 50.0 };
  GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
  glClearColor (0.0, 0.0, 0.0, 0.0);
  glShadeModel (GL_SMOOTH);
  
  glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
  glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
  glLightfv(GL_LIGHT0, GL_POSITION, light_position);
  
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
   glEnable(GL_DEPTH_TEST);


}
Ejemplo n.º 15
0
int main(int argc, char **argv)
{    
    ListNode *list1 = NULL;
    ListNode* curr1 = NULL; // Technocally it should be current
    insert(curr1, 1);
    list1 = curr1;
    for(int i = 1; i < NUM; i++)
        insert(curr1, i);
    curr1 = list1;
    traverse(curr1);

    ListNode *list2 = NULL;
    ListNode* curr2 = NULL;
    insert(curr2, 5);
    list2 = curr2;
    for(int i = 6; i < NUM + 5; i++)
        insert(curr2, i);
    curr2 = list2;
    traverse(curr2);
    
    ListNode *list3 = NULL;
    ListNode* curr3 = NULL;
    insert(curr3, 10);
    list3 = curr3;
    for(int i = 11; i < NUM + 10; i++)
        insert(curr3, i);
    curr3 = list3;
    traverse(curr3);
    
    std::vector<ListNode*>lists(3);
    lists[0] = list1;
    lists[1] = list2;
    lists[2] = list3;
    
    Solution merger;
    ListNode *list = merger.mergeKLists(lists);
    traverse(list);
    
    free(curr1);
    free(curr2);
    return(0);
}
Ejemplo n.º 16
0
static void
VerifyStyleTree(nsIFrame* aFrame)
{
  nsStyleContext* context = aFrame->StyleContext();
  VerifyContextParent(aFrame, context, nullptr);

  nsIFrame::ChildListIterator lists(aFrame);
  for (; !lists.IsDone(); lists.Next()) {
    for (nsIFrame* child : lists.CurrentList()) {
      if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
        // only do frames that are in flow
        if (nsGkAtoms::placeholderFrame == child->GetType()) {
          // placeholder: first recurse and verify the out of flow frame,
          // then verify the placeholder's context
          nsIFrame* outOfFlowFrame =
            nsPlaceholderFrame::GetRealFrameForPlaceholder(child);

          // recurse to out of flow frame, letting the parent context get resolved
          do {
            VerifyStyleTree(outOfFlowFrame);
          } while ((outOfFlowFrame = outOfFlowFrame->GetNextContinuation()));

          // verify placeholder using the parent frame's context as
          // parent context
          VerifyContextParent(child, nullptr, nullptr);
        } else { // regular frame
          VerifyStyleTree(child);
        }
      }
    }
  }

  // do additional contexts
  int32_t contextIndex = 0;
  for (nsStyleContext* extraContext;
       (extraContext = aFrame->GetAdditionalStyleContext(contextIndex));
       ++contextIndex) {
    VerifyContextParent(aFrame, extraContext, context);
  }
}
Ejemplo n.º 17
0
void
menu(int item)
{
    int i = 0;
    DIR* dirp;
    char* name;
    struct dirent* direntp;
    
    if (item > 0) {
        keyboard((unsigned char)item, 0, 0);
    } else {
        dirp = opendir(DATA_DIR);
        while ((direntp = readdir(dirp)) != NULL) {
            if (strstr(direntp->d_name, ".obj")) {
                i++;
                if (i == -item)
                    break;
            }
        }
        if (!direntp)
            return;
        name = (char*)malloc(strlen(direntp->d_name) + strlen(DATA_DIR) + 1);
        strcpy(name, DATA_DIR);
        strcat(name, direntp->d_name);
        model = glmReadOBJ(name);
        scale = glmUnitize(model);
        glmFacetNormals(model);
        glmVertexNormals(model, smoothing_angle);
        
        if (model->nummaterials > 0)
            material_mode = 2;
        else
            material_mode = 0;
        
        lists();
        free(name);
        
        glutPostRedisplay();
    }
}
Ejemplo n.º 18
0
int main() {
  Solution sol;
  vector<ListNode> nodes {
    3, 4, 4, 7, 0, 7, 7, 8, 0, 9
  };
  vector<ListNode *> lists(nodes.size()/2);
  for (int i = 0; i < nodes.size()/2; ++i) {
    lists[i] = &nodes[2*i];
    lists[i]->next = &nodes[2*i+1];
    print_list(lists[i]);
  }

  ListNode *head = sol.mergeKLists(lists);
  print_list(head);

  vector<ListNode*> v;
  v.push_back(NULL);
  head = sol.mergeKLists(v);
  print_list(head);

  return 0;
}
Ejemplo n.º 19
0
static void
SyncViewsAndInvalidateDescendants(nsIFrame* aFrame, nsChangeHint aChange)
{
  NS_PRECONDITION(gInApplyRenderingChangeToTree,
                  "should only be called within ApplyRenderingChangeToTree");
  NS_ASSERTION(nsChangeHint_size_t(aChange) ==
                          (aChange & (nsChangeHint_RepaintFrame |
                                      nsChangeHint_SyncFrameView |
                                      nsChangeHint_UpdateOpacityLayer |
                                      nsChangeHint_SchedulePaint)),
               "Invalid change flag");

  nsView* view = aFrame->GetView();
  if (view) {
    if (aChange & nsChangeHint_SyncFrameView) {
      nsContainerFrame::SyncFrameViewProperties(aFrame->PresContext(), aFrame,
                                                nullptr, view);
    }
  }

  nsIFrame::ChildListIterator lists(aFrame);
  for (; !lists.IsDone(); lists.Next()) {
    for (nsIFrame* child : lists.CurrentList()) {
      if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
        // only do frames that don't have placeholders
        if (nsGkAtoms::placeholderFrame == child->GetType()) {
          // do the out-of-flow frame and its continuations
          nsIFrame* outOfFlowFrame =
            nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
          DoApplyRenderingChangeToTree(outOfFlowFrame, aChange);
        } else if (lists.CurrentID() == nsIFrame::kPopupList) {
          DoApplyRenderingChangeToTree(child, aChange);
        } else { // regular frame
          SyncViewsAndInvalidateDescendants(child, aChange);
        }
      }
    }
  }
}
folly::Future<int32_t> service_with_special_namesSvIf::future_lists() {
  return apache::thrift::detail::si::future([&] { return lists(); });
}
Ejemplo n.º 21
0
int
run_program(int argc, char **argv)
{
  CommandLineArgument<int> number_of_list_files;
  int next_command_line_argument = 0;
  bool echo_commands = false;

  for (int i = 1; ((i < argc) && (!have_argument_p(number_of_list_files))); i++) {
    std::string argument(argv[i]);
    if (argument == "--help") {
      print_usage();
      return 0;
    } else if (argument == "--echo") {
      echo_commands = true;
    } else if (!have_argument_p(number_of_list_files)) {
      number_of_list_files = argument;
      next_command_line_argument = i + 1;
    }
  }

  if (!have_argument_p(number_of_list_files)) {
    print_usage();
    return -1;
  }
  
  if (*number_of_list_files == 0)
    return 0;

  const int minimum_number_of_arguments = 0
    + *number_of_list_files
    + 1 // the command;
    + 0;

  if ((argc - next_command_line_argument) < minimum_number_of_arguments)
    throw make_runtime_error("Not enough arguments available for processing.\n");

  std::list<std::string> standard_input_list;
  bool have_read_standard_input_list = false;

  std::vector<std::string> list_filenames(*number_of_list_files);
  std::vector<std::list<std::string> > lists(*number_of_list_files);  
  for (int i = 0; i < *number_of_list_files; i++) {    
    int argument_index = i + next_command_line_argument;
    std::string list_file = argv[argument_index];
    std::list<std::string> l;
    
    if ((list_file == "-") && (have_read_standard_input_list)) {
      l = standard_input_list;
    } else if ((list_file == "-")) {
      standard_input_list = read_list(std::cin);
      have_read_standard_input_list = true;
      l = standard_input_list;
    } else if (!file_exists_p(list_file)) {
      throw make_runtime_error("List file %s does not exist.", list_file.c_str());
    } else {
      l = read_list(list_file.c_str());
    }

    list_filenames[i] = list_file;
    lists[i] = l;
  }
  next_command_line_argument += *number_of_list_files;

  // read the command and its options.
  std::string command(argv[next_command_line_argument]);
  std::list<std::string> command_arguments;
  std::copy(argv + next_command_line_argument + 1, argv + argc, std::back_inserter(command_arguments));

  // check all lists are the same size.
  for (size_t i = 0; i < lists.size(); i++) {
    if (lists[i].size() != lists[0].size())
      throw make_runtime_error("The number of entires in list %s (%d) differs to %s (%d).", 
			       list_filenames[i].c_str(),
			       lists[i].size(),
			       list_filenames[0].c_str(),
			       lists[0].size());
  }

  EchoRunner echo_runner(std::cout);
  ForkRunner fork_runner;

  Runner *runner = 0;
  if (echo_commands) 
    runner = &echo_runner;  
  else
    runner = &fork_runner;

  assert(runner);
  std::vector<std::list<std::string>::const_iterator> iterators(*number_of_list_files);
  for (int i = 0; i < *number_of_list_files; i++)
    iterators[i] = lists[i].begin();

  for (size_t i = 0; i < lists[0].size(); i++) {
    std::string invocation_command = command;
    std::list<std::string> invocation_arguments;
    std::copy(command_arguments.begin(), command_arguments.end(), std::back_inserter(invocation_arguments));
    for (size_t j = 0; j < iterators.size(); j++) {
      invocation_arguments.push_back(*iterators[j]);
      iterators[j]++;
    }

    runner->perform(invocation_command, invocation_arguments);
  }

  return 0;
}
Ejemplo n.º 22
0
void
keyboard(unsigned char key, int x, int y)
{
    GLint params[2];
    
    switch (key) {
    case 'h':
        printf("help\n\n");
        printf("w         -  Toggle wireframe/filled\n");
        printf("c         -  Toggle culling\n");
        printf("n         -  Toggle facet/smooth normal\n");
        printf("b         -  Toggle bounding box\n");
        printf("r         -  Reverse polygon winding\n");
        printf("m         -  Toggle color/material/none mode\n");
        printf("p         -  Toggle performance indicator\n");
        printf("s/S       -  Scale model smaller/larger\n");
        printf("t         -  Show model stats\n");
        printf("o         -  Weld vertices in model\n");
        printf("+/-       -  Increase/decrease smoothing angle\n");
        printf("W         -  Write model to file (out.obj)\n");
        printf("q/escape  -  Quit\n\n");
        break;
        
    case 't':
        stats = !stats;
        break;
        
    case 'p':
        performance = !performance;
        break;
        
    case 'm':
        material_mode++;
        if (material_mode > 2)
            material_mode = 0;
        printf("material_mode = %d\n", material_mode);
        lists();
        break;
        
    case 'd':
        glmDelete(model);
        init();
        lists();
        break;
        
    case 'w':
        glGetIntegerv(GL_POLYGON_MODE, params);
        if (params[0] == GL_FILL)
            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        else
            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
        break;
        
    case 'c':
        if (glIsEnabled(GL_CULL_FACE))
            glDisable(GL_CULL_FACE);
        else
            glEnable(GL_CULL_FACE);
        break;
        
    case 'b':
        bounding_box = !bounding_box;
        break;
        
    case 'n':
        facet_normal = !facet_normal;
        lists();
        break;
        
    case 'r':
        glmReverseWinding(model);
        lists();
        break;
        
    case 's':
        glmScale(model, 0.8);
        lists();
        break;
        
    case 'S':
        glmScale(model, 1.25);
        lists();
        break;
        
    case 'o':
        //printf("Welded %d\n", glmWeld(model, weld_distance));
        glmVertexNormals(model, smoothing_angle);
        lists();
        break;
        
    case 'O':
        weld_distance += 0.01;
        printf("Weld distance: %.2f\n", weld_distance);
        glmWeld(model, weld_distance);
        glmFacetNormals(model);
        glmVertexNormals(model, smoothing_angle);
        lists();
        break;
        
    case '-':
        smoothing_angle -= 1.0;
        printf("Smoothing angle: %.1f\n", smoothing_angle);
        glmVertexNormals(model, smoothing_angle);
        lists();
        break;
        
    case '+':
        smoothing_angle += 1.0;
        printf("Smoothing angle: %.1f\n", smoothing_angle);
        glmVertexNormals(model, smoothing_angle);
        lists();
        break;
        
    case 'W':
        glmScale(model, 1.0/scale);
        glmWriteOBJ(model, "out.obj", GLM_SMOOTH | GLM_MATERIAL);
        break;
        
    case 'R':
        {
            GLuint i;
            GLfloat swap;
            for (i = 1; i <= model->numvertices; i++) {
                swap = model->vertices[3 * i + 1];
                model->vertices[3 * i + 1] = model->vertices[3 * i + 2];
                model->vertices[3 * i + 2] = -swap;
            }
            glmFacetNormals(model);
            lists();
            break;
        }
        
    case 27:
        exit(0);
        break;
    }
    
    glutPostRedisplay();
}
Ejemplo n.º 23
0
NS_IMETHODIMP
nsPopupSetFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const
{
  IndentBy(out, aIndent);
  ListTag(out);
#ifdef DEBUG_waterson
  fprintf(out, " [parent=%p]", static_cast<void*>(mParent));
#endif
  if (HasView()) {
    fprintf(out, " [view=%p]", static_cast<void*>(GetView()));
  }
  if (GetNextSibling()) {
    fprintf(out, " next=%p", static_cast<void*>(GetNextSibling()));
  }
  if (nullptr != GetPrevContinuation()) {
    fprintf(out, " prev-continuation=%p", static_cast<void*>(GetPrevContinuation()));
  }
  if (nullptr != GetNextContinuation()) {
    fprintf(out, " next-continuation=%p", static_cast<void*>(GetNextContinuation()));
  }
  fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height);
  if (0 != mState) {
    fprintf(out, " [state=%016llx]", (unsigned long long)mState);
  }
  fprintf(out, " [content=%p]", static_cast<void*>(mContent));
  nsPopupSetFrame* f = const_cast<nsPopupSetFrame*>(this);
  if (f->HasOverflowAreas()) {
    nsRect overflowArea = f->GetVisualOverflowRect();
    fprintf(out, " [vis-overflow=%d,%d,%d,%d]",
            overflowArea.x, overflowArea.y,
            overflowArea.width, overflowArea.height);
    overflowArea = f->GetScrollableOverflowRect();
    fprintf(out, " [scr-overflow=%d,%d,%d,%d]",
            overflowArea.x, overflowArea.y,
            overflowArea.width, overflowArea.height);
  }
  fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext));
  nsIAtom* pseudoTag = mStyleContext->GetPseudo();
  if (pseudoTag) {
    nsAutoString atomString;
    pseudoTag->ToString(atomString);
    fprintf(out, " pst=%s",
            NS_LossyConvertUTF16toASCII(atomString).get());
  }

  // Output the children
  bool outputOneList = false;
  ChildListIterator lists(this);
  for (; !lists.IsDone(); lists.Next()) {
    if (outputOneList) {
      IndentBy(out, aIndent);
    }
    outputOneList = true;
    fprintf(out, "%s<\n", mozilla::layout::ChildListName(lists.CurrentID()));
    nsFrameList::Enumerator childFrames(lists.CurrentList());
    for (; !childFrames.AtEnd(); childFrames.Next()) {
      nsIFrame* kid = childFrames.get();
      // Verify the child frame's parent frame pointer is correct
      NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer");

      // Have the child frame list
      kid->List(out, aIndent + 1, aFlags);
    }
    IndentBy(out, aIndent);
    fputs(">\n", out);
  }

  // XXXmats the above is copy-pasted from nsContainerFrame::List which is lame,
  // clean this up after bug 399111 is implemented.

  if (!mPopupList.IsEmpty()) {
    fputs("<\n", out);
    ++aIndent;
    IndentBy(out, aIndent);
    fputs(mozilla::layout::ChildListName(kPopupList), out);
    fputs(" for ", out);
    ListTag(out);
    fputs(" <\n", out);
    ++aIndent;
    for (nsFrameList::Enumerator e(mPopupList); !e.AtEnd(); e.Next()) {
      e.get()->List(out, aIndent, aFlags);
    }
    --aIndent;
    IndentBy(out, aIndent);
    fputs(">\n", out);
    --aIndent;
    IndentBy(out, aIndent);
    fputs(">\n", out);
    outputOneList = true;
  }

  if (!outputOneList) {
    fputs("<>\n", out);
  }

  return NS_OK;
}
Ejemplo n.º 24
0
/**	Parse calculator/hoc program(s)...
 *
 *	@return The number of errors encountered.
 */
unsigned Parser::operator()() {
	return lists();
}