当前位置: 首页>>代码示例>>C++>>正文


C++ TextureChunkPtr::setEnvColor方法代码示例

本文整理汇总了C++中TextureChunkPtr::setEnvColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureChunkPtr::setEnvColor方法的具体用法?C++ TextureChunkPtr::setEnvColor怎么用?C++ TextureChunkPtr::setEnvColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextureChunkPtr的用法示例。


在下文中一共展示了TextureChunkPtr::setEnvColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: traverseGState


//.........这里部分代码省略.........
                    intformat = tex->getFormat(PFTEX_INTERNAL_FORMAT);
                    
                    
                    ImagePtr img = Image::create();
                    beginEditCP(img);
                    
                    img->set(pf, w, h, d, 1, 1, 0, NULL, type, 1, sides);
                    
                    if(sides == 1)
                    {
                        memcpy(img->getData(), pdata, img->getSize());
                    }
                    else
                    {
                        FWARNING(("PerformerLoader::traverseGState: "
                                  "CubeTex not impl yet!\n"));
                    }
                    
                    endEditCP(img);
                    
                    texc->setImage(img);
                    
                    texc->setInternalFormat(intformat);
                    
                    texc->setWrapS(tex->getRepeat(PFTEX_WRAP_S));
                    texc->setWrapT(tex->getRepeat(PFTEX_WRAP_T));
                    texc->setWrapR(tex->getRepeat(PFTEX_WRAP_R));
 
                    static int ptexfilter[] = { PFTEX_POINT,
                                                PFTEX_LINEAR,
                                                PFTEX_BILINEAR,
                                                PFTEX_TRILINEAR,
                                                PFTEX_QUADLINEAR,
                                                PFTEX_MIPMAP_POINT,
                                                PFTEX_MIPMAP_LINEAR,
                                                PFTEX_MIPMAP_BILINEAR,
                                                PFTEX_MIPMAP_TRILINEAR,
                                                PFTEX_MIPMAP_QUADLINEAR,
                                                -1
                                              };
                    static int otexfilter[] = { GL_NEAREST,
                                                GL_LINEAR,
                                                GL_LINEAR,
                                                GL_LINEAR,
                                                GL_LINEAR,
                                                GL_NEAREST_MIPMAP_NEAREST,
                                                GL_NEAREST_MIPMAP_LINEAR,
                                                GL_LINEAR_MIPMAP_NEAREST,
                                                GL_LINEAR_MIPMAP_LINEAR,
                                                GL_LINEAR_MIPMAP_LINEAR
                                              };

                    int ptf = tex->getFilter(PFTEX_MINFILTER);
                    UInt32 otf = GL_NONE;
                    for (UInt16 i = 0; ptexfilter[i] != -1; ++i)
                        if(ptexfilter[i] == ptf)
                            otf = otexfilter[i];
                    texc->setMinFilter(otf);

                    ptf = tex->getFilter(PFTEX_MAGFILTER);
                    otf = GL_NONE;
                    for (UInt16 i = 0; ptexfilter[i] != -1; ++i)
                        if(ptexfilter[i] == ptf)
                            otf = otexfilter[i];
                    texc->setMagFilter(otf);
                }

	            if (!(inherit & PFSTATE_TEXENV))
	            {
                    pfTexEnv *te = 
                        (pfTexEnv*)gstate->getMultiAttr(PFSTATE_TEXENV, t);
	                
                    if(te != NULL)
                    {
                        texc->setEnvMode(te->getMode());

                        float r,g,b,a;
                        te->getBlendColor(&r,&g,&b,&a);

                        texc->setEnvColor(Color4f(r,g,b,a));
                    }
	            }

                endEditCP(texc);
            }

            mat->addChunk(texc);
        } // for t
    }
 
    /* Unhandled: lightmodel, lights, fog, texgen, texlod, vtxprog, fragprog,
                  gprogparms, colortable, highlight, lpointstate, shadprog
    */

    endEditCP(mat);
    
    _materials[gstate] = mat;
    
    return mat;
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:101,代码来源:OSGPerformerLoader.cpp

示例2: main


//.........这里部分代码省略.........
    mchunk1->setShininess( 20 );

    mchunk2 = MaterialChunk::create();
    mchunk2->setDiffuse( Color4f( 0,1,0,0 ) );
    mchunk2->setAmbient( Color4f( 0,1,0,0 ) );
    mchunk2->setShininess( 50 );

    // Texture chunk

//  UChar8 imgdata[] =
//      {  255,0,0,0,  0,255,0,0,  0,0,255,255,  255,255,255,255 };
    UChar8 imgdata[] =
        {  255,0,0,  255,0,0,  255,0,255,
           255,0,0,  255,0,0,  255,0,255,
           255,255,0,  255,255,0,  255,255,255,
           255,255,0,  255,255,0,  255,255,255, };
//  UChar8 limgdata[] =
//      {  0, 128, 64, 255 };
    pImage->set( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata );

    if ( argc > 1 )
        pImage->read( argv[1] );

    xchunk1 = TextureChunk::create();
    beginEditCP(xchunk1);
    xchunk1->setImage( pImage ); // NOTE: the image is NOT copied, the variable
                                 // needs to be kept around as long as the 
                                 // texture is used
    xchunk1->setMinFilter( GL_LINEAR );
    xchunk1->setMagFilter( GL_NEAREST );
    xchunk1->setWrapS( GL_REPEAT );
    xchunk1->setWrapT( GL_REPEAT );
    xchunk1->setEnvMode( GL_REPLACE );
    xchunk1->setEnvColor( Color4f(.5,.5,.5,0) );
    xchunk1->setScale( false );
    
//    xchunk1->setShaderOperation(GL_PASS_THROUGH_NV);
    
    endEditCP(xchunk1);

    xchunk1->imageContentChanged();

    beginEditCP(xchunk1);
    xchunk1->setImage( pImage );
    endEditCP(xchunk1);

    // blend chunk

    blchunk = BlendChunk::create();
#ifdef GL_EXT_blend_color
    blchunk->setSrcFactor( GL_CONSTANT_ALPHA );
    blchunk->setDestFactor( GL_ONE_MINUS_CONSTANT_ALPHA );
#endif
    blchunk->setColor( Color4f( .5,.5,.5,0.1 ) );
    blchunk->setEquation(GL_FUNC_SUBTRACT);

    std::cout << "BlendChunk is trans:" << blchunk->isTransparent() << std::endl;
    
    // texture transform chunk

    txchunk = TextureTransformChunk::create();
    beginEditCP(txchunk);
    txchunk->setMatrix( Matrix(4,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1) );
    endEditCP(txchunk);

    // polygon chunk
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:67,代码来源:testStateChunkRender.cpp


注:本文中的TextureChunkPtr::setEnvColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。