• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ readFloat函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中readFloat函数的典型用法代码示例。如果您正苦于以下问题:C++ readFloat函数的具体用法?C++ readFloat怎么用?C++ readFloat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: findNextNoneWhiteSpace

void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount, SMeshBufferLightMap* sbuffer)
{
	core::stringc data = reader->getNodeData();
	const c8* p = &data[0];

	if (sbuffer)
	{
		video::S3DVertex2TCoords vtx;

		for (int i=0; i<vertexCount && *p; ++i)
		{
			// position

			findNextNoneWhiteSpace(&p);
			vtx.Pos.X = readFloat(&p);
			findNextNoneWhiteSpace(&p);
			vtx.Pos.Y = readFloat(&p);
			findNextNoneWhiteSpace(&p);
			vtx.Pos.Z = readFloat(&p);

			// normal

			findNextNoneWhiteSpace(&p);
			vtx.Normal.X = readFloat(&p);
			findNextNoneWhiteSpace(&p);
			vtx.Normal.Y = readFloat(&p);
			findNextNoneWhiteSpace(&p);
			vtx.Normal.Z = readFloat(&p);

			// color

			findNextNoneWhiteSpace(&p);
			sscanf(p, "%08x", &vtx.Color.color);
			skipCurrentNoneWhiteSpace(&p);

			// tcoord1

			findNextNoneWhiteSpace(&p);
			vtx.TCoords.X = readFloat(&p);
			findNextNoneWhiteSpace(&p);
			vtx.TCoords.Y = readFloat(&p);

			// tcoord2

			findNextNoneWhiteSpace(&p);
			vtx.TCoords2.X = readFloat(&p);
			findNextNoneWhiteSpace(&p);
			vtx.TCoords2.Y = readFloat(&p);

			sbuffer->Vertices.push_back(vtx);
		}
	}
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:53,代码来源:CIrrMeshFileLoader.cpp


示例2: ASSERT

PathSegmentData SVGPathByteStreamSource::parseSegment()
{
    ASSERT(hasMoreData());
    PathSegmentData segment;
    segment.command = static_cast<SVGPathSegType>(readSVGSegmentType());

    switch (segment.command) {
    case PathSegCurveToCubicRel:
    case PathSegCurveToCubicAbs:
        segment.point1 = readFloatPoint();
        /* fall through */
    case PathSegCurveToCubicSmoothRel:
    case PathSegCurveToCubicSmoothAbs:
        segment.point2 = readFloatPoint();
        /* fall through */
    case PathSegMoveToRel:
    case PathSegMoveToAbs:
    case PathSegLineToRel:
    case PathSegLineToAbs:
    case PathSegCurveToQuadraticSmoothRel:
    case PathSegCurveToQuadraticSmoothAbs:
        segment.targetPoint = readFloatPoint();
        break;
    case PathSegLineToHorizontalRel:
    case PathSegLineToHorizontalAbs:
        segment.targetPoint.setX(readFloat());
        break;
    case PathSegLineToVerticalRel:
    case PathSegLineToVerticalAbs:
        segment.targetPoint.setY(readFloat());
        break;
    case PathSegClosePath:
        break;
    case PathSegCurveToQuadraticRel:
    case PathSegCurveToQuadraticAbs:
        segment.point1 = readFloatPoint();
        segment.targetPoint = readFloatPoint();
        break;
    case PathSegArcRel:
    case PathSegArcAbs: {
        segment.arcRadii() = readFloatPoint();
        segment.setArcAngle(readFloat());
        segment.arcLarge = readFlag();
        segment.arcSweep = readFlag();
        segment.targetPoint = readFloatPoint();
        break;
    }
    default:
        ASSERT_NOT_REACHED();
    }
    return segment;
}
开发者ID:mtucker6784,项目名称:chromium,代码行数:52,代码来源:SVGPathByteStreamSource.cpp


示例3: getTransformTranslate

/** ------------------------------------------------------------------------ **
 * \internal                                                                  *
 * \brief Get a Translate Transform                                           *
 *                                                                            *
 * \param pDecISF structure used to decode the ISF file.                      *
 *                                                                            *
 * \returns the error code given while processing                             *
 ** ------------------------------------------------------------------------ **/
int getTransformTranslate (decodeISF_t * pDecISF)
{
    int err = OK;
    transform_t * pTransform;

    /**
     * This tag consists of 2 values describing a translate transform matrix.\n
     * Those two values are coded in the stream as floats (IEEE 754)\n
     * We have in order:
     * - dx
     * - dy
     *
     * The transform matrix is :\n
     * \f[
     *	\mbox{T} = \left( \begin{array}{ccc} 0 & 0 & \mbox{dx} \\ 0 & 0 & \mbox{dy} \\ 0 & 0 & 1\\ \end{array} \right)
     * \f]
     *
     * In fact the transform matrix shouldn't be like that cause that
     * transformation don't translate.\n
     * Anyway, it seems to work this way with the .Net 3.0 framework ...
     * The transform matrix should be :\n
     * \f[
     *	\mbox{T} = \left( \begin{array}{ccc} \mbox{1} & 0 & \mbox{dx} \\ 0 & \mbox{1} & \mbox{dy} \\ 0 & 0 & 1\\ \end{array} \right)
     * \f]
     */

    /* Check whether we should add a transform or use the default one */
    if (pDecISF->lastTransform != &(pDecISF->transforms) )
    {
        err = createTransform(&pTransform);
        if (err != OK)
            return err;
    } else {
        pTransform = *(pDecISF->lastTransform);
    }

    err = readFloat (pDecISF, &pTransform->m13);
    if (err != OK) return err;
    err = readFloat (pDecISF, &pTransform->m23);
    if (err != OK) return err;

    LOG(stdout,"(TRANSFORM_TRANSLATE) m13 = %f\n", pTransform->m13);
    LOG(stdout,"(TRANSFORM_TRANSLATE) m23 = %f\n", pTransform->m23);

    /* Insert the current Transform */
    *(pDecISF->lastTransform) = pTransform;
    pDecISF->lastTransform = &(pTransform->next);

    return err;
}
开发者ID:wodim,项目名称:amsn,代码行数:58,代码来源:decodeTags.c


示例4: readHotstartFile

void readHotstartFile(void)
//
//  Input:   none
//  Output:  none
//  Purpose: reads initial state of all nodes and links from hotstart file.
//
{
    int   i, j;
    long  pos, size;
    float x;

    // --- check that file has correct size
    pos = ftell(Fhotstart1.file);
    fseek(Fhotstart1.file, 0L, SEEK_END);
    size = ( ftell(Fhotstart1.file) - pos ) / sizeof(float);
    if ( size < Nobjects[NODE] * (2 + 2*Nobjects[POLLUT]) +
                Nobjects[LINK] * (3 + Nobjects[POLLUT]) )
    {
         report_writeErrorMsg(ERR_HOTSTART_FILE_READ, "");
         return;
    }
    fseek(Fhotstart1.file, pos, SEEK_SET);

    // --- read node states
    for (i = 0; i < Nobjects[NODE]; i++)
    {
        if ( !readFloat(&x) ) return;
        Node[i].newDepth = x;
        if ( !readFloat(&x) ) return;
        Node[i].newLatFlow = x;
        for (j = 0; j < Nobjects[POLLUT]; j++)
        {
            if ( !readFloat(&x) ) return;
            Node[i].newQual[j] = x;
        }

        // --- read in zero here for back compatibility
        for (j = 0; j < Nobjects[POLLUT]; j++)
        {
            if ( !readFloat(&x) ) return;
        }
    }

    // --- read link states
    for (i = 0; i < Nobjects[LINK]; i++)
    {
        if ( !readFloat(&x) ) return;
        Link[i].newFlow = x;
        if ( !readFloat(&x) ) return;
        Link[i].newDepth = x;
        if ( !readFloat(&x) ) return;
        Link[i].setting = x;
        for (j = 0; j < Nobjects[POLLUT]; j++)
        {
            if ( !readFloat(&x) ) return;
            Link[i].newQual[j] = x;
        }
    }
}
开发者ID:obergshavefun,项目名称:icap,代码行数:59,代码来源:routing.c


示例5: assert

void Noise::parse(vector<string> args) {
    assert(args.size() < 3, "-noise takes zero, one, or two arguments\n");

    float maxVal = 1;
    float minVal = 0;
    if (args.size() == 1) {
        maxVal = readFloat(args[0]);
    } else if (args.size() == 2) {
        minVal = readFloat(args[0]);
        maxVal = readFloat(args[1]);
    }

    apply(stack(0), minVal, maxVal);

}
开发者ID:CommonLibrary,项目名称:ImageStack,代码行数:15,代码来源:Statistics.cpp


示例6: assert

void Quantize::parse(vector<string> args) {
    assert(args.size() <= 1, "-quantize takes zero or one arguments\n");
 
    if (args.size()) apply(stack(0), readFloat(args[0]));
    else apply(stack(0), 1);
                           
}
开发者ID:rashadkm,项目名称:ossim_uwimp,代码行数:7,代码来源:Arithmetic.cpp


示例7: writeOpcode

float
RemotePluginClient::getParameterDefault(int p)
{
    writeOpcode(m_controlRequestFd, RemotePluginGetParameterDefault);
    writeInt(m_controlRequestFd, p);
    return readFloat(m_controlResponseFd);
}
开发者ID:GomesMarcos,项目名称:dssi-vst,代码行数:7,代码来源:remotepluginclient.cpp


示例8: while

WalkingEngineKick::Value* WalkingEngineKick::readValue(char*& buf)
{
  while(*buf == ' ' || *buf == '\t')
    ++buf;
  switch(*buf)
  {
  case '(':
  {
    ++buf;
    Value* result = readPlusFormula(buf);
    while(*buf == ' ' || *buf == '\t')
      ++buf;
    if(*buf != ')')
      throw ParseException("expected ')'");
    ++buf;
    return result;
  }
  case '$':
  {
    ++buf;
    unsigned int i = readUInt(buf);
    return new ParameterValue(i, *this);
  }
  default:
  {
    float f = readFloat(buf);
    return new ConstantValue(f, *this);
  }
  }
}
开发者ID:MisterSquishy,项目名称:nbites,代码行数:30,代码来源:WalkingEngineKick.cpp


示例9: assert

bool BranchState::readFloat( Token::Argument& argument )
{
	assert( argument.type() == Token::Argument::FLOAT_REGISTER );

	if( argument.content() == Token::Argument::REGISTER )
	{
		return readFloat( argument.regNumber(), argument.fields() );
	}
	else if( argument.content() == Token::Argument::ALIAS )
	{
		std::map< std::string, State >::iterator i = m_floats.find( argument.alias() );

		// has this alias been written already?

		if( i == m_floats.end() )
			return false;

		// make sure no uninitialized portion of the alias is read

		if( argument.fields() & (~(i->second.fields())) )
			return false;

		// update dependency information

		updateDependency( argument, i->second, Alias::FLOAT, i->first, true );
	}
	else return false;

	return true;
}
开发者ID:jsvennevid,项目名称:openvcl,代码行数:30,代码来源:BranchState.cpp


示例10: readInt

bool CCBReader::readSequences()
{
    auto& sequences = _animationManager->getSequences();

    int numSeqs = readInt(false);

    for (int i = 0; i < numSeqs; i++)
    {
        CCBSequence *seq = new (std::nothrow) CCBSequence();
        seq->autorelease();

        seq->setDuration(readFloat());
        seq->setName(readCachedString().c_str());
        seq->setSequenceId(readInt(false));
        seq->setChainedSequenceId(readInt(true));

        if(!readCallbackKeyframesForSeq(seq)) return false;
        if(!readSoundKeyframesForSeq(seq)) return false;

        sequences.pushBack(seq);
    }

    _animationManager->setAutoPlaySequenceId(readInt(true));
    return true;
}
开发者ID:wanhuo,项目名称:cocos2d-x-lite,代码行数:25,代码来源:CCBReader.cpp


示例11: nextToken

double TokenStream::readRational() {
    Token t;

    double val=readFloat();
    if (!isEOF()) {
	nextToken(t);
	if (t.type == TT_SYMBOL && t.sval[0] == '/') {
	    double div=readFloat();
	    val /= div;
	} else {
	    pushBack();
	}
    }
    return val;

}
开发者ID:jspenguin,项目名称:glbumper,代码行数:16,代码来源:tokenizer.cpp


示例12: acoshf_cmd

static TACommandVerdict acoshf_cmd(TAThread thread,TAInputStream stream)
{
    float x, res;

    // Prepare

    x = readFloat(&stream);
    errno = 0;
    
    START_TARGET_OPERATION(thread);
    
    // Execute

    res = acoshf(x);
    
    END_TARGET_OPERATION(thread);
    
    // Response
    
    writeFloat(thread, res);
    writeInt(thread, errno);

    sendResponse(thread);
    return taDefaultVerdict;
}
开发者ID:levenkov,项目名称:olver,代码行数:25,代码来源:hyper_agent.c


示例13: Exception

void MD5Model::readFrameEl(std::ifstream &fin, Anim &anim) {
	// numAnimatedComponents has to have been set before frame element
	if (0 == anim.numAnimatedComponents)
		throw Exception("MD5Model::readFrameEl(): numAnimatedComponents must be set before 'frame' block");

	// read frame index
	int frameIndex = readInt(fin);

	if (frameIndex < 0 || frameIndex >= anim.numFrames)
		throw Exception("MD5Model::readFrameEl(): invalid frame index");

	// get reference to frame and set number of animated components
	Frame &frame = anim.frames[frameIndex];
	frame.animatedComponents.resize(anim.numAnimatedComponents);

	TOKEN t = getNextToken(fin);

	// expect an opening brace { to begin block
	if (t != TOKEN_LBRACE)
		throw Exception("MD5Model::readFrameEl(): expected { to follow frame index");

	for (int i = 0; i < anim.numAnimatedComponents; i++)
		frame.animatedComponents[i] = readFloat(fin); // 刚好读取frame中的位置数加上方位数总flaot数

	t = getNextToken(fin);

	// expect a closing brace } to end block
	if (t != TOKEN_RBRACE)
		throw Exception("MD5Model::readFrameEl(): expected }");
}
开发者ID:Jeromecen,项目名称:MD5SkeletalAnimation,代码行数:30,代码来源:MD5Model.cpp


示例14: readDouble

bool GTM::readTrackPoints( double& latitude, double& longitude,
                           GIntBig& datetime,
                           unsigned char& start, float& altitude)
{
    /* Point to the actual trackpoint offset */
    if ( VSIFSeekL(pGTMFile, actualTrackpointOffset, SEEK_SET) != 0)
        return false;

    /* Read latitude */
    latitude = readDouble(pGTMFile);

    /* Read longitude */
    longitude = readDouble(pGTMFile);

    /* Read trackpoint date */
    datetime = readInt(pGTMFile);
    if (datetime != 0)
        datetime += GTM_EPOCH;

    /* Read start flag */
    if ( !readFile( &start, 1, 1 ) )
        return false;

    /* Read altitude */
    altitude = readFloat(pGTMFile);

    ++trackpointFetched;
    if (trackpointFetched < ntcks)
    {
        actualTrackpointOffset += 8 + 8 + 4 + 1 + 4;
    }
    return true;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:33,代码来源:gtm.cpp


示例15: diffuseColor

Material* SceneParser::parsePhongMaterial() {
	char token[MAX_PARSER_TOKEN_LENGTH];
	Vec3f diffuseColor(1, 1, 1);
	Vec3f specularColor(0, 0, 0);
	float exponent = 1;
	getToken(token); assert(!strcmp(token, "{"));
	while (1) {
		getToken(token);
		if (!strcmp(token, "diffuseColor")) {
			diffuseColor = readVec3f();
		}
		else if (!strcmp(token, "specularColor")) {
			specularColor = readVec3f();
		}
		else if (!strcmp(token, "exponent")) {
			exponent = readFloat();
		}
		else {
			assert(!strcmp(token, "}"));
			break;
		}
	}
	Material *answer = new PhongMaterial(diffuseColor, specularColor, exponent);
	return answer;
}
开发者ID:ChanganVR,项目名称:ray-tracer,代码行数:25,代码来源:scene_parser.cpp


示例16: readLiteral

static Literal readLiteral(FILE *f) {
  int tag = readTag(f);
  switch (tag) {
    case LIT_STR:
      { 
	LiteralStr lit = (LiteralStr) malloc(sizeof(struct _LiteralStr));
        lit->_.tag = tag;
        lit->val   = readString(f);
        return ((Literal) lit);
      }
    case LIT_INT:
      { 
	LiteralInt lit = (LiteralInt) malloc(sizeof(struct _LiteralInt));
        lit->_.tag = tag;
        lit->val   = readInt(f);
        return ((Literal) lit);
      }
    case LIT_FLOAT:
      {
        LiteralFloat lit = (LiteralFloat) malloc(sizeof(struct _LiteralFloat));
        lit->_.tag = tag;
        lit->val   = readFloat(f);
        return ((Literal) lit);
      }
    default:
      __pgf_panic("Unknown literal tag");
  }
}
开发者ID:McMbuvi,项目名称:GF-core,代码行数:28,代码来源:loader.c


示例17: while

//! reads floats from inside of xml element until end of xml element
void CIrrMeshFileLoader::readFloatsInsideElement(io::IXMLReader* reader, f32* floats, u32 count)
{
	if (reader->isEmptyElement())
		return;

	while(reader->read())
	{
		// TODO: check for comments inside the element
		// and ignore them.

		if (reader->getNodeType() == io::EXN_TEXT)
		{
			// parse float data
			core::stringc data = reader->getNodeData();
			const c8* p = &data[0];

			for (u32 i=0; i<count; ++i)
			{
				findNextNoneWhiteSpace(&p);
				if (*p)
					floats[i] = readFloat(&p);
				else
					floats[i] = 0.0f;
			}
		}
		else
		if (reader->getNodeType() == io::EXN_ELEMENT_END)
			break; // end parsing text
	}
}
开发者ID:codetiger,项目名称:IrrNacl,代码行数:31,代码来源:CIrrMeshFileLoader.cpp


示例18: diffuseColor

Material *
SceneParser::parseMaterial() 
{
    char token[MAX_PARSER_TOKEN_LENGTH];
    char filename[MAX_PARSER_TOKEN_LENGTH];
    filename[0] = 0;
    Vector3f diffuseColor(1,1,1), specularColor(0,0,0);
    float shininess=0;
    getToken(token); assert(!strcmp(token, "{"));
    while (true) {
        getToken(token); 
        if (strcmp(token, "diffuseColor")==0) {
            diffuseColor = readVector3f();
        }
        else if (strcmp(token, "specularColor")==0) {
            specularColor = readVector3f();
        }
        else if (strcmp(token, "shininess")==0) {
            shininess = readFloat();
        }
        else if (strcmp(token, "texture")==0) {
            getToken(filename);
        }
        else {
            assert(!strcmp(token, "}"));
            break;
        }
    }
    Material *answer = new Material(diffuseColor, specularColor, shininess);
    if(filename[0] !=0){
        answer->loadTexture(filename);
    }
    return answer;
}
开发者ID:sskirlo,项目名称:Computer-Graphics-,代码行数:34,代码来源:SceneParser.cpp


示例19: diffuseColor

Material* SceneParser::parseMaterial() {
    char token[MAX_PARSER_TOKEN_LENGTH];
	char filename[MAX_PARSER_TOKEN_LENGTH];
	filename[0] = 0;
    Vector3f diffuseColor(1,1,1), specularColor(0,0,0);
	float shininess=0;
	float refractionIndex =0;
    getToken(token); assert (!strcmp(token, "{"));
	Noise *noise =0;
    while (1) {
        getToken(token); 
        if (strcmp(token, "diffuseColor")==0) {
            diffuseColor = readVector3f();
        }
		else if (strcmp(token, "specularColor")==0) {
            specularColor = readVector3f();
        }
		else if (strcmp(token, "shininess")==0) {
            shininess = readFloat();
        }else if(strcmp(token, "refractionIndex")==0){
			refractionIndex = readFloat();
		}
		else if (strcmp(token, "texture")==0) {
            getToken(filename);
        }
		///unimplemented
		else if (strcmp(token, "bump")==0) {
            getToken(token);
        }
		else if(strcmp(token,"Noise")==0){
			noise = parseNoise();
		}
		else {
            assert (!strcmp(token, "}"));
            break;
        }
    }
    Material *answer = new Material(diffuseColor, specularColor, shininess,refractionIndex);
	if(filename[0] !=0){
		answer->loadTexture(filename);
	}
	if(noise != 0){
		answer->setNoise(*noise);
		delete noise;
	}
    return answer;
}
开发者ID:pmqmiracle,项目名称:nothing,代码行数:47,代码来源:SceneParser.cpp


示例20: parse

void Mod::parse(vector<string> args) {
    vector<float> fargs;
    for (size_t i = 0; i < args.size(); i++) {
	fargs.push_back(readFloat(args[i]));
    }
	
    apply(stack(0), fargs);
}
开发者ID:rashadkm,项目名称:ossim_uwimp,代码行数:8,代码来源:Arithmetic.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ readFrame函数代码示例发布时间:2022-05-30
下一篇:
C++ readFile函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap